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

Method VarDecl

repl/parser/commands_parser.go:1508–1558  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1506}
1507
1508func (p *CommandsParser) VarDecl() (localctx IVarDeclContext) {
1509 localctx = NewVarDeclContext(p, p.GetParserRuleContext(), p.GetState())
1510 p.EnterRule(localctx, 10, CommandsParserRULE_varDecl)
1511 var _la int
1512
1513 p.EnterOuterAlt(localctx, 1)
1514 {
1515 p.SetState(106)
1516
1517 var _x = p.QualId()
1518
1519 localctx.(*VarDeclContext).id = _x
1520 }
1521 p.SetState(109)
1522 p.GetErrorHandler().Sync(p)
1523 if p.HasError() {
1524 goto errorExit
1525 }
1526 _la = p.GetTokenStream().LA(1)
1527
1528 if _la == CommandsParserCOLON {
1529 {
1530 p.SetState(107)
1531 p.Match(CommandsParserCOLON)
1532 if p.HasError() {
1533 // Recognition error - abort rule
1534 goto errorExit
1535 }
1536 }
1537 {
1538 p.SetState(108)
1539
1540 var _x = p.Type_()
1541
1542 localctx.(*VarDeclContext).t = _x
1543 }
1544
1545 }
1546
1547errorExit:
1548 if p.HasError() {
1549 v := p.GetError()
1550 localctx.SetException(v)
1551 p.GetErrorHandler().ReportError(p, v)
1552 p.GetErrorHandler().Recover(p, v)
1553 p.SetError(nil)
1554 }
1555 p.ExitRule()
1556 return localctx
1557 goto errorExit // Trick to prevent compiler error if the label is not used
1558}
1559
1560// IFnDeclContext is an interface to support dynamic dispatch.
1561type IFnDeclContext interface {

Callers 3

LetMethod · 0.95
DeclareMethod · 0.95
Delete_Method · 0.95

Calls 10

QualIdMethod · 0.95
Type_Method · 0.95
NewVarDeclContextFunction · 0.85
LAMethod · 0.80
ReportErrorMethod · 0.80
RecoverMethod · 0.80
GetStateMethod · 0.65
MatchMethod · 0.65
EnterRuleMethod · 0.45
ExitRuleMethod · 0.45

Tested by

no test coverage detected