List of usage examples for org.antlr.v4.runtime FailedPredicateException FailedPredicateException
public FailedPredicateException(Parser recognizer, String predicate)
From source file:BrahmsParser.java
License:Open Source License
private ExpressionContext expression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); ExpressionContext _localctx = new ExpressionContext(_ctx, _parentState); ExpressionContext _prevctx = _localctx; int _startState = 148; enterRecursionRule(_localctx, 148, RULE_expression, _p); int _la;/* w ww .j a v a 2 s. c o m*/ try { int _alt; enterOuterAlt(_localctx, 1); { { setState(868); term(0); } _ctx.stop = _input.LT(-1); setState(875); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 77, _ctx); while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { { _localctx = new ExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_expression); setState(870); if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); setState(871); _la = _input.LA(1); if (!(_la == T__59 || _la == T__60)) { _errHandler.recoverInline(this); } else { consume(); } setState(872); expression(3); } } } setState(877); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 77, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }
From source file:BrahmsParser.java
License:Open Source License
private TermContext term(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); TermContext _localctx = new TermContext(_ctx, _parentState); TermContext _prevctx = _localctx;/*from w w w .ja v a 2 s .c o m*/ int _startState = 150; enterRecursionRule(_localctx, 150, RULE_term, _p); int _la; try { int _alt; enterOuterAlt(_localctx, 1); { { setState(879); factor(0); } _ctx.stop = _input.LT(-1); setState(886); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 78, _ctx); while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { { _localctx = new TermContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_term); setState(881); if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); setState(882); _la = _input.LA(1); if (!(((((_la - 5)) & ~0x3f) == 0 && ((1L << (_la - 5)) & ((1L << (T__4 - 5)) | (1L << (T__61 - 5)) | (1L << (T__62 - 5)) | (1L << (T__63 - 5)))) != 0))) { _errHandler.recoverInline(this); } else { consume(); } setState(883); term(3); } } } setState(888); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 78, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }
From source file:BrahmsParser.java
License:Open Source License
private FactorContext factor(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); FactorContext _localctx = new FactorContext(_ctx, _parentState); FactorContext _prevctx = _localctx;/*from w w w .jav a 2 s .c o m*/ int _startState = 152; enterRecursionRule(_localctx, 152, RULE_factor, _p); try { int _alt; enterOuterAlt(_localctx, 1); { { setState(890); primary(); } _ctx.stop = _input.LT(-1); setState(897); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 79, _ctx); while (_alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { { _localctx = new FactorContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_factor); setState(892); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(893); match(T__64); setState(894); primary(); } } } setState(899); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 79, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }
From source file:amulet.translator.CParser.java
private PostfixExpressionContext postfixExpression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); PostfixExpressionContext _localctx = new PostfixExpressionContext(_ctx, _parentState); PostfixExpressionContext _prevctx = _localctx; int _startState = 4; enterRecursionRule(_localctx, 4, RULE_postfixExpression, _p); try {/*from w w w. j a va2s.co m*/ int _alt; enterOuterAlt(_localctx, 1); { setState(198); switch (getInterpreter().adaptivePredict(_input, 3, _ctx)) { case 1: { setState(181); primaryExpression(); } break; case 2: { setState(182); functionCall(); } break; case 3: { setState(183); match(LeftParen); setState(184); typeName(); setState(185); match(RightParen); setState(186); match(LeftBrace); setState(187); initializerList(0); setState(188); match(RightBrace); } break; case 4: { setState(190); match(LeftParen); setState(191); typeName(); setState(192); match(RightParen); setState(193); match(LeftBrace); setState(194); initializerList(0); setState(195); match(Comma); setState(196); match(RightBrace); } break; } _ctx.stop = _input.LT(-1); setState(217); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 5, _ctx); while (_alt != 2 && _alt != -1) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { setState(215); switch (getInterpreter().adaptivePredict(_input, 4, _ctx)) { case 1: { _localctx = new PostfixExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_postfixExpression); setState(200); if (!(precpred(_ctx, 8))) throw new FailedPredicateException(this, "precpred(_ctx, 8)"); setState(201); match(LeftBracket); setState(202); expression(0); setState(203); match(RightBracket); } break; case 2: { _localctx = new PostfixExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_postfixExpression); setState(205); if (!(precpred(_ctx, 6))) throw new FailedPredicateException(this, "precpred(_ctx, 6)"); setState(206); match(Dot); setState(207); match(Identifier); } break; case 3: { _localctx = new PostfixExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_postfixExpression); setState(208); if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)"); setState(209); match(Arrow); setState(210); match(Identifier); } break; case 4: { _localctx = new PostfixExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_postfixExpression); setState(211); if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)"); setState(212); match(PlusPlus); } break; case 5: { _localctx = new PostfixExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_postfixExpression); setState(213); if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); setState(214); match(MinusMinus); } break; } } } setState(219); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 5, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }
From source file:amulet.translator.CParser.java
private ArgumentExpressionListContext argumentExpressionList(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); ArgumentExpressionListContext _localctx = new ArgumentExpressionListContext(_ctx, _parentState); ArgumentExpressionListContext _prevctx = _localctx; int _startState = 6; enterRecursionRule(_localctx, 6, RULE_argumentExpressionList, _p); try {/* w w w. j av a2s . c om*/ int _alt; enterOuterAlt(_localctx, 1); { { setState(221); assignmentExpression(); } _ctx.stop = _input.LT(-1); setState(228); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 6, _ctx); while (_alt != 2 && _alt != -1) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { { _localctx = new ArgumentExpressionListContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_argumentExpressionList); setState(223); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(224); match(Comma); setState(225); assignmentExpression(); } } } setState(230); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 6, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }
From source file:amulet.translator.CParser.java
private MultiplicativeExpressionContext multiplicativeExpression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); MultiplicativeExpressionContext _localctx = new MultiplicativeExpressionContext(_ctx, _parentState); MultiplicativeExpressionContext _prevctx = _localctx; int _startState = 16; enterRecursionRule(_localctx, 16, RULE_multiplicativeExpression, _p); try {//from w ww. j av a 2 s. c om int _alt; enterOuterAlt(_localctx, 1); { { setState(267); castExpression(); } _ctx.stop = _input.LT(-1); setState(280); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 11, _ctx); while (_alt != 2 && _alt != -1) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { setState(278); switch (getInterpreter().adaptivePredict(_input, 10, _ctx)) { case 1: { _localctx = new MultiplicativeExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_multiplicativeExpression); setState(269); if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); setState(270); match(Star); setState(271); castExpression(); } break; case 2: { _localctx = new MultiplicativeExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_multiplicativeExpression); setState(272); if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); setState(273); match(Div); setState(274); castExpression(); } break; case 3: { _localctx = new MultiplicativeExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_multiplicativeExpression); setState(275); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(276); match(Mod); setState(277); castExpression(); } break; } } } setState(282); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 11, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }
From source file:amulet.translator.CParser.java
private AdditiveExpressionContext additiveExpression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); AdditiveExpressionContext _localctx = new AdditiveExpressionContext(_ctx, _parentState); AdditiveExpressionContext _prevctx = _localctx; int _startState = 18; enterRecursionRule(_localctx, 18, RULE_additiveExpression, _p); try {/* ww w .j a va 2 s . co m*/ int _alt; enterOuterAlt(_localctx, 1); { { setState(284); multiplicativeExpression(0); } _ctx.stop = _input.LT(-1); setState(294); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 13, _ctx); while (_alt != 2 && _alt != -1) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { setState(292); switch (getInterpreter().adaptivePredict(_input, 12, _ctx)) { case 1: { _localctx = new AdditiveExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_additiveExpression); setState(286); if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); setState(287); match(Plus); setState(288); multiplicativeExpression(0); } break; case 2: { _localctx = new AdditiveExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_additiveExpression); setState(289); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(290); match(Minus); setState(291); multiplicativeExpression(0); } break; } } } setState(296); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 13, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }
From source file:amulet.translator.CParser.java
private ShiftExpressionContext shiftExpression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); ShiftExpressionContext _localctx = new ShiftExpressionContext(_ctx, _parentState); ShiftExpressionContext _prevctx = _localctx; int _startState = 20; enterRecursionRule(_localctx, 20, RULE_shiftExpression, _p); try {//from w w w .ja v a 2 s .c om int _alt; enterOuterAlt(_localctx, 1); { { setState(298); additiveExpression(0); } _ctx.stop = _input.LT(-1); setState(308); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 15, _ctx); while (_alt != 2 && _alt != -1) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { setState(306); switch (getInterpreter().adaptivePredict(_input, 14, _ctx)) { case 1: { _localctx = new ShiftExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_shiftExpression); setState(300); if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); setState(301); match(LeftShift); setState(302); additiveExpression(0); } break; case 2: { _localctx = new ShiftExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_shiftExpression); setState(303); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(304); match(RightShift); setState(305); additiveExpression(0); } break; } } } setState(310); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 15, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }
From source file:amulet.translator.CParser.java
private RelationalExpressionContext relationalExpression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); RelationalExpressionContext _localctx = new RelationalExpressionContext(_ctx, _parentState); RelationalExpressionContext _prevctx = _localctx; int _startState = 22; enterRecursionRule(_localctx, 22, RULE_relationalExpression, _p); try {//from w w w .j a va 2 s .c om int _alt; enterOuterAlt(_localctx, 1); { { setState(312); shiftExpression(0); } _ctx.stop = _input.LT(-1); setState(328); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 17, _ctx); while (_alt != 2 && _alt != -1) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { setState(326); switch (getInterpreter().adaptivePredict(_input, 16, _ctx)) { case 1: { _localctx = new RelationalExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_relationalExpression); setState(314); if (!(precpred(_ctx, 4))) throw new FailedPredicateException(this, "precpred(_ctx, 4)"); setState(315); match(Less); setState(316); shiftExpression(0); } break; case 2: { _localctx = new RelationalExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_relationalExpression); setState(317); if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); setState(318); match(Greater); setState(319); shiftExpression(0); } break; case 3: { _localctx = new RelationalExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_relationalExpression); setState(320); if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); setState(321); match(LessEqual); setState(322); shiftExpression(0); } break; case 4: { _localctx = new RelationalExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_relationalExpression); setState(323); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(324); match(GreaterEqual); setState(325); shiftExpression(0); } break; } } } setState(330); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 17, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }
From source file:amulet.translator.CParser.java
private EqualityExpressionContext equalityExpression(int _p) throws RecognitionException { ParserRuleContext _parentctx = _ctx; int _parentState = getState(); EqualityExpressionContext _localctx = new EqualityExpressionContext(_ctx, _parentState); EqualityExpressionContext _prevctx = _localctx; int _startState = 24; enterRecursionRule(_localctx, 24, RULE_equalityExpression, _p); try {/* w w w.j ava 2s .c om*/ int _alt; enterOuterAlt(_localctx, 1); { { setState(332); relationalExpression(0); } _ctx.stop = _input.LT(-1); setState(342); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 19, _ctx); while (_alt != 2 && _alt != -1) { if (_alt == 1) { if (_parseListeners != null) triggerExitRuleEvent(); _prevctx = _localctx; { setState(340); switch (getInterpreter().adaptivePredict(_input, 18, _ctx)) { case 1: { _localctx = new EqualityExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_equalityExpression); setState(334); if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); setState(335); match(Equal); setState(336); relationalExpression(0); } break; case 2: { _localctx = new EqualityExpressionContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_equalityExpression); setState(337); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(338); match(NotEqual); setState(339); relationalExpression(0); } break; } } } setState(344); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input, 19, _ctx); } } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { unrollRecursionContexts(_parentctx); } return _localctx; }