move.addAll(y, hp);
}
}
- for(Element y : move) {
+ OUTER: for(Element y : move) {
HashSet<Position> h = move.getAll(y);
State<Tok> s = all_states.get(h) == null ? new State<Tok>(h, all_states, all_elements) : all_states.get(h);
// if a reduction is "lame", it should wind up in the dead_state after reducing
- if (y instanceof Sequence && ((Sequence)y).lame)
- ((HashMap)gotoSetNonTerminals).put(y, dead_state);
- else
- gotoSetNonTerminals.put(y, s);
+ if (y instanceof Sequence) {
+ for(Position p : hs) {
+ if (p.element() != null && (p.element() instanceof Union)) {
+ Union u = (Union)p.element();
+ for(Sequence seq : u)
+ if (seq.needs.contains((Sequence)y) || seq.hates.contains((Sequence)y)) {
+ // FIXME: what if there are two "routes" to get to the sequence?
+ ((HashMap)gotoSetNonTerminals).put(y, dead_state);
+ continue OUTER;
+ }
+ }
+ }
+ }
+ gotoSetNonTerminals.put(y, s);
}
}