MCPcopy
hub / github.com/antlr/antlr4 / primary

Method primary

runtime/Python3/tests/expr/ExprParser.py:720–759  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

718
719
720 def primary(self):
721
722 localctx = ExprParser.PrimaryContext(self, self._ctx, self.state)
723 self.enterRule(localctx, 12, self.RULE_primary)
724 try:
725 self.state = 78
726 self._errHandler.sync(self)
727 token = self._input.LA(1)
728 if token in [15]:
729 localctx = ExprParser.IntContext(self, localctx)
730 self.enterOuterAlt(localctx, 1)
731 self.state = 72
732 self.match(ExprParser.INT)
733 pass
734 elif token in [14]:
735 localctx = ExprParser.IdContext(self, localctx)
736 self.enterOuterAlt(localctx, 2)
737 self.state = 73
738 self.match(ExprParser.ID)
739 pass
740 elif token in [2]:
741 localctx = ExprParser.ParensContext(self, localctx)
742 self.enterOuterAlt(localctx, 3)
743 self.state = 74
744 self.match(ExprParser.T__1)
745 self.state = 75
746 self.expr(0)
747 self.state = 76
748 self.match(ExprParser.T__3)
749 pass
750 else:
751 raise NoViableAltException(self)
752
753 except RecognitionException as re:
754 localctx.exception = re
755 self._errHandler.reportError(self, re)
756 self._errHandler.recover(self, re)
757 finally:
758 self.exitRule()
759 return localctx
760
761
762

Callers 1

exprMethod · 0.95

Calls 10

exprMethod · 0.95
syncMethod · 0.65
LAMethod · 0.65
reportErrorMethod · 0.65
recoverMethod · 0.65
enterRuleMethod · 0.45
enterOuterAltMethod · 0.45
matchMethod · 0.45
exitRuleMethod · 0.45

Tested by

no test coverage detected