style: format code (#1322)

This commit is contained in:
Kevin Wan
2021-12-14 11:29:44 +08:00
committed by GitHub
parent 1b14de2ff9
commit 490ef13822
15 changed files with 798 additions and 1247 deletions

View File

@@ -13,11 +13,11 @@ import (
type AnonymousFiledContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
star antlr.Token
star antlr.Token
}
func NewEmptyAnonymousFiledContext() *AnonymousFiledContext {
var p = new(AnonymousFiledContext)
p := new(AnonymousFiledContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = ApiParserParserRULE_anonymousFiled
return p
@@ -26,7 +26,7 @@ func NewEmptyAnonymousFiledContext() *AnonymousFiledContext {
func (*AnonymousFiledContext) IsAnonymousFiledContext() {}
func NewAnonymousFiledContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AnonymousFiledContext {
var p = new(AnonymousFiledContext)
p := new(AnonymousFiledContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
@@ -40,10 +40,8 @@ func (s *AnonymousFiledContext) GetParser() antlr.Parser { return s.parser }
func (s *AnonymousFiledContext) GetStar() antlr.Token { return s.star }
func (s *AnonymousFiledContext) SetStar(v antlr.Token) { s.star = v }
func (s *AnonymousFiledContext) ID() antlr.TerminalNode {
return s.GetToken(ApiParserParserID, 0)
}
@@ -56,7 +54,6 @@ func (s *AnonymousFiledContext) ToStringTree(ruleNames []string, recog antlr.Rec
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *AnonymousFiledContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case ApiParserVisitor:
@@ -67,15 +64,11 @@ func (s *AnonymousFiledContext) Accept(visitor antlr.ParseTreeVisitor) interface
}
}
func (p *ApiParserParser) AnonymousFiled() (localctx IAnonymousFiledContext) {
localctx = NewAnonymousFiledContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 40, ApiParserParserRULE_anonymousFiled)
var _la int
defer func() {
p.ExitRule()
}()
@@ -97,28 +90,23 @@ func (p *ApiParserParser) AnonymousFiled() (localctx IAnonymousFiledContext) {
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
if _la == ApiParserParserT__5 {
{
p.SetState(206)
var _m = p.Match(ApiParserParserT__5)
_m := p.Match(ApiParserParserT__5)
localctx.(*AnonymousFiledContext).star = _m
}
}
{
p.SetState(209)
p.Match(ApiParserParserID)
}
return localctx
}
// IDataTypeContext is an interface to support dynamic dispatch.
type IDataTypeContext interface {
antlr.ParserRuleContext
@@ -127,18 +115,16 @@ type IDataTypeContext interface {
GetParser() antlr.Parser
// GetInter returns the inter token.
GetInter() antlr.Token
GetInter() antlr.Token
// GetTime returns the time token.
GetTime() antlr.Token
GetTime() antlr.Token
// SetInter sets the inter token.
SetInter(antlr.Token)
SetInter(antlr.Token)
// SetTime sets the time token.
SetTime(antlr.Token)
SetTime(antlr.Token)
// IsDataTypeContext differentiates from other interfaces.
IsDataTypeContext()
@@ -147,12 +133,12 @@ type IDataTypeContext interface {
type DataTypeContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
inter antlr.Token
time antlr.Token
inter antlr.Token
time antlr.Token
}
func NewEmptyDataTypeContext() *DataTypeContext {
var p = new(DataTypeContext)
p := new(DataTypeContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = ApiParserParserRULE_dataType
return p
@@ -161,7 +147,7 @@ func NewEmptyDataTypeContext() *DataTypeContext {
func (*DataTypeContext) IsDataTypeContext() {}
func NewDataTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *DataTypeContext {
var p = new(DataTypeContext)
p := new(DataTypeContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
@@ -177,18 +163,16 @@ func (s *DataTypeContext) GetInter() antlr.Token { return s.inter }
func (s *DataTypeContext) GetTime() antlr.Token { return s.time }
func (s *DataTypeContext) SetInter(v antlr.Token) { s.inter = v }
func (s *DataTypeContext) SetTime(v antlr.Token) { s.time = v }
func (s *DataTypeContext) ID() antlr.TerminalNode {
return s.GetToken(ApiParserParserID, 0)
}
func (s *DataTypeContext) MapType() IMapTypeContext {
var t = s.GetTypedRuleContext(reflect.TypeOf((*IMapTypeContext)(nil)).Elem(), 0)
t := s.GetTypedRuleContext(reflect.TypeOf((*IMapTypeContext)(nil)).Elem(), 0)
if t == nil {
return nil
@@ -198,7 +182,7 @@ func (s *DataTypeContext) MapType() IMapTypeContext {
}
func (s *DataTypeContext) ArrayType() IArrayTypeContext {
var t = s.GetTypedRuleContext(reflect.TypeOf((*IArrayTypeContext)(nil)).Elem(), 0)
t := s.GetTypedRuleContext(reflect.TypeOf((*IArrayTypeContext)(nil)).Elem(), 0)
if t == nil {
return nil
@@ -212,7 +196,7 @@ func (s *DataTypeContext) INTERFACE() antlr.TerminalNode {
}
func (s *DataTypeContext) PointerType() IPointerTypeContext {
var t = s.GetTypedRuleContext(reflect.TypeOf((*IPointerTypeContext)(nil)).Elem(), 0)
t := s.GetTypedRuleContext(reflect.TypeOf((*IPointerTypeContext)(nil)).Elem(), 0)
if t == nil {
return nil
@@ -222,7 +206,7 @@ func (s *DataTypeContext) PointerType() IPointerTypeContext {
}
func (s *DataTypeContext) 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
@@ -239,7 +223,6 @@ func (s *DataTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognize
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *DataTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case ApiParserVisitor:
@@ -250,9 +233,6 @@ func (s *DataTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
}
}
func (p *ApiParserParser) DataType() (localctx IDataTypeContext) {
localctx = NewDataTypeContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 42, ApiParserParserRULE_dataType)
@@ -284,7 +264,6 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) {
p.Match(ApiParserParserID)
}
case 2:
p.EnterOuterAlt(localctx, 2)
{
@@ -292,7 +271,6 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) {
p.MapType()
}
case 3:
p.EnterOuterAlt(localctx, 3)
{
@@ -300,29 +278,26 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) {
p.ArrayType()
}
case 4:
p.EnterOuterAlt(localctx, 4)
{
p.SetState(215)
var _m = p.Match(ApiParserParserINTERFACE)
_m := p.Match(ApiParserParserINTERFACE)
localctx.(*DataTypeContext).inter = _m
}
case 5:
p.EnterOuterAlt(localctx, 5)
{
p.SetState(216)
var _m = p.Match(ApiParserParserT__6)
_m := p.Match(ApiParserParserT__6)
localctx.(*DataTypeContext).time = _m
}
case 6:
p.EnterOuterAlt(localctx, 6)
{
@@ -330,7 +305,6 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) {
p.PointerType()
}
case 7:
p.EnterOuterAlt(localctx, 7)
{
@@ -340,11 +314,9 @@ func (p *ApiParserParser) DataType() (localctx IDataTypeContext) {
}
return localctx
}
// IPointerTypeContext is an interface to support dynamic dispatch.
type IPointerTypeContext interface {
antlr.ParserRuleContext
@@ -353,12 +325,10 @@ type IPointerTypeContext interface {
GetParser() antlr.Parser
// GetStar returns the star token.
GetStar() antlr.Token
GetStar() antlr.Token
// SetStar sets the star token.
SetStar(antlr.Token)
SetStar(antlr.Token)
// IsPointerTypeContext differentiates from other interfaces.
IsPointerTypeContext()
@@ -367,11 +337,11 @@ type IPointerTypeContext interface {
type PointerTypeContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
star antlr.Token
star antlr.Token
}
func NewEmptyPointerTypeContext() *PointerTypeContext {
var p = new(PointerTypeContext)
p := new(PointerTypeContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = ApiParserParserRULE_pointerType
return p
@@ -380,7 +350,7 @@ func NewEmptyPointerTypeContext() *PointerTypeContext {
func (*PointerTypeContext) IsPointerTypeContext() {}
func NewPointerTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PointerTypeContext {
var p = new(PointerTypeContext)
p := new(PointerTypeContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
@@ -394,10 +364,8 @@ func (s *PointerTypeContext) GetParser() antlr.Parser { return s.parser }
func (s *PointerTypeContext) GetStar() antlr.Token { return s.star }
func (s *PointerTypeContext) SetStar(v antlr.Token) { s.star = v }
func (s *PointerTypeContext) ID() antlr.TerminalNode {
return s.GetToken(ApiParserParserID, 0)
}
@@ -410,7 +378,6 @@ func (s *PointerTypeContext) ToStringTree(ruleNames []string, recog antlr.Recogn
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *PointerTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case ApiParserVisitor:
@@ -421,9 +388,6 @@ func (s *PointerTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{}
}
}
func (p *ApiParserParser) PointerType() (localctx IPointerTypeContext) {
localctx = NewPointerTypeContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 44, ApiParserParserRULE_pointerType)
@@ -448,7 +412,7 @@ func (p *ApiParserParser) PointerType() (localctx IPointerTypeContext) {
{
p.SetState(221)
var _m = p.Match(ApiParserParserT__5)
_m := p.Match(ApiParserParserT__5)
localctx.(*PointerTypeContext).star = _m
}
@@ -458,12 +422,9 @@ func (p *ApiParserParser) PointerType() (localctx IPointerTypeContext) {
p.Match(ApiParserParserID)
}
return localctx
}
// IMapTypeContext is an interface to support dynamic dispatch.
type IMapTypeContext interface {
antlr.ParserRuleContext
@@ -472,55 +433,51 @@ type IMapTypeContext interface {
GetParser() antlr.Parser
// GetMapToken returns the mapToken token.
GetMapToken() antlr.Token
GetMapToken() antlr.Token
// GetLbrack returns the lbrack token.
GetLbrack() antlr.Token
GetLbrack() antlr.Token
// GetKey returns the key token.
GetKey() antlr.Token
GetKey() antlr.Token
// GetRbrack returns the rbrack token.
GetRbrack() antlr.Token
GetRbrack() antlr.Token
// SetMapToken sets the mapToken token.
SetMapToken(antlr.Token)
SetMapToken(antlr.Token)
// SetLbrack sets the lbrack token.
SetLbrack(antlr.Token)
SetLbrack(antlr.Token)
// SetKey sets the key token.
SetKey(antlr.Token)
SetKey(antlr.Token)
// SetRbrack sets the rbrack token.
SetRbrack(antlr.Token)
SetRbrack(antlr.Token)
// GetValue returns the value rule contexts.
GetValue() IDataTypeContext
// SetValue sets the value rule contexts.
SetValue(IDataTypeContext)
// IsMapTypeContext differentiates from other interfaces.
IsMapTypeContext()
}
type MapTypeContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
parser antlr.Parser
mapToken antlr.Token
lbrack antlr.Token
key antlr.Token
rbrack antlr.Token
value IDataTypeContext
lbrack antlr.Token
key antlr.Token
rbrack antlr.Token
value IDataTypeContext
}
func NewEmptyMapTypeContext() *MapTypeContext {
var p = new(MapTypeContext)
p := new(MapTypeContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
p.RuleIndex = ApiParserParserRULE_mapType
return p
@@ -529,7 +486,7 @@ func NewEmptyMapTypeContext() *MapTypeContext {
func (*MapTypeContext) IsMapTypeContext() {}
func NewMapTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MapTypeContext {
var p = new(MapTypeContext)
p := new(MapTypeContext)
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
@@ -549,7 +506,6 @@ func (s *MapTypeContext) GetKey() antlr.Token { return s.key }
func (s *MapTypeContext) GetRbrack() antlr.Token { return s.rbrack }
func (s *MapTypeContext) SetMapToken(v antlr.Token) { s.mapToken = v }
func (s *MapTypeContext) SetLbrack(v antlr.Token) { s.lbrack = v }
@@ -558,13 +514,10 @@ func (s *MapTypeContext) SetKey(v antlr.Token) { s.key = v }
func (s *MapTypeContext) SetRbrack(v antlr.Token) { s.rbrack = v }
func (s *MapTypeContext) GetValue() IDataTypeContext { return s.value }
func (s *MapTypeContext) SetValue(v IDataTypeContext) { s.value = v }
func (s *MapTypeContext) AllID() []antlr.TerminalNode {
return s.GetTokens(ApiParserParserID)
}
@@ -574,7 +527,7 @@ func (s *MapTypeContext) ID(i int) antlr.TerminalNode {
}
func (s *MapTypeContext) 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
@@ -591,7 +544,6 @@ func (s *MapTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *MapTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case ApiParserVisitor:
@@ -602,9 +554,6 @@ func (s *MapTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
}
}
func (p *ApiParserParser) MapType() (localctx IMapTypeContext) {
localctx = NewMapTypeContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 46, ApiParserParserRULE_mapType)
@@ -626,18 +575,18 @@ func (p *ApiParserParser) MapType() (localctx IMapTypeContext) {
}()
p.EnterOuterAlt(localctx, 1)
match(p,"map")
match(p, "map")
{
p.SetState(226)
var _m = p.Match(ApiParserParserID)
_m := p.Match(ApiParserParserID)
localctx.(*MapTypeContext).mapToken = _m
}
{
p.SetState(227)
var _m = p.Match(ApiParserParserT__7)
_m := p.Match(ApiParserParserT__7)
localctx.(*MapTypeContext).lbrack = _m
}
@@ -645,27 +594,24 @@ func (p *ApiParserParser) MapType() (localctx IMapTypeContext) {
{
p.SetState(229)
var _m = p.Match(ApiParserParserID)
_m := p.Match(ApiParserParserID)
localctx.(*MapTypeContext).key = _m
}
{
p.SetState(230)
var _m = p.Match(ApiParserParserT__8)
_m := p.Match(ApiParserParserT__8)
localctx.(*MapTypeContext).rbrack = _m
}
{
p.SetState(231)
var _x = p.DataType()
_x := p.DataType()
localctx.(*MapTypeContext).value = _x
}
return localctx
}