checkpoint
[sbp.git] / tests / meta.g
index dd222e0..eba7a6d 100644 (file)
@@ -1,6 +1,6 @@
-s             =  !ws Grammar ws              => "gram"
-Grammar       =  NonTerminal +/ ws           => "grammar"
-NonTerminal   =  word  !wp ^"=" !wp RHS
+s             =  gram::    !ws Grammar ws
+Grammar       =  grammar:: NonTerminal +/ ws
+NonTerminal   =            word  !wp ^"=" !wp RHS
         
 RHS           =  (Conjuncts +/ (!ws "|" !ws)) +/ (!ws ">" !ws)
 
@@ -9,48 +9,47 @@ Conjuncts     =  Sequence
               |  Sequence ^"&~" Elements  /ws
 Elements      =  e*/ws
 
-PreSequence   = Elements => "ps"
-              | PreSequence !wp ^"/"  !ws e
-              | PreSequence     ^"->"     e /ws
-              | (Quoted|word)   ^"::" PreSequence /ws
-              | PreSequence     ^"=>" ("[]"|"()"|word|Quoted) /ws
-Sequence      = PreSequence    => "psx"
+PreSequence   = ps::  Elements
+              |       PreSequence !wp ^"/"  !ws e
+              |       PreSequence     ^"->"     e /ws
+              |       (Quoted|word)   ^"::" PreSequence /ws
+              |       PreSequence     ^"=>" ("[]"|"()"|word|Quoted) /ws
+Sequence      = psx:: PreSequence
 
 ec            = ~[\-\]\\]
               | escaped
 
-Range         = ec          => "range"
-              | ec ^"-" ec
-
-e             =
-                (Quoted|word) ^":" e
-              >  word                          => "nonTerminal"
-              |  Quoted                        => "literal"
-              |    ^"()"
-              |    ^"{" Sequence "}"       /ws
-              |    ^"["  Range* "]"
-              |  e ^"++"                   /ws -> ~[/]
-              |  e ^"+"                    /ws -> ~[+]
-              |  e ^"++/" e                /ws        
-              |  e ^"+/"  e                /ws        
-              |  e ^"**"                   /ws -> ~[/]
-              |  e ^"*"                    /ws -> ~[*]
-              |  e ^"**/" e                /ws        
-              |  e ^"*/"  e                /ws        
-              |    ^"!"   e                /ws
-              |  e ^"?"                    /ws
-              |    ^"^" Quoted             /ws
-
-              |     "(" word         ^")"  /ws
-              >    ^"(" RHS  ")"           /ws
-              |    ^"~" e
+Range         = range:: ec
+              |         ec ^"-" ec
+
+e             =                (Quoted|word) ^":" e
+              > nonTerminal::          word
+              | literal::       Quoted
+              |                  ^"()"
+              |                  ^"{" Sequence "}"       /ws
+              |                  ^"["  Range* "]"
+              |                e ^"++"                   /ws -> ~[/]
+              |                e ^"+"                    /ws -> ~[+]
+              |                e ^"++/" e                /ws        
+              |                e ^"+/"  e                /ws        
+              |                e ^"**"                   /ws -> ~[/]
+              |                e ^"*"                    /ws -> ~[*]
+              |                e ^"**/" e                /ws        
+              |                e ^"*/"  e                /ws        
+              |                  ^"!"   e                /ws
+              |                e ^"?"                    /ws
+              |                  ^"^" Quoted             /ws
+
+              |                   "(" word         ^")"  /ws
+              >                  ^"(" RHS  ")"           /ws
+              |                  ^"~" e
 
 word       = [a-zA-Z0-9_]++
 Quoted     = "\"" ((~[\"\\] | escaped)+) "\""
-           | "\"\"" => ""
-escaped    = "\\n" => "\n"
-           | "\\r" => "\r"
-           | "\\" ~[nr]
+           | ""::   "\"\""
+escaped    = "\n":: "\\n"
+           | "\r":: "\\r"
+           |        "\\" ~[nr]
 
 
 w             = " " | "\n" | "\r"