style: format code (#1322)
This commit is contained in:
@@ -10,7 +10,6 @@ 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.
|
||||
|
||||
|
||||
// ITypeLitBodyContext is an interface to support dynamic dispatch.
|
||||
type ITypeLitBodyContext interface {
|
||||
antlr.ParserRuleContext
|
||||
@@ -28,7 +27,7 @@ type TypeLitBodyContext struct {
|
||||
}
|
||||
|
||||
func NewEmptyTypeLitBodyContext() *TypeLitBodyContext {
|
||||
var p = new(TypeLitBodyContext)
|
||||
p := new(TypeLitBodyContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_typeLitBody
|
||||
return p
|
||||
@@ -37,7 +36,7 @@ func NewEmptyTypeLitBodyContext() *TypeLitBodyContext {
|
||||
func (*TypeLitBodyContext) IsTypeLitBodyContext() {}
|
||||
|
||||
func NewTypeLitBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeLitBodyContext {
|
||||
var p = new(TypeLitBodyContext)
|
||||
p := new(TypeLitBodyContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
@@ -50,7 +49,7 @@ func NewTypeLitBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext,
|
||||
func (s *TypeLitBodyContext) GetParser() antlr.Parser { return s.parser }
|
||||
|
||||
func (s *TypeLitBodyContext) TypeStruct() ITypeStructContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0)
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeStructContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
@@ -60,7 +59,7 @@ func (s *TypeLitBodyContext) TypeStruct() ITypeStructContext {
|
||||
}
|
||||
|
||||
func (s *TypeLitBodyContext) TypeAlias() ITypeAliasContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeAliasContext)(nil)).Elem(), 0)
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeAliasContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
@@ -77,7 +76,6 @@ func (s *TypeLitBodyContext) ToStringTree(ruleNames []string, recog antlr.Recogn
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
|
||||
func (s *TypeLitBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
@@ -88,9 +86,6 @@ func (s *TypeLitBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func (p *ApiParserParser) TypeLitBody() (localctx ITypeLitBodyContext) {
|
||||
localctx = NewTypeLitBodyContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 24, ApiParserParserRULE_typeLitBody)
|
||||
@@ -121,7 +116,6 @@ func (p *ApiParserParser) TypeLitBody() (localctx ITypeLitBodyContext) {
|
||||
p.TypeStruct()
|
||||
}
|
||||
|
||||
|
||||
case 2:
|
||||
p.EnterOuterAlt(localctx, 2)
|
||||
{
|
||||
@@ -131,11 +125,9 @@ func (p *ApiParserParser) TypeLitBody() (localctx ITypeLitBodyContext) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
|
||||
// ITypeBlockBodyContext is an interface to support dynamic dispatch.
|
||||
type ITypeBlockBodyContext interface {
|
||||
antlr.ParserRuleContext
|
||||
@@ -153,7 +145,7 @@ type TypeBlockBodyContext struct {
|
||||
}
|
||||
|
||||
func NewEmptyTypeBlockBodyContext() *TypeBlockBodyContext {
|
||||
var p = new(TypeBlockBodyContext)
|
||||
p := new(TypeBlockBodyContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_typeBlockBody
|
||||
return p
|
||||
@@ -162,7 +154,7 @@ func NewEmptyTypeBlockBodyContext() *TypeBlockBodyContext {
|
||||
func (*TypeBlockBodyContext) IsTypeBlockBodyContext() {}
|
||||
|
||||
func NewTypeBlockBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeBlockBodyContext {
|
||||
var p = new(TypeBlockBodyContext)
|
||||
p := new(TypeBlockBodyContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
@@ -175,7 +167,7 @@ func NewTypeBlockBodyContext(parser antlr.Parser, parent antlr.ParserRuleContext
|
||||
func (s *TypeBlockBodyContext) GetParser() antlr.Parser { return s.parser }
|
||||
|
||||
func (s *TypeBlockBodyContext) TypeBlockStruct() ITypeBlockStructContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockStructContext)(nil)).Elem(), 0)
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockStructContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
@@ -185,7 +177,7 @@ func (s *TypeBlockBodyContext) TypeBlockStruct() ITypeBlockStructContext {
|
||||
}
|
||||
|
||||
func (s *TypeBlockBodyContext) TypeBlockAlias() ITypeBlockAliasContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockAliasContext)(nil)).Elem(), 0)
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeBlockAliasContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
@@ -202,7 +194,6 @@ func (s *TypeBlockBodyContext) ToStringTree(ruleNames []string, recog antlr.Reco
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
|
||||
func (s *TypeBlockBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
@@ -213,9 +204,6 @@ func (s *TypeBlockBodyContext) Accept(visitor antlr.ParseTreeVisitor) interface{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func (p *ApiParserParser) TypeBlockBody() (localctx ITypeBlockBodyContext) {
|
||||
localctx = NewTypeBlockBodyContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 26, ApiParserParserRULE_typeBlockBody)
|
||||
@@ -246,7 +234,6 @@ func (p *ApiParserParser) TypeBlockBody() (localctx ITypeBlockBodyContext) {
|
||||
p.TypeBlockStruct()
|
||||
}
|
||||
|
||||
|
||||
case 2:
|
||||
p.EnterOuterAlt(localctx, 2)
|
||||
{
|
||||
@@ -256,11 +243,9 @@ func (p *ApiParserParser) TypeBlockBody() (localctx ITypeBlockBodyContext) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
|
||||
// ITypeStructContext is an interface to support dynamic dispatch.
|
||||
type ITypeStructContext interface {
|
||||
antlr.ParserRuleContext
|
||||
@@ -269,30 +254,28 @@ type ITypeStructContext interface {
|
||||
GetParser() antlr.Parser
|
||||
|
||||
// GetStructName returns the structName token.
|
||||
GetStructName() antlr.Token
|
||||
GetStructName() antlr.Token
|
||||
|
||||
// GetStructToken returns the structToken token.
|
||||
GetStructToken() antlr.Token
|
||||
GetStructToken() antlr.Token
|
||||
|
||||
// GetLbrace returns the lbrace token.
|
||||
GetLbrace() antlr.Token
|
||||
GetLbrace() antlr.Token
|
||||
|
||||
// GetRbrace returns the rbrace token.
|
||||
GetRbrace() antlr.Token
|
||||
|
||||
GetRbrace() antlr.Token
|
||||
|
||||
// SetStructName sets the structName token.
|
||||
SetStructName(antlr.Token)
|
||||
SetStructName(antlr.Token)
|
||||
|
||||
// SetStructToken sets the structToken token.
|
||||
SetStructToken(antlr.Token)
|
||||
SetStructToken(antlr.Token)
|
||||
|
||||
// SetLbrace sets the lbrace token.
|
||||
SetLbrace(antlr.Token)
|
||||
SetLbrace(antlr.Token)
|
||||
|
||||
// SetRbrace sets the rbrace token.
|
||||
SetRbrace(antlr.Token)
|
||||
|
||||
SetRbrace(antlr.Token)
|
||||
|
||||
// IsTypeStructContext differentiates from other interfaces.
|
||||
IsTypeStructContext()
|
||||
@@ -300,15 +283,15 @@ type ITypeStructContext interface {
|
||||
|
||||
type TypeStructContext struct {
|
||||
*antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
structName antlr.Token
|
||||
parser antlr.Parser
|
||||
structName antlr.Token
|
||||
structToken antlr.Token
|
||||
lbrace antlr.Token
|
||||
rbrace antlr.Token
|
||||
lbrace antlr.Token
|
||||
rbrace antlr.Token
|
||||
}
|
||||
|
||||
func NewEmptyTypeStructContext() *TypeStructContext {
|
||||
var p = new(TypeStructContext)
|
||||
p := new(TypeStructContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_typeStruct
|
||||
return p
|
||||
@@ -317,7 +300,7 @@ func NewEmptyTypeStructContext() *TypeStructContext {
|
||||
func (*TypeStructContext) IsTypeStructContext() {}
|
||||
|
||||
func NewTypeStructContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeStructContext {
|
||||
var p = new(TypeStructContext)
|
||||
p := new(TypeStructContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
@@ -337,7 +320,6 @@ func (s *TypeStructContext) GetLbrace() antlr.Token { return s.lbrace }
|
||||
|
||||
func (s *TypeStructContext) GetRbrace() antlr.Token { return s.rbrace }
|
||||
|
||||
|
||||
func (s *TypeStructContext) SetStructName(v antlr.Token) { s.structName = v }
|
||||
|
||||
func (s *TypeStructContext) SetStructToken(v antlr.Token) { s.structToken = v }
|
||||
@@ -346,7 +328,6 @@ func (s *TypeStructContext) SetLbrace(v antlr.Token) { s.lbrace = v }
|
||||
|
||||
func (s *TypeStructContext) SetRbrace(v antlr.Token) { s.rbrace = v }
|
||||
|
||||
|
||||
func (s *TypeStructContext) AllID() []antlr.TerminalNode {
|
||||
return s.GetTokens(ApiParserParserID)
|
||||
}
|
||||
@@ -356,8 +337,8 @@ func (s *TypeStructContext) ID(i int) antlr.TerminalNode {
|
||||
}
|
||||
|
||||
func (s *TypeStructContext) AllField() []IFieldContext {
|
||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem())
|
||||
var tst = make([]IFieldContext, len(ts))
|
||||
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IFieldContext)(nil)).Elem())
|
||||
tst := make([]IFieldContext, len(ts))
|
||||
|
||||
for i, t := range ts {
|
||||
if t != nil {
|
||||
@@ -369,7 +350,7 @@ func (s *TypeStructContext) AllField() []IFieldContext {
|
||||
}
|
||||
|
||||
func (s *TypeStructContext) Field(i int) IFieldContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i)
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*IFieldContext)(nil)).Elem(), i)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
@@ -386,7 +367,6 @@ func (s *TypeStructContext) ToStringTree(ruleNames []string, recog antlr.Recogni
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
|
||||
func (s *TypeStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
@@ -397,15 +377,11 @@ func (s *TypeStructContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
|
||||
localctx = NewTypeStructContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 28, ApiParserParserRULE_typeStruct)
|
||||
var _la int
|
||||
|
||||
|
||||
defer func() {
|
||||
p.ExitRule()
|
||||
}()
|
||||
@@ -429,7 +405,7 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
|
||||
{
|
||||
p.SetState(154)
|
||||
|
||||
var _m = p.Match(ApiParserParserID)
|
||||
_m := p.Match(ApiParserParserID)
|
||||
|
||||
localctx.(*TypeStructContext).structName = _m
|
||||
}
|
||||
@@ -437,21 +413,19 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
|
||||
if _la == ApiParserParserID {
|
||||
{
|
||||
p.SetState(155)
|
||||
|
||||
var _m = p.Match(ApiParserParserID)
|
||||
_m := p.Match(ApiParserParserID)
|
||||
|
||||
localctx.(*TypeStructContext).structToken = _m
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
p.SetState(158)
|
||||
|
||||
var _m = p.Match(ApiParserParserT__3)
|
||||
_m := p.Match(ApiParserParserT__3)
|
||||
|
||||
localctx.(*TypeStructContext).lbrace = _m
|
||||
}
|
||||
@@ -465,8 +439,6 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
|
||||
p.SetState(159)
|
||||
p.Field()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
p.SetState(164)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
@@ -475,17 +447,14 @@ func (p *ApiParserParser) TypeStruct() (localctx ITypeStructContext) {
|
||||
{
|
||||
p.SetState(165)
|
||||
|
||||
var _m = p.Match(ApiParserParserT__4)
|
||||
_m := p.Match(ApiParserParserT__4)
|
||||
|
||||
localctx.(*TypeStructContext).rbrace = _m
|
||||
}
|
||||
|
||||
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
|
||||
// ITypeAliasContext is an interface to support dynamic dispatch.
|
||||
type ITypeAliasContext interface {
|
||||
antlr.ParserRuleContext
|
||||
@@ -494,18 +463,16 @@ type ITypeAliasContext interface {
|
||||
GetParser() antlr.Parser
|
||||
|
||||
// GetAlias returns the alias token.
|
||||
GetAlias() antlr.Token
|
||||
GetAlias() antlr.Token
|
||||
|
||||
// GetAssign returns the assign token.
|
||||
GetAssign() antlr.Token
|
||||
|
||||
GetAssign() antlr.Token
|
||||
|
||||
// SetAlias sets the alias token.
|
||||
SetAlias(antlr.Token)
|
||||
SetAlias(antlr.Token)
|
||||
|
||||
// SetAssign sets the assign token.
|
||||
SetAssign(antlr.Token)
|
||||
|
||||
SetAssign(antlr.Token)
|
||||
|
||||
// IsTypeAliasContext differentiates from other interfaces.
|
||||
IsTypeAliasContext()
|
||||
@@ -514,12 +481,12 @@ type ITypeAliasContext interface {
|
||||
type TypeAliasContext struct {
|
||||
*antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
alias antlr.Token
|
||||
alias antlr.Token
|
||||
assign antlr.Token
|
||||
}
|
||||
|
||||
func NewEmptyTypeAliasContext() *TypeAliasContext {
|
||||
var p = new(TypeAliasContext)
|
||||
p := new(TypeAliasContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_typeAlias
|
||||
return p
|
||||
@@ -528,7 +495,7 @@ func NewEmptyTypeAliasContext() *TypeAliasContext {
|
||||
func (*TypeAliasContext) IsTypeAliasContext() {}
|
||||
|
||||
func NewTypeAliasContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *TypeAliasContext {
|
||||
var p = new(TypeAliasContext)
|
||||
p := new(TypeAliasContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
@@ -544,14 +511,12 @@ func (s *TypeAliasContext) GetAlias() antlr.Token { return s.alias }
|
||||
|
||||
func (s *TypeAliasContext) GetAssign() antlr.Token { return s.assign }
|
||||
|
||||
|
||||
func (s *TypeAliasContext) SetAlias(v antlr.Token) { s.alias = v }
|
||||
|
||||
func (s *TypeAliasContext) SetAssign(v antlr.Token) { s.assign = v }
|
||||
|
||||
|
||||
func (s *TypeAliasContext) DataType() IDataTypeContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
@@ -572,7 +537,6 @@ func (s *TypeAliasContext) ToStringTree(ruleNames []string, recog antlr.Recogniz
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
|
||||
func (s *TypeAliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
@@ -583,15 +547,11 @@ func (s *TypeAliasContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) {
|
||||
localctx = NewTypeAliasContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 30, ApiParserParserRULE_typeAlias)
|
||||
var _la int
|
||||
|
||||
|
||||
defer func() {
|
||||
p.ExitRule()
|
||||
}()
|
||||
@@ -613,7 +573,7 @@ func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) {
|
||||
{
|
||||
p.SetState(168)
|
||||
|
||||
var _m = p.Match(ApiParserParserID)
|
||||
_m := p.Match(ApiParserParserID)
|
||||
|
||||
localctx.(*TypeAliasContext).alias = _m
|
||||
}
|
||||
@@ -621,28 +581,23 @@ func (p *ApiParserParser) TypeAlias() (localctx ITypeAliasContext) {
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
|
||||
if _la == ApiParserParserT__0 {
|
||||
{
|
||||
p.SetState(169)
|
||||
|
||||
var _m = p.Match(ApiParserParserT__0)
|
||||
_m := p.Match(ApiParserParserT__0)
|
||||
|
||||
localctx.(*TypeAliasContext).assign = _m
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
p.SetState(172)
|
||||
p.DataType()
|
||||
}
|
||||
|
||||
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
|
||||
// ITypeBlockStructContext is an interface to support dynamic dispatch.
|
||||
type ITypeBlockStructContext interface {
|
||||
antlr.ParserRuleContext
|
||||
@@ -651,30 +606,28 @@ type ITypeBlockStructContext interface {
|
||||
GetParser() antlr.Parser
|
||||
|
||||
// GetStructName returns the structName token.
|
||||
GetStructName() antlr.Token
|
||||
GetStructName() antlr.Token
|
||||
|
||||
// GetStructToken returns the structToken token.
|
||||
GetStructToken() antlr.Token
|
||||
GetStructToken() antlr.Token
|
||||
|
||||
// GetLbrace returns the lbrace token.
|
||||
GetLbrace() antlr.Token
|
||||
GetLbrace() antlr.Token
|
||||
|
||||
// GetRbrace returns the rbrace token.
|
||||
GetRbrace() antlr.Token
|
||||
|
||||
GetRbrace() antlr.Token
|
||||
|
||||
// SetStructName sets the structName token.
|
||||
SetStructName(antlr.Token)
|
||||
SetStructName(antlr.Token)
|
||||
|
||||
// SetStructToken sets the structToken token.
|
||||
SetStructToken(antlr.Token)
|
||||
SetStructToken(antlr.Token)
|
||||
|
||||
// SetLbrace sets the lbrace token.
|
||||
SetLbrace(antlr.Token)
|
||||
SetLbrace(antlr.Token)
|
||||
|
||||
// SetRbrace sets the rbrace token.
|
||||
SetRbrace(antlr.Token)
|
||||
|
||||
SetRbrace(antlr.Token)
|
||||
|
||||
// IsTypeBlockStructContext differentiates from other interfaces.
|
||||
IsTypeBlockStructContext()
|
||||
|
||||
Reference in New Issue
Block a user