projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Table extends Cache
[sbp.git]
/
src
/
edu
/
berkeley
/
sbp
/
Parser.java
diff --git
a/src/edu/berkeley/sbp/Parser.java
b/src/edu/berkeley/sbp/Parser.java
index
8518313
..
3fad1dd
100644
(file)
--- a/
src/edu/berkeley/sbp/Parser.java
+++ b/
src/edu/berkeley/sbp/Parser.java
@@
-13,9
+13,7
@@
public abstract class Parser<T extends Token, R> {
private final Table pt;
private final Table pt;
- /**
- * create a parser to parse the grammar with start symbol <tt>u</tt>
- */
+ /** create a parser to parse the grammar with start symbol <tt>u</tt> */
protected Parser(Union u) { this.pt = new Table(u, top()); }
protected Parser(Table pt) { this.pt = pt; }
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<T extends Token, R> {
// Table //////////////////////////////////////////////////////////////////////////////
/** an SLR(1) parse table which may contain conflicts */
// 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<Element> hs) {
if (e==null) return;
private void walk(Element e, HashSet<Element> hs) {
if (e==null) return;
@@
-88,16
+86,6
@@
public abstract class Parser<T extends Token, R> {
}
}
}
}
- /*
- 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;
/** the start state */
public final State start;