public static class NonTerminal extends Un {
public boolean rep;
public String name = null;
+ public String sep = null;
public @bind NonTerminal(@bind.arg String name, @bind.arg Seq[][] sequences) { this(name, sequences, false); }
- public NonTerminal(String name, Seq[][] sequences, boolean rep) {
+ public NonTerminal(String name, Seq[][] sequences, boolean rep) { this(name, sequences, rep, null); }
+ public NonTerminal(String name, Seq[][] sequences, boolean rep, String sep) {
this.name = name;
this.sequences = sequences;
this.rep = rep;
+ this.sep = sep;
}
public Element build(MetaGrammar.Context cx) { return cx.get(name); }
}
public static @bind.as("=") NonTerminal go(@bind.arg String name, @bind.arg Seq[][] sequences) { return new NonTerminal(name, sequences, true); }
+ public static @bind.as("=") NonTerminal go(@bind.arg String name, @bind.arg String sep, @bind.arg Seq[][] sequences) {
+ return new NonTerminal(name, sequences, true, sep);
+ }
public static class AnonUn extends Un {
public @bind.as("(") AnonUn(Seq[][] sequences) {
public static @bind.as("{") class XTree extends El {
public @bind.arg Seq body;
public Element build(MetaGrammar.Context cx) {
- throw new Error();
+ Union u = new Union();
+ Sequence s = body.build(cx, u, false);
+ Union u2 = new Union();
+ u2.add(Sequence.singleton(new Element[] {
+ CharRange.leftBrace,
+ cx.get("ws"),
+ u,
+ cx.get("ws"),
+ CharRange.rightBrace
+ }, 2));
+ return u2;
}
}