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

Method OptExpr

parser/gen/cel_parser.go:5429–5475  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5427}
5428
5429func (p *CELParser) OptExpr() (localctx IOptExprContext) {
5430 localctx = NewOptExprContext(p, p.GetParserRuleContext(), p.GetState())
5431 p.EnterRule(localctx, 30, CELParserRULE_optExpr)
5432 var _la int
5433
5434 p.EnterOuterAlt(localctx, 1)
5435 p.SetState(238)
5436 p.GetErrorHandler().Sync(p)
5437 if p.HasError() {
5438 goto errorExit
5439 }
5440 _la = p.GetTokenStream().LA(1)
5441
5442 if _la == CELParserQUESTIONMARK {
5443 {
5444 p.SetState(237)
5445
5446 var _m = p.Match(CELParserQUESTIONMARK)
5447
5448 localctx.(*OptExprContext).opt = _m
5449 if p.HasError() {
5450 // Recognition error - abort rule
5451 goto errorExit
5452 }
5453 }
5454
5455 }
5456 {
5457 p.SetState(240)
5458
5459 var _x = p.Expr()
5460
5461 localctx.(*OptExprContext).e = _x
5462 }
5463
5464errorExit:
5465 if p.HasError() {
5466 v := p.GetError()
5467 localctx.SetException(v)
5468 p.GetErrorHandler().ReportError(p, v)
5469 p.GetErrorHandler().Recover(p, v)
5470 p.SetError(nil)
5471 }
5472 p.ExitRule()
5473 return localctx
5474 goto errorExit // Trick to prevent compiler error if the label is not used
5475}
5476
5477// ILiteralContext is an interface to support dynamic dispatch.
5478type ILiteralContext interface {

Callers 2

ListInitMethod · 0.95
MapInitializerListMethod · 0.95

Calls 9

ExprMethod · 0.95
LAMethod · 0.80
ReportErrorMethod · 0.80
RecoverMethod · 0.80
NewOptExprContextFunction · 0.70
GetStateMethod · 0.65
MatchMethod · 0.65
EnterRuleMethod · 0.45
ExitRuleMethod · 0.45

Tested by

no test coverage detected