forked from jasder/antlr
Another fix for non-greedy with closures
This commit is contained in:
parent
f9a63b8810
commit
fb87e4c785
|
@ -639,7 +639,9 @@ public class LexerATNSimulator extends ATNSimulator {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ATNState.STAR_LOOP_BACK:
|
case ATNState.STAR_LOOP_BACK:
|
||||||
config = config.exitNonGreedyBlock();
|
if (((StarLoopbackState)p).getLoopEntryState().nonGreedy) {
|
||||||
|
config = config.exitNonGreedyBlock();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ATNState.LOOP_END:
|
case ATNState.LOOP_END:
|
||||||
|
@ -650,9 +652,8 @@ public class LexerATNSimulator extends ATNSimulator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert loopBackState instanceof StarLoopbackState;
|
StarLoopbackState starLoopbackState = (StarLoopbackState)loopBackState;
|
||||||
ATNState loopEntry = loopBackState.transition(0).target;
|
if (starLoopbackState.getLoopEntryState().nonGreedy) {
|
||||||
if (loopEntry instanceof StarLoopEntryState && ((StarLoopEntryState)loopEntry).nonGreedy) {
|
|
||||||
config = config.exitNonGreedyBlock();
|
config = config.exitNonGreedyBlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,4 +30,7 @@
|
||||||
package org.antlr.v4.runtime.atn;
|
package org.antlr.v4.runtime.atn;
|
||||||
|
|
||||||
public class StarLoopbackState extends ATNState {
|
public class StarLoopbackState extends ATNState {
|
||||||
|
public final StarLoopEntryState getLoopEntryState() {
|
||||||
|
return (StarLoopEntryState)transition(0).target;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue