X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=tests%2Ffleet.g;h=965a71279e4e8b7126195551616d0b361978d9ba;hp=3f70ddf0b464c54171da8dceb3a6caef15b88ee2;hb=22a2ca7685dcf29e9ddcc6e26443ea0277385fca;hpb=0799e8b2438e6471cc7689d6a651508d5ab28135 diff --git a/tests/fleet.g b/tests/fleet.g index 3f70ddf..965a712 100644 --- a/tests/fleet.g +++ b/tests/fleet.g @@ -14,31 +14,42 @@ Comment = "//" ~[\n]* "\n" w = [\r\n ]* ws = (w | Comment)* -> ~[\r\n ] -s = !ws Program !ws -Program = CodeBag:: statements:(Statement +/ ws) +s = ws! Program ws! +Program = Program:: + (Directive ws!)* + CodeBagBody -Statement = Move !((ws ";")?) +Directive = Memory:: "#memory" "{" (int +/ (ws! "," ws!)) "}" /ws + | Import:: "#import" [A-Za-z_.]++ /ws + | Ship:: "#ship" shipname ":" [A-Za-z_\.]++ /ws + + +Statement = Move ((ws ";")?)! | CodeBag - | ^"#define" Port Port /ws +// | ^"#define" Port Port /ws Move = Source ^"->" Destination /ws | Source ^"->*" Destination /ws | Port ^":=" Source /ws -Destination = Port +/ (!ws "," !ws) +Destination = Port +/ (ws! "," ws!) Source = Port | CodeBag - -CodeBag = CodeBag:: - name:(name !ws ":" !ws)? +CodeBagBody = CodeBag:: (Statement +/ ws) +CodeBag = NamedCodeBag:: + name:(name ws! ":" ws!)? "{" - !ws statements:(Statement +/ ws) !ws + ws! statements:(Statement +/ ws) ws! "}" - (!ws ";")? - -Port = Port:: shipname ("." portname)* -shipname = ShipName:: name index? -portname = PortName:: name index? -name = [A-Za-z0-9\[\]\.]** + (ws! ";")?! + +//Port = Port:: shipname ("." portname)* +Port = Port:: shipname "." portname + | Port:: shipname +shipname = ShipName:: name (index?) +portname = PortName:: name (index?) +name = [A-Za-z0-9\[\]]** index = "[" [0-9]+ "]" | [0-9]+ +int = [0-9]++ +