You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
698 lines
15 KiB
Go
698 lines
15 KiB
Go
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 {
|
|
var 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 {
|
|
var 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(302)
|
|
|
|
var _m = p.Match(ApiParserParserT__1)
|
|
|
|
localctx.(*BodyContext).lp = _m
|
|
}
|
|
p.SetState(304)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ApiParserParserID {
|
|
{
|
|
p.SetState(303)
|
|
p.Match(ApiParserParserID)
|
|
}
|
|
|
|
}
|
|
{
|
|
p.SetState(306)
|
|
|
|
var _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
|
|
|
|
// 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)
|
|
|
|
// IsReplybodyContext differentiates from other interfaces.
|
|
IsReplybodyContext()
|
|
}
|
|
|
|
type ReplybodyContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
lp antlr.Token
|
|
rp antlr.Token
|
|
}
|
|
|
|
func NewEmptyReplybodyContext() *ReplybodyContext {
|
|
var 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 {
|
|
var 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) GetLp() antlr.Token { return s.lp }
|
|
|
|
func (s *ReplybodyContext) GetRp() antlr.Token { return s.rp }
|
|
|
|
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 {
|
|
var 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(308)
|
|
|
|
var _m = p.Match(ApiParserParserT__1)
|
|
|
|
localctx.(*ReplybodyContext).lp = _m
|
|
}
|
|
p.SetState(310)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if ((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<ApiParserParserT__5)|(1<<ApiParserParserT__6)|(1<<ApiParserParserT__7)|(1<<ApiParserParserINTERFACE)|(1<<ApiParserParserID))) != 0 {
|
|
{
|
|
p.SetState(309)
|
|
p.DataType()
|
|
}
|
|
|
|
}
|
|
{
|
|
p.SetState(312)
|
|
|
|
var _m = p.Match(ApiParserParserT__2)
|
|
|
|
localctx.(*ReplybodyContext).rp = _m
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IKvLitContext is an interface to support dynamic dispatch.
|
|
type IKvLitContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// GetKey returns the key token.
|
|
GetKey() antlr.Token
|
|
|
|
// GetValue returns the value token.
|
|
GetValue() antlr.Token
|
|
|
|
// SetKey sets the key token.
|
|
SetKey(antlr.Token)
|
|
|
|
// SetValue sets the value token.
|
|
SetValue(antlr.Token)
|
|
|
|
// IsKvLitContext differentiates from other interfaces.
|
|
IsKvLitContext()
|
|
}
|
|
|
|
type KvLitContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
key antlr.Token
|
|
value antlr.Token
|
|
}
|
|
|
|
func NewEmptyKvLitContext() *KvLitContext {
|
|
var p = new(KvLitContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = ApiParserParserRULE_kvLit
|
|
return p
|
|
}
|
|
|
|
func (*KvLitContext) IsKvLitContext() {}
|
|
|
|
func NewKvLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KvLitContext {
|
|
var p = new(KvLitContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = ApiParserParserRULE_kvLit
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *KvLitContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *KvLitContext) GetKey() antlr.Token { return s.key }
|
|
|
|
func (s *KvLitContext) GetValue() antlr.Token { return s.value }
|
|
|
|
func (s *KvLitContext) SetKey(v antlr.Token) { s.key = v }
|
|
|
|
func (s *KvLitContext) SetValue(v antlr.Token) { s.value = v }
|
|
|
|
func (s *KvLitContext) ID() antlr.TerminalNode {
|
|
return s.GetToken(ApiParserParserID, 0)
|
|
}
|
|
|
|
func (s *KvLitContext) LINE_VALUE() antlr.TerminalNode {
|
|
return s.GetToken(ApiParserParserLINE_VALUE, 0)
|
|
}
|
|
|
|
func (s *KvLitContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *KvLitContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *KvLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case ApiParserVisitor:
|
|
return t.VisitKvLit(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *ApiParserParser) KvLit() (localctx IKvLitContext) {
|
|
localctx = NewKvLitContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 68, ApiParserParserRULE_kvLit)
|
|
|
|
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(314)
|
|
|
|
var _m = p.Match(ApiParserParserID)
|
|
|
|
localctx.(*KvLitContext).key = _m
|
|
}
|
|
checkKeyValue(p)
|
|
{
|
|
p.SetState(316)
|
|
|
|
var _m = p.Match(ApiParserParserLINE_VALUE)
|
|
|
|
localctx.(*KvLitContext).value = _m
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IServiceNameContext is an interface to support dynamic dispatch.
|
|
type IServiceNameContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsServiceNameContext differentiates from other interfaces.
|
|
IsServiceNameContext()
|
|
}
|
|
|
|
type ServiceNameContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyServiceNameContext() *ServiceNameContext {
|
|
var p = new(ServiceNameContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = ApiParserParserRULE_serviceName
|
|
return p
|
|
}
|
|
|
|
func (*ServiceNameContext) IsServiceNameContext() {}
|
|
|
|
func NewServiceNameContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceNameContext {
|
|
var p = new(ServiceNameContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = ApiParserParserRULE_serviceName
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *ServiceNameContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *ServiceNameContext) AllID() []antlr.TerminalNode {
|
|
return s.GetTokens(ApiParserParserID)
|
|
}
|
|
|
|
func (s *ServiceNameContext) ID(i int) antlr.TerminalNode {
|
|
return s.GetToken(ApiParserParserID, i)
|
|
}
|
|
|
|
func (s *ServiceNameContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *ServiceNameContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *ServiceNameContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case ApiParserVisitor:
|
|
return t.VisitServiceName(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *ApiParserParser) ServiceName() (localctx IServiceNameContext) {
|
|
localctx = NewServiceNameContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 70, ApiParserParserRULE_serviceName)
|
|
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(322)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
for ok := true; ok; ok = _la == ApiParserParserID {
|
|
{
|
|
p.SetState(318)
|
|
p.Match(ApiParserParserID)
|
|
}
|
|
p.SetState(320)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ApiParserParserT__9 {
|
|
{
|
|
p.SetState(319)
|
|
p.Match(ApiParserParserT__9)
|
|
}
|
|
|
|
}
|
|
|
|
p.SetState(324)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
}
|
|
|
|
return localctx
|
|
}
|
|
|
|
// IPathContext is an interface to support dynamic dispatch.
|
|
type IPathContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// IsPathContext differentiates from other interfaces.
|
|
IsPathContext()
|
|
}
|
|
|
|
type PathContext struct {
|
|
*antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyPathContext() *PathContext {
|
|
var p = new(PathContext)
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
|
p.RuleIndex = ApiParserParserRULE_path
|
|
return p
|
|
}
|
|
|
|
func (*PathContext) IsPathContext() {}
|
|
|
|
func NewPathContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PathContext {
|
|
var p = new(PathContext)
|
|
|
|
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = ApiParserParserRULE_path
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *PathContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *PathContext) AllID() []antlr.TerminalNode {
|
|
return s.GetTokens(ApiParserParserID)
|
|
}
|
|
|
|
func (s *PathContext) ID(i int) antlr.TerminalNode {
|
|
return s.GetToken(ApiParserParserID, i)
|
|
}
|
|
|
|
func (s *PathContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *PathContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *PathContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
|
switch t := visitor.(type) {
|
|
case ApiParserVisitor:
|
|
return t.VisitPath(s)
|
|
|
|
default:
|
|
return t.VisitChildren(s)
|
|
}
|
|
}
|
|
|
|
func (p *ApiParserParser) Path() (localctx IPathContext) {
|
|
localctx = NewPathContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 72, ApiParserParserRULE_path)
|
|
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.SetState(346)
|
|
p.GetErrorHandler().Sync(p)
|
|
switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 39, p.GetParserRuleContext()) {
|
|
case 1:
|
|
p.EnterOuterAlt(localctx, 1)
|
|
p.SetState(341)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
for ok := true; ok; ok = _la == ApiParserParserT__10 || _la == ApiParserParserT__11 {
|
|
p.SetState(341)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
switch p.GetTokenStream().LA(1) {
|
|
case ApiParserParserT__10:
|
|
{
|
|
p.SetState(326)
|
|
p.Match(ApiParserParserT__10)
|
|
}
|
|
|
|
{
|
|
p.SetState(327)
|
|
p.Match(ApiParserParserID)
|
|
}
|
|
p.SetState(332)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
for _la == ApiParserParserT__9 {
|
|
{
|
|
p.SetState(328)
|
|
p.Match(ApiParserParserT__9)
|
|
}
|
|
{
|
|
p.SetState(329)
|
|
p.Match(ApiParserParserID)
|
|
}
|
|
|
|
p.SetState(334)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
}
|
|
|
|
case ApiParserParserT__11:
|
|
{
|
|
p.SetState(335)
|
|
p.Match(ApiParserParserT__11)
|
|
}
|
|
|
|
{
|
|
p.SetState(336)
|
|
p.Match(ApiParserParserID)
|
|
}
|
|
p.SetState(339)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ApiParserParserT__9 {
|
|
{
|
|
p.SetState(337)
|
|
p.Match(ApiParserParserT__9)
|
|
}
|
|
{
|
|
p.SetState(338)
|
|
p.Match(ApiParserParserID)
|
|
}
|
|
|
|
}
|
|
|
|
default:
|
|
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
|
|
}
|
|
|
|
p.SetState(343)
|
|
p.GetErrorHandler().Sync(p)
|
|
_la = p.GetTokenStream().LA(1)
|
|
}
|
|
|
|
case 2:
|
|
p.EnterOuterAlt(localctx, 2)
|
|
{
|
|
p.SetState(345)
|
|
p.Match(ApiParserParserT__10)
|
|
}
|
|
|
|
}
|
|
|
|
return localctx
|
|
}
|