public override void ExitParentheses([NotNull] ParenthesesContext context) { base.ExitParentheses(context); Log("ExitParentheses"); if (phase == Phase.Building) { symbolTableCreator.ExitParentheses(context); } else { symbolTableTraverser.ExitParentheses(context); semanticErrorChecker.ExitParentheses(context); } }
private ExpressionContext expression(int _p) { ParserRuleContext _parentctx = Context; int _parentState = State; ExpressionContext _localctx = new ExpressionContext(Context, _parentState); ExpressionContext _prevctx = _localctx; int _startState = 4; EnterRecursionRule(_localctx, 4, RULE_expression, _p); try { int _alt; EnterOuterAlt(_localctx, 1); { State = 31; ErrorHandler.Sync(this); switch (TokenStream.LA(1)) { case LBRACKET: { _localctx = new ParenthesesContext(_localctx); Context = _localctx; _prevctx = _localctx; State = 24; Match(LBRACKET); State = 25; expression(0); State = 26; Match(RBRACKET); } break; case LITERAL_NEGATION: { _localctx = new LiteralNegationContext(_localctx); Context = _localctx; _prevctx = _localctx; State = 28; Match(LITERAL_NEGATION); } break; case LITERAL: { _localctx = new LiteralContext(_localctx); Context = _localctx; _prevctx = _localctx; State = 29; Match(LITERAL); } break; case INVALID: { _localctx = new InvalidContext(_localctx); Context = _localctx; _prevctx = _localctx; State = 30; Match(INVALID); } break; default: throw new NoViableAltException(this); } Context.Stop = TokenStream.LT(-1); State = 44; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream, 3, Context); while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER) { if (_alt == 1) { if (ParseListeners != null) { TriggerExitRuleEvent(); } _prevctx = _localctx; { State = 42; ErrorHandler.Sync(this); switch (Interpreter.AdaptivePredict(TokenStream, 2, Context)) { case 1: { _localctx = new ConjunctionContext(new ExpressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_expression); State = 33; if (!(Precpred(Context, 6))) { throw new FailedPredicateException(this, "Precpred(Context, 6)"); } State = 34; Match(CONJUNCTION); State = 35; expression(7); } break; case 2: { _localctx = new DisjunctionContext(new ExpressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_expression); State = 36; if (!(Precpred(Context, 5))) { throw new FailedPredicateException(this, "Precpred(Context, 5)"); } State = 37; Match(DISJUNCTION); State = 38; expression(6); } break; case 3: { _localctx = new ImplicationContext(new ExpressionContext(_parentctx, _parentState)); PushNewRecursionContext(_localctx, _startState, RULE_expression); State = 39; if (!(Precpred(Context, 4))) { throw new FailedPredicateException(this, "Precpred(Context, 4)"); } State = 40; Match(IMPLICATION); State = 41; expression(5); } break; } } } State = 46; ErrorHandler.Sync(this); _alt = Interpreter.AdaptivePredict(TokenStream, 3, Context); } } } catch (RecognitionException re) { _localctx.exception = re; ErrorHandler.ReportError(this, re); ErrorHandler.Recover(this, re); } finally { UnrollRecursionContexts(_parentctx); } return(_localctx); }