checkpoint
[sbp.git] / tests / meta.g
index be8e435..845af52 100644 (file)
@@ -1,6 +1,13 @@
-s             =  ws grammar:Grammar ws
 Grammar       =  NonTerminal +/ ws
+s             =  !ws (grammar::Grammar) !ws
 NonTerminal   =  Word ^"=" RHS /ws
+
+// use 'a'-'z' or 'a-z' instead of [a-z]?
+// EOF token?
+// #include (with renaming?)
+// ANTLR uses ! and ^ suffixes
+
+blah = "Grammar"
         
 RHS           =  (Sequence +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
 
@@ -25,7 +32,7 @@ e             =                (Quoted|Word) ^":" e
               > nonTerminal::          Word
               | literal::       Quoted
               |                  ^"()"
-              |                  ^"{" Sequence "}"       /ws
+              |                  ^"{" PreSequence "}"    /ws
               |                  ^"["  Range* "]"
               |                e ^"++"                   /ws -> ~[/]
               |                e ^"+"                    /ws -> ~[+]
@@ -41,7 +48,7 @@ e             =                (Quoted|Word) ^":" e
               |     "(" Word     ^")"                    /ws
               >                  ^"(" RHS  ")"           /ws
               |                  ^"~" e
-              >  "^^"::           "^"   e
+              >  "^^"::           "^" e
 
 Word       = [a-zA-Z0-9_]++
 Quoted     = "\"" ((~[\"\\] | escaped)+) "\""
@@ -52,5 +59,5 @@ escaped    = "\n":: "\\n"
 
 w             = " " | "\n" | "\r"
 ws            =  "()":: w**
-              |  "()":: w** "//" ~[\n]* "\n" ws
+              |  "()":: w** "//" (~[\n])* "\n" ws
 wp            =  w++