* fix #1318 * fix #1318 * remove never used code * fix unit tes Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
// The apiparser_parser.go file was split into multiple files because it
|
||||
// was too large and caused a possible memory overflow during goctl installation.
|
||||
|
||||
|
||||
// IArrayTypeContext is an interface to support dynamic dispatch.
|
||||
type IArrayTypeContext interface {
|
||||
antlr.ParserRuleContext
|
||||
@@ -18,16 +19,18 @@ type IArrayTypeContext interface {
|
||||
GetParser() antlr.Parser
|
||||
|
||||
// GetLbrack returns the lbrack token.
|
||||
GetLbrack() antlr.Token
|
||||
GetLbrack() antlr.Token
|
||||
|
||||
// GetRbrack returns the rbrack token.
|
||||
GetRbrack() antlr.Token
|
||||
GetRbrack() antlr.Token
|
||||
|
||||
|
||||
// SetLbrack sets the lbrack token.
|
||||
SetLbrack(antlr.Token)
|
||||
SetLbrack(antlr.Token)
|
||||
|
||||
// SetRbrack sets the rbrack token.
|
||||
SetRbrack(antlr.Token)
|
||||
SetRbrack(antlr.Token)
|
||||
|
||||
|
||||
// IsArrayTypeContext differentiates from other interfaces.
|
||||
IsArrayTypeContext()
|
||||
@@ -66,10 +69,12 @@ func (s *ArrayTypeContext) GetLbrack() antlr.Token { return s.lbrack }
|
||||
|
||||
func (s *ArrayTypeContext) GetRbrack() antlr.Token { return s.rbrack }
|
||||
|
||||
|
||||
func (s *ArrayTypeContext) SetLbrack(v antlr.Token) { s.lbrack = v }
|
||||
|
||||
func (s *ArrayTypeContext) SetRbrack(v antlr.Token) { s.rbrack = v }
|
||||
|
||||
|
||||
func (s *ArrayTypeContext) DataType() IDataTypeContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||
|
||||
@@ -88,6 +93,7 @@ func (s *ArrayTypeContext) ToStringTree(ruleNames []string, recog antlr.Recogniz
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
|
||||
func (s *ArrayTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
@@ -98,6 +104,9 @@ func (s *ArrayTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) {
|
||||
localctx = NewArrayTypeContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 48, ApiParserParserRULE_arrayType)
|
||||
@@ -138,9 +147,12 @@ func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) {
|
||||
p.DataType()
|
||||
}
|
||||
|
||||
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
|
||||
// IServiceSpecContext is an interface to support dynamic dispatch.
|
||||
type IServiceSpecContext interface {
|
||||
antlr.ParserRuleContext
|
||||
@@ -207,6 +219,7 @@ func (s *ServiceSpecContext) ToStringTree(ruleNames []string, recog antlr.Recogn
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
|
||||
func (s *ServiceSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
@@ -217,11 +230,15 @@ func (s *ServiceSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) {
|
||||
localctx = NewServiceSpecContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 50, ApiParserParserRULE_serviceSpec)
|
||||
var _la int
|
||||
|
||||
|
||||
defer func() {
|
||||
p.ExitRule()
|
||||
}()
|
||||
@@ -243,6 +260,7 @@ func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) {
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
|
||||
if _la == ApiParserParserATSERVER {
|
||||
{
|
||||
p.SetState(237)
|
||||
@@ -255,9 +273,12 @@ func (p *ApiParserParser) ServiceSpec() (localctx IServiceSpecContext) {
|
||||
p.ServiceApi()
|
||||
}
|
||||
|
||||
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
|
||||
// IAtServerContext is an interface to support dynamic dispatch.
|
||||
type IAtServerContext interface {
|
||||
antlr.ParserRuleContext
|
||||
@@ -266,16 +287,18 @@ type IAtServerContext interface {
|
||||
GetParser() antlr.Parser
|
||||
|
||||
// GetLp returns the lp token.
|
||||
GetLp() antlr.Token
|
||||
GetLp() antlr.Token
|
||||
|
||||
// GetRp returns the rp token.
|
||||
GetRp() antlr.Token
|
||||
GetRp() antlr.Token
|
||||
|
||||
|
||||
// SetLp sets the lp token.
|
||||
SetLp(antlr.Token)
|
||||
SetLp(antlr.Token)
|
||||
|
||||
// SetRp sets the rp token.
|
||||
SetRp(antlr.Token)
|
||||
SetRp(antlr.Token)
|
||||
|
||||
|
||||
// IsAtServerContext differentiates from other interfaces.
|
||||
IsAtServerContext()
|
||||
@@ -284,8 +307,8 @@ type IAtServerContext interface {
|
||||
type AtServerContext struct {
|
||||
*antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
lp antlr.Token
|
||||
rp antlr.Token
|
||||
lp antlr.Token
|
||||
rp antlr.Token
|
||||
}
|
||||
|
||||
func NewEmptyAtServerContext() *AtServerContext {
|
||||
@@ -314,10 +337,12 @@ func (s *AtServerContext) GetLp() antlr.Token { return s.lp }
|
||||
|
||||
func (s *AtServerContext) GetRp() antlr.Token { return s.rp }
|
||||
|
||||
|
||||
func (s *AtServerContext) SetLp(v antlr.Token) { s.lp = v }
|
||||
|
||||
func (s *AtServerContext) SetRp(v antlr.Token) { s.rp = v }
|
||||
|
||||
|
||||
func (s *AtServerContext) ATSERVER() antlr.TerminalNode {
|
||||
return s.GetToken(ApiParserParserATSERVER, 0)
|
||||
}
|
||||
@@ -353,6 +378,7 @@ func (s *AtServerContext) ToStringTree(ruleNames []string, recog antlr.Recognize
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
|
||||
func (s *AtServerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
@@ -363,11 +389,15 @@ func (s *AtServerContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func (p *ApiParserParser) AtServer() (localctx IAtServerContext) {
|
||||
localctx = NewAtServerContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 52, ApiParserParserRULE_atServer)
|
||||
var _la int
|
||||
|
||||
|
||||
defer func() {
|
||||
p.ExitRule()
|
||||
}()
|
||||
@@ -405,6 +435,7 @@ func (p *ApiParserParser) AtServer() (localctx IAtServerContext) {
|
||||
p.KvLit()
|
||||
}
|
||||
|
||||
|
||||
p.SetState(247)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
@@ -417,9 +448,12 @@ func (p *ApiParserParser) AtServer() (localctx IAtServerContext) {
|
||||
localctx.(*AtServerContext).rp = _m
|
||||
}
|
||||
|
||||
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
|
||||
// IServiceApiContext is an interface to support dynamic dispatch.
|
||||
type IServiceApiContext interface {
|
||||
antlr.ParserRuleContext
|
||||
@@ -428,22 +462,24 @@ type IServiceApiContext interface {
|
||||
GetParser() antlr.Parser
|
||||
|
||||
// GetServiceToken returns the serviceToken token.
|
||||
GetServiceToken() antlr.Token
|
||||
GetServiceToken() antlr.Token
|
||||
|
||||
// GetLbrace returns the lbrace token.
|
||||
GetLbrace() antlr.Token
|
||||
GetLbrace() antlr.Token
|
||||
|
||||
// GetRbrace returns the rbrace token.
|
||||
GetRbrace() antlr.Token
|
||||
GetRbrace() antlr.Token
|
||||
|
||||
|
||||
// SetServiceToken sets the serviceToken token.
|
||||
SetServiceToken(antlr.Token)
|
||||
SetServiceToken(antlr.Token)
|
||||
|
||||
// SetLbrace sets the lbrace token.
|
||||
SetLbrace(antlr.Token)
|
||||
SetLbrace(antlr.Token)
|
||||
|
||||
// SetRbrace sets the rbrace token.
|
||||
SetRbrace(antlr.Token)
|
||||
SetRbrace(antlr.Token)
|
||||
|
||||
|
||||
// IsServiceApiContext differentiates from other interfaces.
|
||||
IsServiceApiContext()
|
||||
@@ -451,10 +487,10 @@ type IServiceApiContext interface {
|
||||
|
||||
type ServiceApiContext struct {
|
||||
*antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
parser antlr.Parser
|
||||
serviceToken antlr.Token
|
||||
lbrace antlr.Token
|
||||
rbrace antlr.Token
|
||||
lbrace antlr.Token
|
||||
rbrace antlr.Token
|
||||
}
|
||||
|
||||
func NewEmptyServiceApiContext() *ServiceApiContext {
|
||||
@@ -485,12 +521,14 @@ func (s *ServiceApiContext) GetLbrace() antlr.Token { return s.lbrace }
|
||||
|
||||
func (s *ServiceApiContext) GetRbrace() antlr.Token { return s.rbrace }
|
||||
|
||||
|
||||
func (s *ServiceApiContext) SetServiceToken(v antlr.Token) { s.serviceToken = v }
|
||||
|
||||
func (s *ServiceApiContext) SetLbrace(v antlr.Token) { s.lbrace = v }
|
||||
|
||||
func (s *ServiceApiContext) SetRbrace(v antlr.Token) { s.rbrace = v }
|
||||
|
||||
|
||||
func (s *ServiceApiContext) ServiceName() IServiceNameContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceNameContext)(nil)).Elem(), 0)
|
||||
|
||||
@@ -536,6 +574,7 @@ func (s *ServiceApiContext) ToStringTree(ruleNames []string, recog antlr.Recogni
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
|
||||
func (s *ServiceApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
@@ -546,11 +585,15 @@ func (s *ServiceApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) {
|
||||
localctx = NewServiceApiContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 54, ApiParserParserRULE_serviceApi)
|
||||
var _la int
|
||||
|
||||
|
||||
defer func() {
|
||||
p.ExitRule()
|
||||
}()
|
||||
@@ -568,7 +611,7 @@ func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) {
|
||||
}()
|
||||
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
match(p, "service")
|
||||
match(p,"service")
|
||||
{
|
||||
p.SetState(252)
|
||||
|
||||
@@ -591,12 +634,14 @@ func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) {
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
for ((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<ApiParserParserATDOC)|(1<<ApiParserParserATHANDLER)|(1<<ApiParserParserATSERVER))) != 0 {
|
||||
|
||||
for (((_la) & -(0x1f+1)) == 0 && ((1 << uint(_la)) & ((1 << ApiParserParserATDOC) | (1 << ApiParserParserATHANDLER) | (1 << ApiParserParserATSERVER))) != 0) {
|
||||
{
|
||||
p.SetState(255)
|
||||
p.ServiceRoute()
|
||||
}
|
||||
|
||||
|
||||
p.SetState(260)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
@@ -609,5 +654,7 @@ func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) {
|
||||
localctx.(*ServiceApiContext).rbrace = _m
|
||||
}
|
||||
|
||||
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user