()
| 1506 | } |
| 1507 | |
| 1508 | func (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 | |
| 1547 | errorExit: |
| 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. |
| 1561 | type IFnDeclContext interface { |
no test coverage detected