MCPcopy Create free account
hub / github.com/cel-expr/cel-go / calc

Method calc

repl/parser/commands_parser.go:5571–5704  ·  view source on GitHub ↗
(_p int)

Source from the content-addressed store, hash-verified

5569}
5570
5571func (p *CommandsParser) calc(_p int) (localctx ICalcContext) {
5572 var _parentctx antlr.ParserRuleContext = p.GetParserRuleContext()
5573
5574 _parentState := p.GetState()
5575 localctx = NewCalcContext(p, p.GetParserRuleContext(), _parentState)
5576 var _prevctx ICalcContext = localctx
5577 var _ antlr.ParserRuleContext = _prevctx // TODO: To prevent unused variable warning.
5578 _startState := 50
5579 p.EnterRecursionRule(localctx, 50, CommandsParserRULE_calc, _p)
5580 var _la int
5581
5582 var _alt int
5583
5584 p.EnterOuterAlt(localctx, 1)
5585 {
5586 p.SetState(253)
5587 p.Unary()
5588 }
5589
5590 p.GetParserRuleContext().SetStop(p.GetTokenStream().LT(-1))
5591 p.SetState(263)
5592 p.GetErrorHandler().Sync(p)
5593 if p.HasError() {
5594 goto errorExit
5595 }
5596 _alt = p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 25, p.GetParserRuleContext())
5597 if p.HasError() {
5598 goto errorExit
5599 }
5600 for _alt != 2 && _alt != antlr.ATNInvalidAltNumber {
5601 if _alt == 1 {
5602 if p.GetParseListeners() != nil {
5603 p.TriggerExitRuleEvent()
5604 }
5605 _prevctx = localctx
5606 p.SetState(261)
5607 p.GetErrorHandler().Sync(p)
5608 if p.HasError() {
5609 goto errorExit
5610 }
5611
5612 switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 24, p.GetParserRuleContext()) {
5613 case 1:
5614 localctx = NewCalcContext(p, _parentctx, _parentState)
5615 p.PushNewRecursionContext(localctx, _startState, CommandsParserRULE_calc)
5616 p.SetState(255)
5617
5618 if !(p.Precpred(p.GetParserRuleContext(), 2)) {
5619 p.SetError(antlr.NewFailedPredicateException(p, "p.Precpred(p.GetParserRuleContext(), 2)", ""))
5620 goto errorExit
5621 }
5622 {
5623 p.SetState(256)
5624
5625 var _lt = p.GetTokenStream().LT(1)
5626
5627 localctx.(*CalcContext).op = _lt
5628

Callers 2

relationMethod · 0.95
CalcMethod · 0.95

Calls 9

UnaryMethod · 0.95
LTMethod · 0.80
LAMethod · 0.80
RecoverInlineMethod · 0.80
ReportErrorMethod · 0.80
RecoverMethod · 0.80
NewCalcContextFunction · 0.70
GetStateMethod · 0.65
ConsumeMethod · 0.45

Tested by

no test coverage detected