formatting fixes
[sbp.git] / src / edu / berkeley / sbp / Parser.java
index f2bb701..f239fe5 100644 (file)
@@ -9,7 +9,6 @@ import java.util.*;
 
 /** a parser which translates an Input<Token> into a Forest<NodeType> */
 public abstract class Parser<Token, NodeType> {
-
     protected final Table<Token> pt;
 
     /** create a parser to parse the grammar with start symbol <tt>u</tt> */
@@ -38,16 +37,18 @@ public abstract class Parser<Token, NodeType> {
             loc = input.getLocation();
             Token nextToken = input.next();
             GSS.Phase next = gss.new Phase<Token>(current, current, nextToken, loc, input.getLocation(), forest);
-            if (!helpgc) {
-                FileOutputStream fos = new FileOutputStream("out-"+idx+".dot");
-                PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));
-                GraphViz gv = new GraphViz();
-                for(Object n : next)
-                    ((Node)n).toGraphViz(gv);
-                gv.dump(p);
-                p.flush();
-                p.close();
-            }
+
+            /*
+            FileOutputStream fos = new FileOutputStream("out-"+idx+".dot");
+            PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));
+            GraphViz gv = new GraphViz();
+            for(Object n : current)
+                ((Node)n).toGraphViz(gv);
+            gv.dump(p);
+            p.flush();
+            p.close();
+            */
+
             count = next.size();
             if (current.isDone()) return (Forest<NodeType>)gss.finalResult;
             current = next;
@@ -75,6 +76,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();
         }