forked from jasder/antlr
Remove unnecessary casts
This commit is contained in:
parent
8e9619a731
commit
1bc15c5926
|
@ -77,14 +77,13 @@ public abstract class Choice extends RuleElement {
|
||||||
return altLook;
|
return altLook;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SrcOp addCodeForLookaheadTempVar(IntervalSet look) {
|
public TestSetInline addCodeForLookaheadTempVar(IntervalSet look) {
|
||||||
List<SrcOp> testOps = factory.getLL1Test(look, ast);
|
List<SrcOp> testOps = factory.getLL1Test(look, ast);
|
||||||
SrcOp expr = (SrcOp) Utils.find(testOps, TestSetInline.class);
|
TestSetInline expr = Utils.find(testOps, TestSetInline.class);
|
||||||
if ( expr instanceof TestSetInline) {
|
if (expr != null) {
|
||||||
TestSetInline e = (TestSetInline)expr;
|
Decl d = new TokenTypeDecl(factory, expr.varName);
|
||||||
Decl d = new TokenTypeDecl(factory, e.varName);
|
|
||||||
factory.getCurrentRuleFunction().addLocalDecl(d);
|
factory.getCurrentRuleFunction().addLocalDecl(d);
|
||||||
CaptureNextTokenType nextType = new CaptureNextTokenType(factory,e.varName);
|
CaptureNextTokenType nextType = new CaptureNextTokenType(factory,expr.varName);
|
||||||
addPreambleOp(nextType);
|
addPreambleOp(nextType);
|
||||||
}
|
}
|
||||||
return expr;
|
return expr;
|
||||||
|
|
|
@ -59,10 +59,9 @@ public abstract class LL1Loop extends Choice {
|
||||||
}
|
}
|
||||||
|
|
||||||
public SrcOp addCodeForLoopLookaheadTempVar(IntervalSet look) {
|
public SrcOp addCodeForLoopLookaheadTempVar(IntervalSet look) {
|
||||||
SrcOp expr = addCodeForLookaheadTempVar(look);
|
TestSetInline expr = addCodeForLookaheadTempVar(look);
|
||||||
if ( expr instanceof TestSetInline ) {
|
if (expr != null) {
|
||||||
TestSetInline e = (TestSetInline)expr;
|
CaptureNextTokenType nextType = new CaptureNextTokenType(factory, expr.varName);
|
||||||
CaptureNextTokenType nextType = new CaptureNextTokenType(factory, e.varName);
|
|
||||||
addIterationOp(nextType);
|
addIterationOp(nextType);
|
||||||
}
|
}
|
||||||
return expr;
|
return expr;
|
||||||
|
|
Loading…
Reference in New Issue