projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
major overhaul to institute optimal GSS sharing
[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
5f6e252
..
2fc0691
100644
(file)
--- a/
src/edu/berkeley/sbp/Parser.java
+++ b/
src/edu/berkeley/sbp/Parser.java
@@
-8,7
+8,7
@@
import java.io.*;
import java.util.*;
/** a parser which translates an Input<Token> into a Forest<NodeType> */
import java.util.*;
/** a parser which translates an Input<Token> into a Forest<NodeType> */
-public abstract class Parser<Token, NodeType> {
+public abstract class Parser<Token, NodeType> implements Serializable {
final Table pt;
final Table pt;
@@
-106,7
+106,7
@@
public abstract class Parser<Token, NodeType> {
// Table //////////////////////////////////////////////////////////////////////////////
/** an SLR(1) parse table which may contain conflicts */
// Table //////////////////////////////////////////////////////////////////////////////
/** an SLR(1) parse table which may contain conflicts */
- class Table extends Grammar<Token> implements Serializable {
+ class Table implements Serializable {
/** the start state */
final State<Token> start;
/** the start state */
final State<Token> start;
@@
-273,8
+273,8
@@
public abstract class Parser<Token, NodeType> {
HashMap<Pos,State<Token>> gotoSetNonTerminals = new HashMap<Pos,State<Token>>();
private transient TopologicalBag<Token,State<Token>> gotoSetTerminals = new TopologicalBag<Token,State<Token>>();
HashMap<Pos,State<Token>> gotoSetNonTerminals = new HashMap<Pos,State<Token>>();
private transient TopologicalBag<Token,State<Token>> gotoSetTerminals = new TopologicalBag<Token,State<Token>>();
- private TopologicalBag<Token,Pos> reductions = new TopologicalBag<Token,Pos>();
- private HashSet<Pos> eofReductions = new HashSet<Pos>();
+ TopologicalBag<Token,Pos> reductions = new TopologicalBag<Token,Pos>();
+ HashSet<Pos> eofReductions = new HashSet<Pos>();
private TopologicalBag<Token,State<Token>> shifts = new TopologicalBag<Token,State<Token>>();
private boolean accept = false;
private TopologicalBag<Token,State<Token>> shifts = new TopologicalBag<Token,State<Token>>();
private boolean accept = false;
@@
-290,16
+290,16
@@
public abstract class Parser<Token, NodeType> {
Iterable<Pos> positions() { return hs; }
boolean canShift(Token t) { return oshifts!=null && oshifts.contains(t); }
Iterable<Pos> positions() { return hs; }
boolean canShift(Token t) { return oshifts!=null && oshifts.contains(t); }
- void invokeShifts(Token t, GSS.Phase phase, Result r) { oshifts.invoke(t, phase, r); }
+ void invokeShifts(Token t, GSS.Phase phase, Node pred, Forest f) { oshifts.invoke(t, phase, pred, f); }
boolean canReduce(Token t) {
return oreductions != null && (t==null ? eofReductions.size()>0 : oreductions.contains(t)); }
void invokeEpsilonReductions(Token t, Node node) {
boolean canReduce(Token t) {
return oreductions != null && (t==null ? eofReductions.size()>0 : oreductions.contains(t)); }
void invokeEpsilonReductions(Token t, Node node) {
- if (t==null) for(Pos r : eofReductions) node.invoke(r, null);
- else oreductions.invoke(t, node, null);
+ if (t==null) for(Pos r : eofReductions) node.invoke(r, null, null);
+ else oreductions.invoke(t, node, null, null);
}
void invokeReductions(Token t, Node node, Result b) {
}
void invokeReductions(Token t, Node node, Result b) {
- if (t==null) for(Pos r : eofReductions) node.invoke(r, b);
- else oreductions.invoke(t, node, b);
+ if (t==null) for(Pos r : eofReductions) node.invoke(r, b, null);
+ else oreductions.invoke(t, node, b, null);
}
// Constructor //////////////////////////////////////////////////////////////////////////////
}
// Constructor //////////////////////////////////////////////////////////////////////////////