projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
checkpoint
[sbp.git]
/
tests
/
meta.g
diff --git
a/tests/meta.g
b/tests/meta.g
index
0d2be6f
..
cbfee2a
100644
(file)
--- a/
tests/meta.g
+++ b/
tests/meta.g
@@
-1,6
+1,11
@@
-s = ws grammar:Grammar ws
Grammar = NonTerminal +/ ws
Grammar = NonTerminal +/ ws
-NonTerminal = Word !wp ^"=" !wp RHS
+s = !ws (grammar::Grammar) !ws
+NonTerminal = Word ^"=" RHS /ws
+
+// use 'a'-'z' or 'a-z' instead of [a-z]?
+// EOF token?
+// #include (with renaming?)
+// ANTLR uses ! and ^ suffixes
RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
@@
-8,12
+13,12
@@
Elements = e*/ws
PreSequence = ps:: Elements
| (Quoted|Word) ^"::" PreSequence /ws
PreSequence = ps:: Elements
| (Quoted|Word) ^"::" PreSequence /ws
- > PreSequence !wp ^"/" !ws e
- | PreSequence ^"->" e /ws
+ > PreSequence ^"/" e /ws
+ | PreSequence ^"->" e /ws
Sequence = psx:: PreSequence
Sequence = psx:: PreSequence
- | Sequence !ws ^"&" !ws Elements
- | Sequence !ws ^"&~" !ws Elements
+ | Sequence ^"&" Elements /ws
+ | Sequence ^"&~" Elements /ws
ec = ~[\-\]\\]
| escaped
ec = ~[\-\]\\]
| escaped
@@
-25,7
+30,7
@@
e = (Quoted|Word) ^":" e
> nonTerminal:: Word
| literal:: Quoted
| ^"()"
> nonTerminal:: Word
| literal:: Quoted
| ^"()"
- | ^"{" Sequence "}" /ws
+ | ^"{" PreSequence "}" /ws
| ^"[" Range* "]"
| e ^"++" /ws -> ~[/]
| e ^"+" /ws -> ~[+]
| ^"[" Range* "]"
| e ^"++" /ws -> ~[/]
| e ^"+" /ws -> ~[+]
@@
-41,7
+46,7
@@
e = (Quoted|Word) ^":" e
| "(" Word ^")" /ws
> ^"(" RHS ")" /ws
| ^"~" e
| "(" Word ^")" /ws
> ^"(" RHS ")" /ws
| ^"~" e
- > "^^":: "^" e
+ > "^^":: "^" e
Word = [a-zA-Z0-9_]++
Quoted = "\"" ((~[\"\\] | escaped)+) "\""
Word = [a-zA-Z0-9_]++
Quoted = "\"" ((~[\"\\] | escaped)+) "\""
@@
-52,5
+57,5
@@
escaped = "\n":: "\\n"
w = " " | "\n" | "\r"
ws = "()":: w**
w = " " | "\n" | "\r"
ws = "()":: w**
- | "()":: w** "//" ~[\n]* "\n" ws
+ | "()":: w** "//" (~[\n])* "\n" ws
wp = w++
wp = w++