X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Fmeta.g;h=02464c31e2e0261a606b409b6fd0b2e158cf88b8;hp=eb793c5fe91d9ac0b42fd7d66dcb26b9b438f16f;hb=df76fcb56242a90011500ab89092d2108350a8ab;hpb=d643fa7e95ca16571a8621ded500abf0215fd5ae diff --git a/tests/meta.g b/tests/meta.g index eb793c5..02464c3 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,22 +1,23 @@ +// use 'a'-'z' or 'a-z' instead of [a-z]? +// EOF token? +// #include (with renaming?) + 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?) -// ANTLR uses ! and ^ suffixes - +NonTerminal = Word "=" RHS /ws + | Word "*" ws! ^"=" ws! RHS + | Word "*/" Word ws! ^"=" ws! RHS + RHS = (Sequence +/ (ws! "|" ws!)) +/ (ws! ">" ws!) Elements = e*/ws -PreSequence = ps:: Elements - | (Quoted|Word) ^"::" PreSequence /ws - > PreSequence ^"/" e /ws - | PreSequence ^"->" e /ws +PreSequence = Elements + | (Quoted|Word) ^"::" PreSequence /ws + > PreSequence ^"/" e /ws + | PreSequence ^"->" e /ws Sequence = psx:: PreSequence | Sequence ^"&" Elements /ws @@ -45,7 +46,6 @@ e = (Quoted|Word) ^":" e | e ^"!" | e ^"?" /ws | ^"^" Quoted - | Quoted ^"^" > ^"(" RHS ")" /ws | ^"~" e @@ -53,7 +53,8 @@ NonTerminalReference = Word Literal = Quoted Word = [a-zA-Z0-9_]++ Quoted = "\"" ((~[\"\\] | escaped)+) "\"" - | "":: "\"\"" + | EmptyString + EmptyString = "\"\"" escaped = "\n":: "\\n" | "\r":: "\\r"