X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FParser.java;h=3fad1ddacd8c1e7a257d17193b9fcff3973b24b4;hp=851831345cc1571c3758f5101523f325a6634fe7;hb=72d5880c192b7fbd525c97ded4cf11e935c58cc8;hpb=cbae71f601dd5831cc6bf74a7407cbe067cc604a diff --git a/src/edu/berkeley/sbp/Parser.java b/src/edu/berkeley/sbp/Parser.java index 8518313..3fad1dd 100644 --- a/src/edu/berkeley/sbp/Parser.java +++ b/src/edu/berkeley/sbp/Parser.java @@ -13,9 +13,7 @@ public abstract class Parser { private final Table pt; - /** - * create a parser to parse the grammar with start symbol u - */ + /** create a parser to parse the grammar with start symbol u */ protected Parser(Union u) { this.pt = new Table(u, top()); } protected Parser(Table pt) { this.pt = pt; } @@ -72,9 +70,9 @@ public abstract class Parser { // Table ////////////////////////////////////////////////////////////////////////////// /** an SLR(1) parse table which may contain conflicts */ - static class Table { + static class Table extends Walk.Cache { - public final Walk.Cache cache = new Walk.Cache(); + public final Walk.Cache cache = this; private void walk(Element e, HashSet hs) { if (e==null) return; @@ -88,16 +86,6 @@ public abstract class Parser { } } - /* - public String toString() { - StringBuffer sb = new StringBuffer(); - for(Element e : walk()) - if (e instanceof Union) - ((Union)e).toString(sb); - return sb.toString(); - } - */ - /** the start state */ public final State start;