public static Union epsilon = new Union("()");
static { epsilon.add(Sequence.empty); }
+ ////////////////////////////////////////////////////////////////////////////////
+
+ private Union g;
+ private HashMap<String,Union> nt;
+ private int anon = 0;
+ private Element dws;
+ private String startSymbol;
+
+ public MetaGrammar() { this("s"); }
+ public MetaGrammar(String s) { done(s); }
+ public Union done() { return done("s"); }
+ public Union done(String str) {
+ Union ret = g;
+ g = new Union(str);
+ startSymbol = str;
+ nt = new HashMap<String,Union>();
+ dropAll = new HashSet<Element>();
+ nt.put(str, g);
+ this.dws = Repeat.maximal(Repeat.many0(nonTerminal("w")));
+ return ret;
+ }
// MetaGrammar //////////////////////////////////////////////////////////////////////////////
- public PreSequence _equals__greater_(Object[] o, String s) { return new PreSequence(o, s); }
+ public PreSequence _equals__greater_(Object[] o, String s) { return new PreSequence(o, s); }
public Object _star_(Element r) { return Repeat.many0(r); }
public Element epsilon(Object o, Object b) { return epsilon; }
public Element _rightparen_(Object e) { return SELF; }
return CharToken.set(ret);
}
+ public PreSequence wrap(Object[] o) { return new PreSequence(o, ""); }
+ public PreSequence rewrite(Object[] o) { return new PreSequence(o, null); }
- ////////////////////////////////////////////////////////////////////////////////
-
- private Union g;
- private HashMap<String,Union> nt;
- private int anon = 0;
- private Element dws;
- private String startSymbol;
-
- public MetaGrammar() { this("s"); }
- public MetaGrammar(String s) { done(s); }
- public Union done() { return done("s"); }
- public Union done(String str) {
- Union ret = g;
- g = new Union(str);
- startSymbol = str;
- nt = new HashMap<String,Union>();
- dropAll = new HashSet<Element>();
- nt.put(str, g);
- this.dws = Repeat.maximal(Repeat.many0(nonTerminal("w")));
- return ret;
+ public static class MyLift {
+ public final String s;
+ public MyLift(String s) { this.s = s; }
}
-
- public PreSequence sequence(Object[] o) { return new PreSequence(o, null); }
-
-
- public PreSequence wrap(Object[] o) { return new PreSequence(o, ""); }
- public PreSequence mwrap(Object[] o) { return new PreSequence(o, ""); }
- public PreSequence rewrite(Object[] o) { return new PreSequence(o, null); }
- public PreSequence rewrite(Object[] o, Object o2) {
- Object[] o3 = new Object[o.length + 1];
- System.arraycopy(o, 0, o3, 0, o.length);
- o3[o3.length-1] = o2;
- return rewrite(o3);
+ public static class MyDrop {
+ public final Object o;
+ public MyDrop(Object o) { this.o = o; }
}
public static class PreSequence {
os.close();
}
- public static class MyLift {
- public final String s;
- public MyLift(String s) { this.s = s; }
- }
- public static class MyDrop {
- public final Object o;
- public MyDrop(Object o) { this.o = o; }
- }
-
public static final Tree meta =