def visitState(self, p:ATNState): edge = 0 if len(p.transitions) > 1: self._errHandler.sync(self) edge = self._interp.adaptivePredict(self._input, p.decision, self._ctx) else: edge = 1 transition = p.transitions[edge - 1] tt = transition.serializationType if tt==Transition.EPSILON: if self.pushRecursionContextStates[p.stateNumber] and not isinstance(transition.target, LoopEndState): t = self._parentContextStack[-1] ctx = InterpreterRuleContext(t[0], t[1], self._ctx.ruleIndex) self.pushNewRecursionContext(ctx, self.atn.ruleToStartState[p.ruleIndex].stateNumber, self._ctx.ruleIndex) elif tt==Transition.ATOM: self.match(transition.label) elif tt in [ Transition.RANGE, Transition.SET, Transition.NOT_SET]: if not transition.matches(self._input.LA(1), Token.MIN_USER_TOKEN_TYPE, Lexer.MAX_CHAR_VALUE): self._errHandler.recoverInline(self) self.matchWildcard() elif tt==Transition.WILDCARD: self.matchWildcard() elif tt==Transition.RULE: ruleStartState = transition.target ruleIndex = ruleStartState.ruleIndex ctx = InterpreterRuleContext(self._ctx, p.stateNumber, ruleIndex) if ruleStartState.isPrecedenceRule: self.enterRecursionRule(ctx, ruleStartState.stateNumber, ruleIndex, transition.precedence) else: self.enterRule(ctx, transition.target.stateNumber, ruleIndex) elif tt==Transition.PREDICATE: if not self.sempred(self._ctx, transition.ruleIndex, transition.predIndex): raise FailedPredicateException(self) elif tt==Transition.ACTION: self.action(self._ctx, transition.ruleIndex, transition.actionIndex) elif tt==Transition.PRECEDENCE: if not self.precpred(self._ctx, transition.precedence): msg = "precpred(_ctx, " + str(transition.precedence) + ")" raise FailedPredicateException(self, msg) else: raise UnsupportedOperationException("Unrecognized ATN transition type.") self.state = transition.target.stateNumber
def expr1(self, _p:int=0): _parentctx = self._ctx _parentState = self.state localctx = BKITParser.Expr1Context(self, self._ctx, _parentState) _prevctx = localctx _startState = 18 self.enterRecursionRule(localctx, 18, self.RULE_expr1, _p) try: self.enterOuterAlt(localctx, 1) self.state = 103 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,8,self._ctx) if la_ == 1: self.state = 98 self.expr2(0) self.state = 99 self.match(BKITParser.MINUS_INT) self.state = 100 self.expr1(3) pass elif la_ == 2: self.state = 102 self.expr2(0) pass self._ctx.stop = self._input.LT(-1) self.state = 110 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,9,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = BKITParser.Expr1Context(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr1) self.state = 105 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") self.state = 106 self.match(BKITParser.STAR_INT) self.state = 107 self.expr2(0) self.state = 112 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,9,self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def predicate(self, _p:int=0): _parentctx = self._ctx _parentState = self.state localctx = NNDLParser.PredicateContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 22 self.enterRecursionRule(localctx, 22, self.RULE_predicate, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) self.state = 106 self.math_expr(0) self.state = 107 _la = self._input.LA(1) if not((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << NNDLParser.T__10) | (1 << NNDLParser.T__11) | (1 << NNDLParser.T__12) | (1 << NNDLParser.T__13) | (1 << NNDLParser.T__14))) != 0)): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 108 self.math_expr(0) self._ctx.stop = self._input.LT(-1) self.state = 115 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,5,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = NNDLParser.PredicateContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_predicate) self.state = 110 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") self.state = 111 _la = self._input.LA(1) if not(_la==NNDLParser.T__15 or _la==NNDLParser.T__16): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 112 self.predicate(2) self.state = 117 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,5,self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def c_expr(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = ERParser.C_exprContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 2 self.enterRecursionRule(localctx, 2, self.RULE_c_expr, _p) try: self.enterOuterAlt(localctx, 1) self.state = 22 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 1, self._ctx) if la_ == 1: self.state = 20 self.k_expr() pass elif la_ == 2: self.state = 21 self.atom() pass self._ctx.stop = self._input.LT(-1) self.state = 28 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = ERParser.C_exprContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_c_expr) self.state = 24 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 3)") self.state = 25 self.c_expr(4) self.state = 30 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def tags(self, _p:int=0): _parentctx = self._ctx _parentState = self.state localctx = influxdbParser.TagsContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 6 self.enterRecursionRule(localctx, 6, self.RULE_tags, _p) try: self.enterOuterAlt(localctx, 1) self.state = 42 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,3,self._ctx) if la_ == 1: self.state = 39 self.match(influxdbParser.T__0) self.state = 40 self.ttype() pass elif la_ == 2: pass self._ctx.stop = self._input.LT(-1) self.state = 49 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,4,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = influxdbParser.TagsContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_tags) self.state = 44 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 3)") self.state = 45 self.match(influxdbParser.T__0) self.state = 46 self.ttype() self.state = 51 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,4,self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def multiplyingExpression(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = exprParser.MultiplyingExpressionContext( self, self._ctx, _parentState) _prevctx = localctx _startState = 8 self.enterRecursionRule(localctx, 8, self.RULE_multiplyingExpression, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) self.state = 61 self.powExpression() self._ctx.stop = self._input.LT(-1) self.state = 68 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 3, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = exprParser.MultiplyingExpressionContext( self, _parentctx, _parentState) self.pushNewRecursionContext( localctx, _startState, self.RULE_multiplyingExpression) self.state = 63 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 64 _la = self._input.LA(1) if not (_la == exprParser.TIMES or _la == exprParser.DIV): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 65 self.powExpression() self.state = 70 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 3, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def expr2(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = BKOOLParser.Expr2Context(self, self._ctx, _parentState) _prevctx = localctx _startState = 22 self.enterRecursionRule(localctx, 22, self.RULE_expr2, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) self.state = 105 self.sub_expr() self._ctx.stop = self._input.LT(-1) self.state = 112 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 9, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = BKOOLParser.Expr2Context( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr2) self.state = 107 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 108 _la = self._input.LA(1) if not (_la == BKOOLParser.MULOP or _la == BKOOLParser.DIVOP): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 109 self.sub_expr() self.state = 114 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 9, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def mana_cost(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = manacost_grammarParser.Mana_costContext( self, self._ctx, _parentState) _prevctx = localctx _startState = 2 self.enterRecursionRule(localctx, 2, self.RULE_mana_cost, _p) try: self.enterOuterAlt(localctx, 1) localctx = manacost_grammarParser.AtomContext(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 17 self.mana_cost_atom() self._ctx.stop = self._input.LT(-1) self.state = 23 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 1, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = manacost_grammarParser.AtomManaCostContext( self, manacost_grammarParser.Mana_costContext( self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_mana_cost) self.state = 19 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 1)") self.state = 20 self.mana_cost_atom() self.state = 25 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 1, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def term(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = IsmoParser.TermContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 6 self.enterRecursionRule(localctx, 6, self.RULE_term, _p) try: self.enterOuterAlt(localctx, 1) localctx = IsmoParser.Fact_Context(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 36 self.fact() self._ctx.stop = self._input.LT(-1) self.state = 43 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 3, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = IsmoParser.MulContext( self, IsmoParser.TermContext(self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_term) self.state = 38 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 39 self.match(IsmoParser.T__4) self.state = 40 self.fact() self.state = 45 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 3, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def prog(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = AssignmentStatement4Parser.ProgContext( self, self._ctx, _parentState) _prevctx = localctx _startState = 2 self.enterRecursionRule(localctx, 2, self.RULE_prog, _p) try: self.enterOuterAlt(localctx, 1) self.state = 19 localctx.a = self.assign() localctx.value_attr = localctx.a.value_attr localctx.type_attr = localctx.a.type_attr print('----------') self._ctx.stop = self._input.LT(-1) self.state = 26 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 0, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = AssignmentStatement4Parser.ProgContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_prog) self.state = 22 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 23 localctx.a = self.assign() self.state = 28 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 0, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def expr(self, _p:int=0): _parentctx = self._ctx _parentState = self.state localctx = AsmGrammarParser.ExprContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 4 self.enterRecursionRule(localctx, 4, self.RULE_expr, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) self.state = 32 self.term() self._ctx.stop = self._input.LT(-1) self.state = 39 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,2,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = AsmGrammarParser.ExprContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) self.state = 34 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 1)") self.state = 35 _la = self._input.LA(1) if not(_la==AsmGrammarParser.PLUS or _la==AsmGrammarParser.MINUS): self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 36 self.term() self.state = 41 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,2,self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def bitwise_xor(self, _p:int=0): _parentctx = self._ctx _parentState = self.state localctx = smaParser.Bitwise_xorContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 20 self.enterRecursionRule(localctx, 20, self.RULE_bitwise_xor, _p) try: self.enterOuterAlt(localctx, 1) self.state = 139 self.match(smaParser.HEX_NUMBER) self.state = 140 self.match(smaParser.T__6) self.state = 141 self.match(smaParser.HEX_NUMBER) self._ctx.stop = self._input.LT(-1) self.state = 148 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,10,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = smaParser.Bitwise_xorContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_bitwise_xor) self.state = 143 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") self.state = 144 self.match(smaParser.T__6) self.state = 145 self.match(smaParser.HEX_NUMBER) self.state = 150 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,10,self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def function_type(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = LambdaCalculusParser.Function_typeContext( self, self._ctx, _parentState) _prevctx = localctx _startState = 18 self.enterRecursionRule(localctx, 18, self.RULE_function_type, _p) try: self.enterOuterAlt(localctx, 1) self.state = 118 self.ground_type() self._ctx.stop = self._input.LT(-1) self.state = 125 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 10, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = LambdaCalculusParser.Function_typeContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_function_type) self.state = 120 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 1)") self.state = 121 self.match(LambdaCalculusParser.T__3) self.state = 122 self.function_type(2) self.state = 127 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 10, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def expr(self, _p=0): _parentctx = self._ctx _parentState = self.state localctx = gnParser.ExprContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 20 self.enterRecursionRule(localctx, 20, self.RULE_expr, _p) try: self.enterOuterAlt(localctx, 1) self.state = 91 self.unaryexpr() self._ctx.stop = self._input.LT(-1) self.state = 98 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 8, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = gnParser.ExprContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) self.state = 93 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 1)") self.state = 94 self.match(gnParser.BinaryOp) self.state = 95 self.expr(2) self.state = 100 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 8, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def r1(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = RegExpGrammarParser.R1Context(self, self._ctx, _parentState) _prevctx = localctx _startState = 0 self.enterRecursionRule(localctx, 0, self.RULE_r1, _p) try: self.enterOuterAlt(localctx, 1) self.state = 9 self.r2(0) self._ctx.stop = self._input.LT(-1) self.state = 16 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 0, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = RegExpGrammarParser.R1Context( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_r1) self.state = 11 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 12 self.match(RegExpGrammarParser.T__0) self.state = 13 self.r2(0) self.state = 18 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 0, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def expr2(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = BKITParser.Expr2Context(self, self._ctx, _parentState) _prevctx = localctx _startState = 26 self.enterRecursionRule(localctx, 26, self.RULE_expr2, _p) try: self.enterOuterAlt(localctx, 1) self.state = 128 self.operand() self._ctx.stop = self._input.LT(-1) self.state = 135 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 12, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = BKITParser.Expr2Context(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr2) self.state = 130 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 131 self.match(BKITParser.DIV_INT) self.state = 132 self.expr2(3) self.state = 137 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 12, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def operations(self, _p=0): _parentctx = self._ctx _parentState = self.state localctx = simpleLangParser.OperationsContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 24 self.enterRecursionRule(localctx, 24, self.RULE_operations, _p) try: self.enterOuterAlt(localctx, 1) self.state = 101 self.operation() self._ctx.stop = self._input.LT(-1) self.state = 107 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 6, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = simpleLangParser.OperationsContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_operations) self.state = 103 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 1)") self.state = 104 self.operation() self.state = 109 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 6, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def members(self, level): localctx = JSONParser.MembersContext(self, self._ctx, self.state, level) self.enterRule(localctx, 6, self.RULE_members) try: self.state = 45 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 0, self._ctx) if la_ == 1: self.enterOuterAlt(localctx, 1) put(level * ' ') self.state = 33 localctx._pair = self.pair(localctx.level) localctx.keys = {localctx._pair.key: True} pass elif la_ == 2: self.enterOuterAlt(localctx, 2) put(level * ' ') self.state = 37 localctx._pair = self.pair(localctx.level) put('\n') self.state = 39 self.match(JSONParser.T__2) self.state = 40 localctx._members = self.members(localctx.level) self.state = 41 if not localctx._pair.key not in localctx._members.keys: from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "$pair.key not in $members.keys") localctx.keys = localctx._members.keys localctx.keys[localctx._pair.key] = True pass except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.exitRule() return localctx
def concat_regex(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = RegexParser.Concat_regexContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 2 self.enterRecursionRule(localctx, 2, self.RULE_concat_regex, _p) try: self.enterOuterAlt(localctx, 1) self.state = 24 self.star_regex() self._ctx.stop = self._input.LT(-1) self.state = 30 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 1, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = RegexParser.Concat_regexContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_concat_regex) self.state = 26 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 1)") self.state = 27 self.star_regex() self.state = 32 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 1, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def a_expr(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = GrammerParser.A_exprContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 4 self.enterRecursionRule(localctx, 4, self.RULE_a_expr, _p) try: self.enterOuterAlt(localctx, 1) self.state = 28 self.b_expr() self._ctx.stop = self._input.LT(-1) self.state = 34 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = GrammerParser.A_exprContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_a_expr) self.state = 30 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 31 self.match(GrammerParser.STAR) self.state = 36 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def expression(self, _p:int=0): _parentctx = self._ctx _parentState = self.state localctx = ArduinomlParser.ExpressionContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 34 self.enterRecursionRule(localctx, 34, self.RULE_expression, _p) try: self.enterOuterAlt(localctx, 1) self.state = 151 self.comparison() self._ctx.stop = self._input.LT(-1) self.state = 158 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,12,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = ArduinomlParser.ExpressionContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) self.state = 153 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") self.state = 154 localctx.operator = self.match(ArduinomlParser.OPERATOR) self.state = 155 self.expression(3) self.state = 160 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,12,self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def division(self, _p:int=0): _parentctx = self._ctx _parentState = self.state localctx = smaParser.DivisionContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 6 self.enterRecursionRule(localctx, 6, self.RULE_division, _p) try: self.enterOuterAlt(localctx, 1) self.state = 58 self.match(smaParser.DIGIT) self._ctx.stop = self._input.LT(-1) self.state = 65 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,3,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = smaParser.DivisionContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_division) self.state = 60 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") self.state = 61 self.match(smaParser.T__3) self.state = 62 self.match(smaParser.DIGIT) self.state = 67 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,3,self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def values(self, _p:int=0): _parentctx = self._ctx _parentState = self.state localctx = influxdbParser.ValuesContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 10 self.enterRecursionRule(localctx, 10, self.RULE_values, _p) try: self.enterOuterAlt(localctx, 1) self.state = 57 self.vtype() self._ctx.stop = self._input.LT(-1) self.state = 64 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,5,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = influxdbParser.ValuesContext(self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_values) self.state = 59 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") self.state = 60 self.match(influxdbParser.T__0) self.state = 61 self.vtype() self.state = 66 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,5,self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def function(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = LambdaCalculusParser.FunctionContext( self, self._ctx, _parentState) _prevctx = localctx _startState = 8 self.enterRecursionRule(localctx, 8, self.RULE_function, _p) try: self.enterOuterAlt(localctx, 1) self.state = 79 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 4, self._ctx) if la_ == 1: self.state = 67 self.value() self.state = 68 self.operation() self.state = 69 self.term() pass elif la_ == 2: self.state = 71 self.abstraction() self.state = 72 self.operation() self.state = 73 self.term() pass elif la_ == 3: self.state = 75 self.match(LambdaCalculusParser.LBRACKET) self.state = 76 self.function(0) self.state = 77 self.match(LambdaCalculusParser.RBRACKET) pass self._ctx.stop = self._input.LT(-1) self.state = 87 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 5, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx localctx = LambdaCalculusParser.FunctionContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_function) self.state = 81 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 3)") self.state = 82 self.operation() self.state = 83 self.term() self.state = 89 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 5, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def product(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = udunits2Parser.ProductContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 4 self.enterRecursionRule(localctx, 4, self.RULE_product, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) self.state = 49 self.power() self._ctx.stop = self._input.LT(-1) self.state = 68 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 8, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx self.state = 66 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 7, self._ctx) if la_ == 1: localctx = udunits2Parser.ProductContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_product) self.state = 51 if not self.precpred(self._ctx, 4): from antlr4.error.Errors import ( FailedPredicateException, ) raise FailedPredicateException( self, "self.precpred(self._ctx, 4)") self.state = 52 self.power() pass elif la_ == 2: localctx = udunits2Parser.ProductContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_product) self.state = 53 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import ( FailedPredicateException, ) raise FailedPredicateException( self, "self.precpred(self._ctx, 3)") self.state = 54 self.match(udunits2Parser.MULTIPLY) self.state = 55 self.power() pass elif la_ == 3: localctx = udunits2Parser.ProductContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_product) self.state = 56 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import ( FailedPredicateException, ) raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 57 self.match(udunits2Parser.DIVIDE) self.state = 58 self.power() pass elif la_ == 4: localctx = udunits2Parser.ProductContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_product) self.state = 59 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import ( FailedPredicateException, ) raise FailedPredicateException( self, "self.precpred(self._ctx, 1)") self.state = 61 self._errHandler.sync(self) _la = self._input.LA(1) while True: self.state = 60 self.match(udunits2Parser.WS) self.state = 63 self._errHandler.sync(self) _la = self._input.LA(1) if not (_la == udunits2Parser.WS): break self.state = 65 self.power() pass self.state = 70 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 8, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def formula(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = SpecificationParser.FormulaContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 2 self.enterRecursionRule(localctx, 2, self.RULE_formula, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) self.state = 27 self._errHandler.sync(self) token = self._input.LA(1) if token in [SpecificationParser.T__0]: localctx = SpecificationParser.ParenthesisContext( self, localctx) self._ctx = localctx _prevctx = localctx self.state = 12 self.match(SpecificationParser.T__0) self.state = 13 localctx.left = self.formula(0) self.state = 14 self.match(SpecificationParser.T__1) pass elif token in [ SpecificationParser.TRUE, SpecificationParser.FALSE ]: localctx = SpecificationParser.BooleanConstantContext( self, localctx) self._ctx = localctx _prevctx = localctx self.state = 16 localctx.val = self._input.LT(1) _la = self._input.LA(1) if not (_la == SpecificationParser.TRUE or _la == SpecificationParser.FALSE): localctx.val = self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() pass elif token in [SpecificationParser.ATOMIC_PROPOSITION]: localctx = SpecificationParser.AtomicPropositionContext( self, localctx) self._ctx = localctx _prevctx = localctx self.state = 17 localctx.atom = self.match( SpecificationParser.ATOMIC_PROPOSITION) pass elif token in [ SpecificationParser.NEGATION, SpecificationParser.ALWAYS ]: localctx = SpecificationParser.UnaryOperatorContext( self, localctx) self._ctx = localctx _prevctx = localctx self.state = 18 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == SpecificationParser.NEGATION or _la == SpecificationParser.ALWAYS): localctx.op = self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 19 localctx.left = self.formula(6) pass elif token in [ SpecificationParser.PREVIOUS, SpecificationParser.NEXT, SpecificationParser.EVENTUALLY ]: localctx = SpecificationParser.UnaryOperatorContext( self, localctx) self._ctx = localctx _prevctx = localctx self.state = 20 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not ((((_la) & ~0x3f) == 0 and ((1 << _la) & ((1 << SpecificationParser.PREVIOUS) | (1 << SpecificationParser.NEXT) | (1 << SpecificationParser.EVENTUALLY))) != 0)): localctx.op = self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 21 self.match(SpecificationParser.T__2) self.state = 22 self.match(SpecificationParser.NUMBER) self.state = 23 self.match(SpecificationParser.T__3) self.state = 24 self.match(SpecificationParser.NUMBER) self.state = 25 self.match(SpecificationParser.T__4) self.state = 26 localctx.left = self.formula(5) pass else: raise NoViableAltException(self) self._ctx.stop = self._input.LT(-1) self.state = 48 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 3, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx self.state = 46 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 2, self._ctx) if la_ == 1: localctx = SpecificationParser.BoundedBinaryOperatorContext( self, SpecificationParser.FormulaContext( self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_formula) self.state = 29 if not self.precpred(self._ctx, 4): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 4)") self.state = 30 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == SpecificationParser.SINCE or _la == SpecificationParser.UNTIL): localctx.op = self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 31 self.match(SpecificationParser.T__2) self.state = 32 self.match(SpecificationParser.NUMBER) self.state = 33 self.match(SpecificationParser.T__3) self.state = 34 self.match(SpecificationParser.NUMBER) self.state = 35 self.match(SpecificationParser.T__4) self.state = 36 localctx.right = self.formula(4) pass elif la_ == 2: localctx = SpecificationParser.UnboundedBinaryOperatorContext( self, SpecificationParser.FormulaContext( self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_formula) self.state = 37 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 3)") self.state = 38 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == SpecificationParser.SINCE or _la == SpecificationParser.UNTIL): localctx.op = self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 39 localctx.right = self.formula(3) pass elif la_ == 3: localctx = SpecificationParser.BinaryOperatorContext( self, SpecificationParser.FormulaContext( self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_formula) self.state = 40 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 41 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not (_la == SpecificationParser.CONJUNCTION or _la == SpecificationParser.DISJUNCTION): localctx.op = self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 42 localctx.right = self.formula(3) pass elif la_ == 4: localctx = SpecificationParser.BinaryOperatorContext( self, SpecificationParser.FormulaContext( self, _parentctx, _parentState)) localctx.left = _prevctx self.pushNewRecursionContext(localctx, _startState, self.RULE_formula) self.state = 43 if not self.precpred(self._ctx, 1): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 1)") self.state = 44 localctx.op = self.match( SpecificationParser.IMPLICATION) self.state = 45 localctx.right = self.formula(1) pass self.state = 50 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 3, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def expr(self, _p:int=0): _parentctx = self._ctx _parentState = self.state localctx = SimpleLangParser.ExprContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 4 self.enterRecursionRule(localctx, 4, self.RULE_expr, _p) self._la = 0 # Token type try: self.enterOuterAlt(localctx, 1) self.state = 61 self._errHandler.sync(self) token = self._input.LA(1) if token in [SimpleLangParser.INT, SimpleLangParser.FLOAT, SimpleLangParser.ADD, SimpleLangParser.SUB]: localctx = SimpleLangParser.LiteralexprContext(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 55 self.literal() pass elif token in [SimpleLangParser.ID]: localctx = SimpleLangParser.VariableExprContext(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 56 self.match(SimpleLangParser.ID) pass elif token in [SimpleLangParser.T__1]: localctx = SimpleLangParser.SqrtexprContext(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 57 self.match(SimpleLangParser.T__1) self.state = 58 self.parentheses() pass elif token in [SimpleLangParser.T__3]: localctx = SimpleLangParser.ParexprContext(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 59 self.parentheses() pass elif token in [SimpleLangParser.STRING]: localctx = SimpleLangParser.StringExprContext(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 60 self.match(SimpleLangParser.STRING) pass else: raise NoViableAltException(self) self._ctx.stop = self._input.LT(-1) self.state = 76 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,5,self._ctx) while _alt!=2 and _alt!=ATN.INVALID_ALT_NUMBER: if _alt==1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx self.state = 74 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input,4,self._ctx) if la_ == 1: localctx = SimpleLangParser.PowerexprContext(self, SimpleLangParser.ExprContext(self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) self.state = 63 if not self.precpred(self._ctx, 5): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 5)") self.state = 64 self.match(SimpleLangParser.T__2) self.state = 65 self.expr(6) pass elif la_ == 2: localctx = SimpleLangParser.MuldivexprContext(self, SimpleLangParser.ExprContext(self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) self.state = 66 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 3)") self.state = 67 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not(_la==SimpleLangParser.MUL or _la==SimpleLangParser.DIV): localctx.op = self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 68 self.expr(4) pass elif la_ == 3: localctx = SimpleLangParser.AddsubexprContext(self, SimpleLangParser.ExprContext(self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) self.state = 69 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 2)") self.state = 70 localctx.op = self._input.LT(1) _la = self._input.LA(1) if not(_la==SimpleLangParser.ADD or _la==SimpleLangParser.SUB): localctx.op = self._errHandler.recoverInline(self) else: self._errHandler.reportMatch(self) self.consume() self.state = 71 self.expr(3) pass elif la_ == 4: localctx = SimpleLangParser.ImplicitexprContext(self, SimpleLangParser.ExprContext(self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) self.state = 72 if not self.precpred(self._ctx, 4): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException(self, "self.precpred(self._ctx, 4)") self.state = 73 self.parentheses() pass self.state = 78 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input,5,self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def term(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = testParser.TermContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 4 self.enterRecursionRule(localctx, 4, self.RULE_term, _p) try: self.enterOuterAlt(localctx, 1) self.state = 28 self.fact() self._ctx.stop = self._input.LT(-1) self.state = 38 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 3, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx self.state = 36 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 2, self._ctx) if la_ == 1: localctx = testParser.TermContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_term) self.state = 30 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 3)") self.state = 31 self.match(testParser.MUL) self.state = 32 self.fact() pass elif la_ == 2: localctx = testParser.TermContext( self, _parentctx, _parentState) self.pushNewRecursionContext(localctx, _startState, self.RULE_term) self.state = 33 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 34 self.match(testParser.DIVIDE) self.state = 35 self.fact() pass self.state = 40 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 3, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def expr(self, _p: int = 0): _parentctx = self._ctx _parentState = self.state localctx = testParser.ExprContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 2 self.enterRecursionRule(localctx, 2, self.RULE_expr, _p) try: self.enterOuterAlt(localctx, 1) localctx = testParser.Rule3Context(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 14 self.term(0) self._ctx.stop = self._input.LT(-1) self.state = 24 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 1, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx self.state = 22 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 0, self._ctx) if la_ == 1: localctx = testParser.Rule_plusContext( self, testParser.ExprContext(self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) self.state = 16 if not self.precpred(self._ctx, 3): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 3)") self.state = 17 self.match(testParser.Plus) self.state = 18 self.term(0) pass elif la_ == 2: localctx = testParser.Rule_minusContext( self, testParser.ExprContext(self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_expr) self.state = 19 if not self.precpred(self._ctx, 2): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 2)") self.state = 20 self.match(testParser.MINUS) self.state = 21 self.term(0) pass self.state = 26 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 1, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx
def expression(self, _p=0): _parentctx = self._ctx _parentState = self.state localctx = ContactQLParser.ExpressionContext(self, self._ctx, _parentState) _prevctx = localctx _startState = 2 self.enterRecursionRule(localctx, 2, self.RULE_expression, _p) try: self.enterOuterAlt(localctx, 1) self.state = 18 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 0, self._ctx) if la_ == 1: localctx = ContactQLParser.ExpressionGroupingContext( self, localctx) self._ctx = localctx _prevctx = localctx self.state = 10 self.match(ContactQLParser.LPAREN) self.state = 11 self.expression(0) self.state = 12 self.match(ContactQLParser.RPAREN) pass elif la_ == 2: localctx = ContactQLParser.ConditionContext(self, localctx) self._ctx = localctx _prevctx = localctx self.state = 14 self.match(ContactQLParser.TEXT) self.state = 15 self.match(ContactQLParser.COMPARATOR) self.state = 16 self.literal() pass elif la_ == 3: localctx = ContactQLParser.ImplicitConditionContext( self, localctx) self._ctx = localctx _prevctx = localctx self.state = 17 self.match(ContactQLParser.TEXT) pass self._ctx.stop = self._input.LT(-1) self.state = 30 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) while _alt != 2 and _alt != ATN.INVALID_ALT_NUMBER: if _alt == 1: if self._parseListeners is not None: self.triggerExitRuleEvent() _prevctx = localctx self.state = 28 self._errHandler.sync(self) la_ = self._interp.adaptivePredict(self._input, 1, self._ctx) if la_ == 1: localctx = ContactQLParser.CombinationAndContext( self, ContactQLParser.ExpressionContext( self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) self.state = 20 if not self.precpred(self._ctx, 6): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 6)") self.state = 21 self.match(ContactQLParser.AND) self.state = 22 self.expression(7) pass elif la_ == 2: localctx = ContactQLParser.CombinationImpicitAndContext( self, ContactQLParser.ExpressionContext( self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) self.state = 23 if not self.precpred(self._ctx, 5): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 5)") self.state = 24 self.expression(6) pass elif la_ == 3: localctx = ContactQLParser.CombinationOrContext( self, ContactQLParser.ExpressionContext( self, _parentctx, _parentState)) self.pushNewRecursionContext(localctx, _startState, self.RULE_expression) self.state = 25 if not self.precpred(self._ctx, 4): from antlr4.error.Errors import FailedPredicateException raise FailedPredicateException( self, "self.precpred(self._ctx, 4)") self.state = 26 self.match(ContactQLParser.OR) self.state = 27 self.expression(5) pass self.state = 32 self._errHandler.sync(self) _alt = self._interp.adaptivePredict(self._input, 2, self._ctx) except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) self._errHandler.recover(self, re) finally: self.unrollRecursionContexts(_parentctx) return localctx