fix javadoc generation
[sbp.git] / src / edu / berkeley / sbp / meta / meta.g
1 //funkanomitron
2 s             = ws Grammar ws
3
4 Grammar::     = Declaration +/ ws
5
6 Declaration   = NonTerminal
7               | ^"#import" FileName            /ws
8               | ^"#import" FileName "as" Word  /ws
9
10 FileName::    = (~[\r\n ] | escaped)+ -> [\r\n ]
11
12 NonTerminal   = NonTerminal:: Word            ws  "=" ws RHS
13               | DropNT::      Word  "!"       ws  "=" ws RHS
14               | Colons::      Word  "::"      ws  "=" ws RHS
15               |               Word  "*"       ws ^"=" ws RHS
16               |               Word  "*/" Word ws ^"=" ws RHS
17        
18 RHS::         = ("|":: Sequence +/ (ws "|" ws)) +/ (ws (">" -> ~">") ws)
19
20 Elements::    = e*/ws
21
22 PreSequence   = Elements
23               | (Quoted|Word)   ^"::" PreSequence /ws
24               > PreSequence     ^"/"      e       /ws
25               | PreSequence     ^"->"     e       /ws
26
27 Sequence      = PreSequence
28               | Sequence ^"&"  Elements /ws
29               | ^"~~"  Elements /ws
30               | Sequence ^"&~" Elements /ws
31
32 e             =                                   e ^"!"
33               >                (Quoted|Word) ^":" e
34               >                NonTerminalReference:: Word
35               |                Literal:: Quoted
36               |                  ^"()"
37               |                  ^"["  Range* "]"
38               |                e ^"++"                   /ws -> ~[/]
39               |                e ^"+"                    /ws -> ~[+]
40               |                e ^"++/" e                /ws        
41               |                e ^"+/"  e                /ws        
42               |                e ^"**"                   /ws -> ~[/]
43               |                e ^"*"                    /ws -> ~[*]
44               |                e ^"**/" e                /ws        
45               |                e ^"*/"  e                /ws        
46               |                e ^"?"                    /ws
47               |                  ^"^"   Quoted
48               |                  ^"`"   e
49               |                  ^"..."
50               |                   "(" Word  ^")"
51               >                  ^"(" RHS  ")"           /ws
52               |                 "~":: ("~" -> ~"~")!  e
53               |                  ^">>"
54               |                  ^"<<"
55
56 Word::        = [.a-zA-Z0-9_]++ &~ "."+
57 Quoted::      = "\"" (~[\"\\] | escaped)+ "\""
58               | "\"\""
59
60 Range::       = ec
61               | ec "-" ec
62               | "<<":: [<][<]
63               | ">>":: [>][>]
64
65 ec            = ~[\-\]\\<>]
66               | [>] -> ~[>]
67               | [<] -> ~[<]
68               | escaped
69 escaped       = "\n"::  "\\n"
70               | "\r"::  "\\r"
71               | "\t"::  "\\t"
72               |         "\\" ~[nrt]
73
74 ws!          = [ \r\t\n]**
75              | [ \r\t\n]** "//" ~[\n]* "\n" ws