a few tweaks/comments.
This commit is contained in:
parent
d996b5c8c7
commit
ab6b341942
|
@ -75,6 +75,14 @@ public class ATNConfig {
|
|||
return true;
|
||||
}
|
||||
|
||||
/** Lexer non-greedy implementations need to track information per
|
||||
* ATNConfig. When the lexer reaches an accept state for a lexer
|
||||
* rule, it needs to wipe out any configurations associated with
|
||||
* that rule that are part of a non-greedy subrule. To do that it
|
||||
* has to make sure that it tracks when a configuration was derived
|
||||
* from an element within a non-greedy subrule. We use depth for
|
||||
* that. We're greedy when the depth is 0.
|
||||
*/
|
||||
public int getNonGreedyDepth() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -444,7 +444,7 @@ public class LexerATNSimulator extends ATNSimulator {
|
|||
}
|
||||
}
|
||||
|
||||
if (!((LexerATNConfig)config).isGreedy()) {
|
||||
if ( !config.isGreedy() ) {
|
||||
assert !(config.state instanceof RuleStopState);
|
||||
nonGreedyAlts.set(config.alt);
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ public class LexerATNSimulator extends ATNSimulator {
|
|||
}
|
||||
}
|
||||
|
||||
if ( config.context == null || config.context.hasEmpty() ) {
|
||||
if ( config.context == null || config.context.hasEmptyPath() ) {
|
||||
if (config.context == null || config.context.isEmpty()) {
|
||||
configs.add(config);
|
||||
return;
|
||||
|
|
|
@ -70,7 +70,7 @@ public abstract class PredictionContext implements Iterable<SingletonPredictionC
|
|||
return this == EMPTY;
|
||||
}
|
||||
|
||||
public boolean hasEmpty() {
|
||||
public boolean hasEmptyPath() {
|
||||
return getInvokingState(size() - 1) == EMPTY_INVOKING_STATE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue