include post-reduction gotos in Parser.Table.toString()
[sbp.git] / src / edu / berkeley / sbp / Parser.java
index 10768f6..130ece9 100644 (file)
@@ -75,6 +75,8 @@ public abstract class Parser<Token, NodeType> {
                     sb.append("      reduce \""+
                               new edu.berkeley.sbp.chr.CharTopology((IntegerTopology<Character>)t)+"\" => " +
                               state.reductions.getAll(t) + "\n");
+                for(Sequence s : state.gotoSetNonTerminals.keySet())
+                    sb.append("      goto   "+state.gotoSetNonTerminals.get(s)+" from " + s + "\n");
             }
             return sb.toString();
         }
@@ -122,6 +124,8 @@ public abstract class Parser<Token, NodeType> {
             walk(start0, all_elements);
             for(SequenceOrElement e : all_elements)
                 cache.ys.addAll(e, new Walk.YieldSet(e, cache).walk());
+            for(SequenceOrElement e : all_elements)
+                cache.ys2.addAll(e, new Walk.YieldSet2(e, cache).walk());
             HashSet<Position> hp = new HashSet<Position>();
             reachable(start0, hp);
 
@@ -289,7 +293,8 @@ public abstract class Parser<Token, NodeType> {
                 for(Position p : hs) {
                     Element e = p.element();
                     if (e==null) continue;
-                    for(SequenceOrElement y : cache.ys.getAll(e)) {
+                    for(SequenceOrElement y : cache.ys2.getAll(e)) {
+                        //System.out.println(e + " yields " + y);
                         HashSet<Position> hp = new HashSet<Position>();
                         reachable(p.next(), hp);
                         move.addAll(y, hp);