+ /** display form for the Union (ie not including the RHS) */
+ final String shortForm;
+
+ /** this is just a hint to use when printing out the grammar in visual form */
+ final boolean synthetic;
+
+ /** the actual alternatives */
+ private final List<Sequence> alternatives = new ArrayList<Sequence>();
+
+ public Iterator<Sequence> iterator() { return alternatives.iterator(); }
+ public boolean contains(Sequence s) { return alternatives.contains(s); }
+
+ /** adds an alternative */
+ public void add(Sequence s) {
+ alternatives.add(s);
+
+ // FIXME: does this make sense?
+ for(Sequence n : s.needs) add(n);
+ for(Sequence n : s.hates) add(n);
+ }
+
+ // Epsilon Form //////////////////////////////////////////////////////////////////////////////
+
+ // FIXME
+ public static Union epsilon = new Union("()");
+ static { epsilon.add(Sequence.empty); }
+
+ // FIXME