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
ce2aa6f
..
f414867
100644
(file)
--- a/
tests/meta.g
+++ b/
tests/meta.g
@@
-1,35
+1,36
@@
+s = ws! Grammar ws!
+
+Grammar = NonTerminal +/ ws
+
+NonTerminal = Word "=" RHS /ws
// use 'a'-'z' or 'a-z' instead of [a-z]?
// EOF token?
// #include (with renaming?)
// use 'a'-'z' or 'a-z' instead of [a-z]?
// EOF token?
// #include (with renaming?)
-// ANTLR uses ! and ^ suffixes
-
-s = !ws (grammar::Grammar) !ws
-Grammar = NonTerminal +/ ws
-NonTerminal = Word ^"=" RHS /ws
-RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
+RHS = (Sequence +/ (ws! "|" ws!)) +/ (ws! ">" ws!)
Elements = e*/ws
Elements = e*/ws
-PreSequence = ps:: Elements
- | (Quoted|Word) ^"::" PreSequence /ws
- > PreSequence ^"/" e /ws
- | PreSequence ^"->" e /ws
+PreSequence = PS
+ | (Quoted|Word) ^"::" PreSequence /ws
+ > PreSequence ^"/" e /ws
+ | PreSequence ^"->" e /ws
+PS = Elements
Sequence = psx:: PreSequence
Sequence = psx:: PreSequence
- | Sequence ^"&" Elements /ws
- | Sequence ^"&~" Elements /ws
+ | Sequence ^"&" PS /ws
+ | Sequence ^"&~" PS /ws
ec = ~[\-\]\\]
| escaped
ec = ~[\-\]\\]
| escaped
-Range = range:: ec
- | ec ^"-" ec
+Range = ec
+ | ec ^"-" ec
e = (Quoted|Word) ^":" e
e = (Quoted|Word) ^":" e
- > nonTerminal:: Word
- | literal:: Quoted
+ > NonTerminalReference
+ | Literal
| ^"()"
| ^"{" PreSequence "}" /ws
| ^"[" Range* "]"
| ^"()"
| ^"{" PreSequence "}" /ws
| ^"[" Range* "]"
@@
-41,22
+42,23
@@
e = (Quoted|Word) ^":" e
| e ^"*" /ws -> ~[*]
| e ^"**/" e /ws
| e ^"*/" e /ws
| e ^"*" /ws -> ~[*]
| e ^"**/" e /ws
| e ^"*/" e /ws
- | ^"!" e /ws
+ | e ^"!"
| e ^"?" /ws
| ^"^" Quoted
| e ^"?" /ws
| ^"^" Quoted
- | "(" Word ^")" /ws
> ^"(" RHS ")" /ws
| ^"~" e
> ^"(" RHS ")" /ws
| ^"~" e
- > "^^":: "^" e
-Word = [a-zA-Z0-9_]++
-Quoted = "\"" ((~[\"\\] | escaped)+) "\""
- | "":: "\"\""
+NonTerminalReference = Word
+Literal = Quoted
+Word = [a-zA-Z0-9_]++
+Quoted = "\"" ((~[\"\\] | escaped)+) "\""
+ | "":: "\"\""
+
escaped = "\n":: "\\n"
| "\r":: "\\r"
| "\\" ~[nr]
w = " " | "\n" | "\r"
ws = "()":: w**
escaped = "\n":: "\\n"
| "\r":: "\\r"
| "\\" ~[nr]
w = " " | "\n" | "\r"
ws = "()":: w**
- | "()":: w** "//" ~[\n]* "\n" ws
+ | "()":: w** "//" (~[\n])* "\n" ws
wp = w++
wp = w++