projects
/
sbp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
checkpoint harmony
[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
f642878
..
18bec5a
100644
(file)
--- a/
src/edu/berkeley/sbp/Parser.java
+++ b/
src/edu/berkeley/sbp/Parser.java
@@
-91,7
+91,7
@@
public abstract class Parser<T extends Token, R> {
if (start0.contains(p.owner()) && p.next()==null)
state.accept = true;
if (start0.contains(p.owner()) && p.next()==null)
state.accept = true;
- if (p.isRightNullable(cache)) {
+ if (isRightNullable(p)) {
Walk.Follow wf = new Walk.Follow(top.empty(), p.owner(), all_elements, cache);
Reduction red = new Reduction(p);
Walk.Follow wf = new Walk.Follow(top.empty(), p.owner(), all_elements, cache);
Reduction red = new Reduction(p);
@@
-121,6
+121,12
@@
public abstract class Parser<T extends Token, R> {
}
}
}
}
+ private boolean isRightNullable(Position p) {
+ if (p.isLast()) return true;
+ if (!p.element().possiblyEpsilon(this)) return false;
+ return isRightNullable(p.next());
+ }
+
/** a single state in the LR table and the transitions possible from it */
public class State implements Comparable<Table.State>, IntegerMappable, Iterable<Position> {
/** a single state in the LR table and the transitions possible from it */
public class State implements Comparable<Table.State>, IntegerMappable, Iterable<Position> {