aboutsummaryrefslogtreecommitdiff
path: root/grammars
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-12-19 19:04:21 -0800
committerBruce Hill <bruce@bruce-hill.com>2020-12-19 19:04:21 -0800
commit177bc55cfc405a7df0f666aa2dce29e428b9592c (patch)
tree5291e0b1ae573b5802b14385f5962ee9289054c9 /grammars
parentc28e6472594637c7c2d4ed826c376fa84737777e (diff)
Updated to use `a,b,c
Diffstat (limited to 'grammars')
-rw-r--r--grammars/bpeg.bp13
-rw-r--r--grammars/builtins.bp20
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