package api import ( "reflect" "github.com/zeromicro/antlr" ) // Part 8 // The apiparser_parser.go file was split into multiple files because it // was too large and caused a possible memory overflow during goctl installation. // IBodyContext is an interface to support dynamic dispatch. type IBodyContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // GetLp returns the lp token. GetLp() antlr.Token // GetRp returns the rp token. GetRp() antlr.Token // SetLp sets the lp token. SetLp(antlr.Token) // SetRp sets the rp token. SetRp(antlr.Token) // IsBodyContext differentiates from other interfaces. IsBodyContext() } type BodyContext struct { *antlr.BaseParserRuleContext parser antlr.Parser lp antlr.Token rp antlr.Token } func NewEmptyBodyContext() *BodyContext { p := new(BodyContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_body return p } func (*BodyContext) IsBodyContext() {} func NewBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *BodyContext { p := new(BodyContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) p.parser = parser p.RuleIndex = ApiParserParserRULE_body return p } func (s *BodyContext) GetParser() antlr.Parser { return s.parser } func (s *BodyContext) GetLp() antlr.Token { return s.lp } func (s *BodyContext) GetRp() antlr.Token { return s.rp } func (s *BodyContext) SetLp(v antlr.Token) { s.lp = v } func (s *BodyContext) SetRp(v antlr.Token) { s.rp = v } func (s *BodyContext) ID() antlr.TerminalNode { return s.GetToken(ApiParserParserID, 0) } func (s *BodyContext) GetRuleContext() antlr.RuleContext { return s } func (s *BodyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } func (s *BodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: return t.VisitBody(s) default: return t.VisitChildren(s) } } func (p *ApiParserParser) Body() (localctx IBodyContext) { localctx = NewBodyContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 64, ApiParserParserRULE_body) var _la int defer func() { p.ExitRule() }() defer func() { if err := recover(); err != nil { if v, ok := err.(antlr.RecognitionException); ok { localctx.SetException(v) p.GetErrorHandler().ReportError(p, v) p.GetErrorHandler().Recover(p, v) } else { panic(err) } } }() p.EnterOuterAlt(localctx, 1) { p.SetState(299) _m := p.Match(ApiParserParserT__1) localctx.(*BodyContext).lp = _m } p.SetState(301) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) if _la == ApiParserParserID { { p.SetState(300) p.Match(ApiParserParserID) } } { p.SetState(303) _m := p.Match(ApiParserParserT__2) localctx.(*BodyContext).rp = _m } return localctx } // IReplybodyContext is an interface to support dynamic dispatch. type IReplybodyContext interface { antlr.ParserRuleContext // GetParser returns the parser. GetParser() antlr.Parser // GetReturnToken returns the returnToken token. GetReturnToken() antlr.Token // GetLp returns the lp token. GetLp() antlr.Token // GetRp returns the rp token. GetRp() antlr.Token // SetReturnToken sets the returnToken token. SetReturnToken(antlr.Token) // SetLp sets the lp token. SetLp(antlr.Token) // SetRp sets the rp token. SetRp(antlr.Token) // IsReplybodyContext differentiates from other interfaces. IsReplybodyContext() } type ReplybodyContext struct { *antlr.BaseParserRuleContext parser antlr.Parser returnToken antlr.Token lp antlr.Token rp antlr.Token } func NewEmptyReplybodyContext() *ReplybodyContext { p := new(ReplybodyContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1) p.RuleIndex = ApiParserParserRULE_replybody return p } func (*ReplybodyContext) IsReplybodyContext() {} func NewReplybodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ReplybodyContext { p := new(ReplybodyContext) p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState) p.parser = parser p.RuleIndex = ApiParserParserRULE_replybody return p } func (s *ReplybodyContext) GetParser() antlr.Parser { return s.parser } func (s *ReplybodyContext) GetReturnToken() antlr.Token { return s.returnToken } func (s *ReplybodyContext) GetLp() antlr.Token { return s.lp } func (s *ReplybodyContext) GetRp() antlr.Token { return s.rp } func (s *ReplybodyContext) SetReturnToken(v antlr.Token) { s.returnToken = v } func (s *ReplybodyContext) SetLp(v antlr.Token) { s.lp = v } func (s *ReplybodyContext) SetRp(v antlr.Token) { s.rp = v } func (s *ReplybodyContext) DataType() IDataTypeContext { t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0) if t == nil { return nil } return t.(IDataTypeContext) } func (s *ReplybodyContext) GetRuleContext() antlr.RuleContext { return s } func (s *ReplybodyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string { return antlr.TreesStringTree(s, ruleNames, recog) } func (s *ReplybodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} { switch t := visitor.(type) { case ApiParserVisitor: return t.VisitReplybody(s) default: return t.VisitChildren(s) } } func (p *ApiParserParser) Replybody() (localctx IReplybodyContext) { localctx = NewReplybodyContext(p, p.GetParserRuleContext(), p.GetState()) p.EnterRule(localctx, 66, ApiParserParserRULE_replybody) var _la int defer func() { p.ExitRule() }() defer func() { if err := recover(); err != nil { if v, ok := err.(antlr.RecognitionException); ok { localctx.SetException(v) p.GetErrorHandler().ReportError(p, v) p.GetErrorHandler().Recover(p, v) } else { panic(err) } } }() p.EnterOuterAlt(localctx, 1) { p.SetState(305) _m := p.Match(ApiParserParserT__9) localctx.(*ReplybodyContext).returnToken = _m } { p.SetState(306) _m := p.Match(ApiParserParserT__1) localctx.(*ReplybodyContext).lp = _m } p.SetState(308) p.GetErrorHandler().Sync(p) _la = p.GetTokenStream().LA(1) if ((_la)&-(0x1f+1)) == 0 && ((1<