public LL1OptionalBlockSingleAlt(OutputModelFactory factory, GrammarAST blkAST, List<CodeBlockForAlt> alts) { super(factory, blkAST, alts); this.decision = ((DecisionState)blkAST.atnState).decision; /** Lookahead for each alt 1..n */ // IntervalSet[] altLookSets = LinearApproximator.getLL1LookaheadSets(dfa); IntervalSet[] altLookSets = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet look = altLookSets[0]; IntervalSet followLook = altLookSets[1]; IntervalSet expecting = look.or(followLook); this.error = getThrowNoViableAlt(factory, blkAST, expecting); expr = addCodeForLookaheadTempVar(look); followExpr = factory.getLL1Test(followLook, blkAST); } }
public LL1OptionalBlockSingleAlt(OutputModelFactory factory, GrammarAST blkAST, List<CodeBlockForAlt> alts) { super(factory, blkAST, alts); this.decision = ((DecisionState)blkAST.atnState).decision; /** Lookahead for each alt 1..n */ // IntervalSet[] altLookSets = LinearApproximator.getLL1LookaheadSets(dfa); IntervalSet[] altLookSets = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet look = altLookSets[0]; IntervalSet followLook = altLookSets[1]; IntervalSet expecting = look.or(followLook); this.error = getThrowNoViableAlt(factory, blkAST, expecting); expr = addCodeForLookaheadTempVar(look); followExpr = factory.getLL1Test(followLook, blkAST); } }
public LL1OptionalBlockSingleAlt(OutputModelFactory factory, GrammarAST blkAST, List<CodeBlockForAlt> alts) { super(factory, blkAST, alts); this.decision = ((DecisionState)blkAST.atnState).decision; /** Lookahead for each alt 1..n */ // IntervalSet[] altLookSets = LinearApproximator.getLL1LookaheadSets(dfa); IntervalSet[] altLookSets = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet look = altLookSets[0]; IntervalSet followLook = altLookSets[1]; IntervalSet expecting = look.or(followLook); this.error = getThrowNoViableAlt(factory, blkAST, expecting); expr = addCodeForLookaheadTempVar(look); followExpr = factory.getLL1Test(followLook, blkAST); } }
public LL1OptionalBlockSingleAlt(OutputModelFactory factory, GrammarAST blkAST, List<CodeBlockForAlt> alts) { super(factory, blkAST, alts); this.decision = ((DecisionState)blkAST.atnState).decision; /** Lookahead for each alt 1..n */ // IntervalSet[] altLookSets = LinearApproximator.getLL1LookaheadSets(dfa); IntervalSet[] altLookSets = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet look = altLookSets[0]; IntervalSet followLook = altLookSets[1]; IntervalSet expecting = look.or(followLook); this.error = getThrowNoViableAlt(factory, blkAST, expecting); expr = addCodeForLookaheadTempVar(look); followExpr = factory.getLL1Test(followLook, blkAST); } }
public LL1OptionalBlockSingleAlt(OutputModelFactory factory, GrammarAST blkAST, List<CodeBlockForAlt> alts) { super(factory, blkAST, alts); this.decision = ((DecisionState)blkAST.atnState).decision; /** Lookahead for each alt 1..n */ // IntervalSet[] altLookSets = LinearApproximator.getLL1LookaheadSets(dfa); IntervalSet[] altLookSets = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet look = altLookSets[0]; IntervalSet followLook = altLookSets[1]; IntervalSet expecting = look.or(followLook); this.error = getThrowNoViableAlt(factory, blkAST, expecting); expr = addCodeForLookaheadTempVar(look); followExpr = factory.getLL1Test(followLook, blkAST); } }
public TestSetInline addCodeForLookaheadTempVar(IntervalSet look) { List<SrcOp> testOps = factory.getLL1Test(look, ast); TestSetInline expr = Utils.find(testOps, TestSetInline.class); if (expr != null) { Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); CaptureNextTokenType nextType = new CaptureNextTokenType(factory,expr.varName); addPreambleOp(nextType); } return expr; }
public TestSetInline addCodeForLookaheadTempVar(IntervalSet look) { List<SrcOp> testOps = factory.getLL1Test(look, ast); TestSetInline expr = Utils.find(testOps, TestSetInline.class); if (expr != null) { Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); CaptureNextTokenType nextType = new CaptureNextTokenType(factory,expr.varName); addPreambleOp(nextType); } return expr; }
public TestSetInline addCodeForLookaheadTempVar(IntervalSet look) { List<SrcOp> testOps = factory.getLL1Test(look, ast); TestSetInline expr = Utils.find(testOps, TestSetInline.class); if (expr != null) { Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); CaptureNextTokenType nextType = new CaptureNextTokenType(factory,expr.varName); addPreambleOp(nextType); } return expr; }
public TestSetInline addCodeForLookaheadTempVar(IntervalSet look) { List<SrcOp> testOps = factory.getLL1Test(look, ast); TestSetInline expr = Utils.find(testOps, TestSetInline.class); if (expr != null) { Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); CaptureNextTokenType nextType = new CaptureNextTokenType(factory,expr.varName); addPreambleOp(nextType); } return expr; }
public TestSetInline addCodeForLookaheadTempVar(IntervalSet look) { List<SrcOp> testOps = factory.getLL1Test(look, ast); TestSetInline expr = Utils.find(testOps, TestSetInline.class); if (expr != null) { Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); CaptureNextTokenType nextType = new CaptureNextTokenType(factory,expr.varName); addPreambleOp(nextType); } return expr; }