checkpoint
[sbp.git] / tests / meta.g
index 527cd46..a51109f 100644 (file)
@@ -1,6 +1,8 @@
-s             =  !ws (grammar::Grammar) !ws
+s             =  !ws Grammar !ws
+
 Grammar       =  NonTerminal +/ ws
-NonTerminal   =  Word ^"=" RHS /ws
+
+NonTerminal   =  Word "=" RHS /ws
 
 // use 'a'-'z' or 'a-z' instead of [a-z]?
 // EOF token?
@@ -23,12 +25,12 @@ Sequence      = psx:: PreSequence
 ec            = ~[\-\]\\]
               | escaped
 
-Range         = range:: ec
-              |         ec ^"-" ec
+Range         = ec
+              | ec ^"-" ec
 
 e             =                (Quoted|Word) ^":" e
-              > nonTerminal::          Word
-              | literal::       Quoted
+              >                NonTerminalReference
+              |                Literal
               |                  ^"()"
               |                  ^"{" PreSequence "}"    /ws
               |                  ^"["  Range* "]"
@@ -48,6 +50,8 @@ e             =                (Quoted|Word) ^":" e
               |                  ^"~" e
               >  "^^"::           "^" e
 
+NonTerminalReference = Word
+Literal = Quoted
 Word       = [a-zA-Z0-9_]++
 Quoted     = "\"" ((~[\"\\] | escaped)+) "\""
            | ""::   "\"\""