X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fmeta.g;h=be8e435d9370275e14adcbe89137e28c612141b8;hb=1a249057cbfd2180910e46672eafee3af46ae470;hp=e81e67c9ff2caf04a419b7db517d895e8d6cf5fe;hpb=6ba9ea820f9626a7504da6cf442e2cef1601914f;p=sbp.git diff --git a/tests/meta.g b/tests/meta.g index e81e67c..be8e435 100644 --- a/tests/meta.g +++ b/tests/meta.g @@ -1,19 +1,19 @@ -s = gram:: !ws Grammar ws -Grammar = grammar:: NonTerminal +/ ws -NonTerminal = word !wp ^"=" !wp RHS +s = ws grammar:Grammar ws +Grammar = NonTerminal +/ ws +NonTerminal = Word ^"=" RHS /ws -RHS = (Conjuncts +/ (!ws "|" !ws)) +/ (!ws ">" !ws) +RHS = (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws) -Conjuncts = Sequence - | Sequence ^"&" Elements /ws - | Sequence ^"&~" Elements /ws Elements = e*/ws PreSequence = ps:: Elements - | PreSequence !wp ^"/" !ws e - | PreSequence ^"->" e /ws - | (Quoted|word) ^"::" PreSequence /ws + | (Quoted|Word) ^"::" PreSequence /ws + > PreSequence ^"/" e /ws + | PreSequence ^"->" e /ws + Sequence = psx:: PreSequence + | Sequence ^"&" Elements /ws + | Sequence ^"&~" Elements /ws ec = ~[\-\]\\] | escaped @@ -21,8 +21,8 @@ ec = ~[\-\]\\] Range = range:: ec | ec ^"-" ec -e = (Quoted|word) ^":" e - > nonTerminal:: word +e = (Quoted|Word) ^":" e + > nonTerminal:: Word | literal:: Quoted | ^"()" | ^"{" Sequence "}" /ws @@ -38,19 +38,18 @@ e = (Quoted|word) ^":" e | ^"!" e /ws | e ^"?" /ws | ^"^" Quoted - | "(" word ^")" /ws + | "(" Word ^")" /ws > ^"(" RHS ")" /ws | ^"~" e > "^^":: "^" e -word = [a-zA-Z0-9_]++ +Word = [a-zA-Z0-9_]++ Quoted = "\"" ((~[\"\\] | escaped)+) "\"" | "":: "\"\"" escaped = "\n":: "\\n" | "\r":: "\\r" | "\\" ~[nr] - w = " " | "\n" | "\r" ws = "()":: w** | "()":: w** "//" ~[\n]* "\n" ws