forked from jasder/antlr
v4: Combine calls to Set.contains and Set.add
[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9492]
This commit is contained in:
parent
2bbb1ca132
commit
befd9ba483
|
@ -94,8 +94,7 @@ public class LL1Analyzer {
|
|||
{
|
||||
// System.out.println("_LOOK("+s.stateNumber+", ctx="+ctx);
|
||||
ATNConfig c = new ATNConfig(s, 0, ctx);
|
||||
if ( lookBusy.contains(c) ) return;
|
||||
lookBusy.add(c);
|
||||
if ( !lookBusy.add(c) ) return;
|
||||
|
||||
if ( s instanceof RuleStopState ) {
|
||||
if ( ctx==null ) {
|
||||
|
|
|
@ -647,8 +647,7 @@ public class ParserATNSimulator<Symbol> extends ATNSimulator {
|
|||
{
|
||||
if ( debug ) System.out.println("closure("+config+")");
|
||||
|
||||
if ( closureBusy.contains(config) ) return; // avoid infinite recursion
|
||||
closureBusy.add(config);
|
||||
if ( !closureBusy.add(config) ) return; // avoid infinite recursion
|
||||
|
||||
if ( config.state instanceof RuleStopState ) {
|
||||
// We hit rule end. If we have context info, use it
|
||||
|
|
Loading…
Reference in New Issue