try {
Tree t = new CharParser(MetaGrammar.newInstance()).parse(new FileInputStream("tests/"+fileName)).expand1();
- Tree.TreeFunctor<Object,Object> red = (Tree.TreeFunctor<Object,Object>)t.head();
+ TreeFunctor<Object,Object> red = (TreeFunctor<Object,Object>)t.head();
String oldprefix = prefix;
prefix = as;
GrammarNode gn = (GrammarNode)red.invoke(t);
public static @bind.as Seq psx(Seq s) { return s; }
public static @bind.as(":") ElementNode colon(String s, ElementNode e) { return new Label(s, e); }
public static @bind.as(")") void close(String foo) { throw new Error("not supported"); }
- public static @bind.as("()") ElementNode epsilon() { return new Constant(Union.epsilon); }
+ public static @bind.as("()") ElementNode epsilon() { return new Constant(epsilon); }
+
+ private static Union epsilon = new Union("()");
+ static { epsilon.add(Sequence.empty); }
public static class NonTerminalReferenceNode extends ElementNode {
public String nonTerminal;
}
public Context(Tree t, Grammar.Bindings rm) {
this.rm = rm;
- Tree.TreeFunctor<Object,Object> red = (Tree.TreeFunctor<Object,Object>)t.head();
+ TreeFunctor<Object,Object> red = (TreeFunctor<Object,Object>)t.head();
this.grammar = (GrammarNode)red.invoke(t);
}
public Union peek(String name) { return map.get(name); }