checkpoint
[sbp.git] / tests / meta.g
index 11fee67..98a62a3 100644 (file)
@@ -1,5 +1,5 @@
-s         ::=  ws grammar ws                  => "gram"
-ws       !::=  w**
+s         ::=  grammar ws                  => "gram"
+ws       !::=  w** | w** "//" (~[\n]*) "\n" ws
 wp       !::=  w++
 grammar   ::=  r +/ ws                        => "grammar"
 
@@ -16,14 +16,15 @@ ps         ::= e*/ws                              => "ps"
              | (e+/ws ws)? "^" quoted (ws e+/ws)? => "ps2"
 psy        ::= ps
              | ps wp ^"/" ws e
-psx        ::= psy ^"?=>" e /ws
-             | psy ^"!=>" e /ws
-             > psy
+psx        ::= psy                   => "psy"
+             | e "<-" psy        /ws => "psyl"
+             |        psy "->" e /ws => "psyr"
+             | e "<-" psy "->" e /ws => "psylr"
 sequence   ::= quoted => "qprod"
              > psx
              | psx ^"=>" (word|quoted) /ws
 
-ec       ::= [~\-\]\\\~]
+ec       ::= ~[\-\]\\]
            | escaped
 
 range    ::= ec          => "range"
@@ -34,7 +35,6 @@ e        ::=  word                          => "nonTerminal"
            |    ^"()"
            |    ^"{" sequence "}"       /ws
            |    ^"["  range* "]"
-           |    ^"[~" range* "]"
 
            |  (e ^"++"    /ws > e ^"+"    /ws)
            |  (e ^"++/" e /ws > e ^"+/" e /ws)
@@ -44,15 +44,16 @@ e        ::=  word                          => "nonTerminal"
 
            |     "(" word         ^")"  /ws
            >    ^"(" alternatives  ")"  /ws
+           |    ^"~" e
+
 w       !::= " "
-           | "//" ([~\n]*) "\n"
            | "\n"
            | "\r"
 word     ::= [a-zA-Z0-9_]++
-quoted   ::= "\"" (([~\"\\] | escaped)+) "\""
+quoted   ::= "\"" ((~[\"\\] | escaped)+) "\""
            | "\"\"" => ""
 escaped  ::= "\\n" => "\n"
            | "\\r" => "\r"
-           | "\\" [~nr]
+           | "\\" ~[nr]