public Object _plus__plus_(final Element r) { return Repeat.maximal(Repeat.many1(r)); }
public Element _question_(final Element r) { return Repeat.maybe(r); }
+ public Object walk(Tree<String> tree) {
+ String head = tree.head();
+ if (tree.numChildren()==0) return super.walk(tree);
+ if ("\\n".equals(head)) return new Character('\n');
+ else if ("\\r".equals(head)) return new Character('\r');
+ else return super.walk(tree);
+ }
+
public MetaGrammar grammar(Object o, Union[] u, Object x) { return this; }
public Object gram(Object o, Object g, Object o2) { return g; }
public MetaGrammar grammar(Object[] o) { return this; }
- public char _backslash_n() { return '\n'; }
- public char _backslash_r() { return '\r'; }
public Element literal(String s) { Element ret = string(s); dropAll.add(ret); return ret; }
public Range _minus_(char a, char b) { return new Range(a, b); }
public Range range(char a) { return new Range(a, a); }
s ::= ws grammar ws => "gram"
-ws !::= w**
+ws !::= w**
grammar ::= r +/ ws => "grammar"
+
r ::= word ^"::=" alternatives /ws
| word ^"!::=" alternatives /ws
alternatives ::= (conjuncts +/ (ws "|" ws)) +/ (ws ">" ws)
-conjuncts ::= sequence
- | sequence ^"&" e*/ws /ws
- | sequence ^"&~" e*/ws /ws
+conjuncts ::= sequence
+ | sequence ^"&" e*/ws /ws
+ | sequence ^"&~" e*/ws /ws
ps ::= e*/ws => "ps"
| (e+/ws ws)? "^" quoted (ws e+/ws)? => "ps2"
| "(" word ^")" /ws
> ^"(" alternatives ")" /ws
-
w !::= " "
| "//" ([~\n]*) "\n"
| "\n"