IntervalSet expecting = recognizer.getExpectedTokens(); IntervalSet whatFollowsLoopIterationOrRule = expecting.or(getErrorRecoverySet(recognizer)); consumeUntil(recognizer, whatFollowsLoopIterationOrRule); break;
public LL1AltBlock(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 = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet expecting = IntervalSet.or(altLookSets); // combine alt sets this.error = getThrowNoViableAlt(factory, blkAST, expecting); } }
public LL1AltBlock(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 = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet expecting = IntervalSet.or(altLookSets); // combine alt sets this.error = getThrowNoViableAlt(factory, blkAST, expecting); } }
public LL1AltBlock(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 = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet expecting = IntervalSet.or(altLookSets); // combine alt sets this.error = getThrowNoViableAlt(factory, blkAST, expecting); } }
public LL1AltBlock(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 = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet expecting = IntervalSet.or(altLookSets); // combine alt sets this.error = getThrowNoViableAlt(factory, blkAST, expecting); } }
public LL1AltBlock(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 = factory.getGrammar().decisionLOOK.get(decision); altLook = getAltLookaheadAsStringLists(altLookSets); IntervalSet expecting = IntervalSet.or(altLookSets); // combine alt sets this.error = getThrowNoViableAlt(factory, blkAST, expecting); } }
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); } }
/** * Consume all tokens a whole line at a time until the next token is one expected by the current * rule. Each line (as delimited by supplied separator token) starting from the current line up to * the last line consumed is placed in an {@link ErrorNode} and inserted as a child of the current * rule. * * @param recognizer The {@link Parser} to whom to delegate creation of each {@link ErrorNode} */ private void consumeBlocksUntilWanted(Parser recognizer) { IntervalSet expecting = recognizer.getExpectedTokens(); IntervalSet whatFollowsLoopIterationOrRule = expecting.or(getErrorRecoverySet(recognizer)); int nextToken; do { // Eat tokens until we are at the end of the line consumeUntilEndOfLine(recognizer); // Get the line number and separator text from the separator token Token separatorToken = recognizer.getCurrentToken(); // Insert the current line as an {@link ErrorNode} as a child of the current rule createErrorNode(recognizer, recognizer.getContext(), separatorToken); // Eat the separator token recognizer.consume(); nextToken = recognizer.getInputStream().LA(1); } while (!whatFollowsLoopIterationOrRule.contains(nextToken) && nextToken != Lexer.EOF); }
IntervalSet expecting = recognizer.getExpectedTokens(); IntervalSet whatFollowsLoopIterationOrRule = expecting.or(getErrorRecoverySet(recognizer)); consumeUntil(recognizer, whatFollowsLoopIterationOrRule); break;
IntervalSet expecting = recognizer.getExpectedTokens(); IntervalSet whatFollowsLoopIterationOrRule = expecting.or(getErrorRecoverySet(recognizer)); consumeUntil(recognizer, whatFollowsLoopIterationOrRule); break;
IntervalSet expecting = recognizer.getExpectedTokens(); IntervalSet whatFollowsLoopIterationOrRule = expecting.or(getErrorRecoverySet(recognizer)); consumeUntil(recognizer, whatFollowsLoopIterationOrRule); break;
IntervalSet expecting = recognizer.getExpectedTokens(); IntervalSet whatFollowsLoopIterationOrRule = expecting.or(getErrorRecoverySet(recognizer)); consumeUntil(recognizer, whatFollowsLoopIterationOrRule); break;