From 177bc55cfc405a7df0f666aa2dce29e428b9592c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 19 Dec 2020 19:04:21 -0800 Subject: Updated to use `a,b,c --- grammars/bpeg.bp | 13 +++++++------ grammars/builtins.bp | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/grammars/bpeg.bp b/grammars/bpeg.bp index ad98240..c9422a8 100644 --- a/grammars/bpeg.bp +++ b/grammars/bpeg.bp @@ -10,7 +10,7 @@ Def: @name=id _ `: __ ( String-pattern: ... % (Nodent / Escape / `\ pat [`;]) pat: simple-pat !(__("!="/"==")) / suffixed-pat -simple-pat: Upto-and / Dot / String / Char-range / Char / Nodent / Escape-range +simple-pat: Upto-and / Dot / String / Chars / Nodent / Escape-range / Escape / Repeat / Optional / After / Before / Capture / Replace / Ref / parens @@ -27,17 +27,18 @@ String: ( `" @s=*(Escape / !`".) (`" / @!={=> "Expected closing quote here"}) / `' @s=*(Escape / !`'.) (`' / @!={=> "Expected closing quote here"}) ) -Char-range: `` @low=. `- (@high=. / @!={=> "Expected a second character to form a character range"}) -Char: `` (@s=. / @!={=> "Expected a character following the '`'"}) +Chars: `` @+(Char/Char-range) % `, +Char-range: @low=. `- (@high=. / @!={=> "Expected a second character to form a character range"}) +Char: (@s=. / @!={=> "Expected a character following the '`'"}) Escape-range: `\ @low=escape-sequence `- @high=escape-sequence Escape: `\ (@s=escape-sequence / $ @!={=>"Backslashes are used for escape sequences, not splitting lines"} / @!={. *(Abc/`0-9) => "Invalid escape sequence: '@0'"} ) escape-sequence: ( - `n/`t/`r/`e/`b/`a/`v + `n,t,r,e,b,a,v / 1-3 `0-7 - / `x 2 (`0-9/`a-f/`A-F) + / `x 2 `0-9,a-f,A-F ) No: `! (_@pat / @!={=>"Expected a pattern after the exclamation mark"}) Nodent: `\ `N @@ -71,7 +72,7 @@ $: !. ^^: !<$. ^: !<. -id: "^^" / "^" / "__" / "_" / "$$" / "$" / "|" / (`a-z/`A-Z) *(`a-z/`A-Z/`0-9/`-) +id: "^^" / "^" / "__" / "_" / "$$" / "$" / "|" / `a-z,A-Z *`a-z,A-Z,0-9,- line-comment: `# .. $ block-comment: "#("..")#" % block-comment diff --git a/grammars/builtins.bp b/grammars/builtins.bp index ef2dc7e..f69f988 100644 --- a/grammars/builtins.bp +++ b/grammars/builtins.bp @@ -35,8 +35,8 @@ url-path: +(`/ *url-char) [`? +(+url-char`=+url-char)%`&] ipv4: 4 int % `. ipv6: 8 (4 Hex) % `: domain: +(+(Abc/digit/`-))%`. -url-char: Abc/digit/`$/`-/`_/`./`+/`!/`*/`'/`(/`)/`,/`% -email: +(Abc/digit/`./`-/`+) `@ domain +url-char: Abc/digit/`$,-,_,.,+,!,*,',(,),,,% +email: +(Abc/digit/`.,-,+) `@ domain nodent: \N !(\t/` ) indent: \N (` /\t) @@ -54,17 +54,17 @@ brackets: `[...`] % (brackets/string) braces: `{...`} % (braces/string) parens: `(...`) % (parens/string) string: `"..`" % (`\.) / `'..`' % (`\.) -id: !<(`a-z/`A-Z/`_/`0-9) (`a-z/`A-Z/`_) *(`a-z/`A-Z/`_/`0-9) -id-char: `a-z/`A-Z/`_/`0-9 -word: !<(`a-z/`A-Z/`_/`0-9) +(`a-z/`A-Z) !>(`0-9/`_) -|: !<(`a-z/`A-Z/`_/`0-9) / !>(`0-9/`_) -HEX: `0-9/`A-F -Hex: `0-9/`a-f/`A-F -hex: `0-9/`a-f +id: !<`a-z,A-Z,_,0-9 `a-z,A-Z,_ *`a-z,A-Z,_,0-9 +id-char: `a-z,A-Z,_,0-9 +word: !<`a-z,A-Z,_,0-9 +`a-z,A-Z !>`0-9,_ +|: !<`a-z,A-Z,_,0-9 / !>`a-z,A-Z,_,0-9 +HEX: `0-9,A-F +Hex: `0-9,a-f,A-F +hex: `0-9,a-f number: +`0-9 [`. *`0-9] / `. +`0-9 int: +`0-9 digit: `0-9 -Abc: `a-z/`A-Z +Abc: `a-z,A-Z ABC: `A-Z abc: `a-z esc: \e -- cgit v1.2.3