* fix #1318

* fix #1318

* remove never used code

* fix unit tes

Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
anqiansong
2021-12-13 22:55:11 +08:00
committed by GitHub
parent 914692cc82
commit 1b14de2ff9
18 changed files with 1103 additions and 660 deletions

View File

@@ -18,12 +18,14 @@ func (s *SyntaxLitContext) GetAssign() antlr.Token { return s.assign }
func (s *SyntaxLitContext) GetVersion() antlr.Token { return s.version }
func (s *SyntaxLitContext) SetSyntaxToken(v antlr.Token) { s.syntaxToken = v }
func (s *SyntaxLitContext) SetAssign(v antlr.Token) { s.assign = v }
func (s *SyntaxLitContext) SetVersion(v antlr.Token) { s.version = v }
func (s *SyntaxLitContext) ID() antlr.TerminalNode {
return s.GetToken(ApiParserParserID, 0)
}
@@ -40,6 +42,7 @@ func (s *SyntaxLitContext) ToStringTree(ruleNames []string, recog antlr.Recogniz
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *SyntaxLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case ApiParserVisitor:
@@ -50,6 +53,9 @@ func (s *SyntaxLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
}
}
func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) {
localctx = NewSyntaxLitContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 4, ApiParserParserRULE_syntaxLit)
@@ -71,7 +77,7 @@ func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) {
}()
p.EnterOuterAlt(localctx, 1)
match(p, "syntax")
match(p,"syntax")
{
p.SetState(88)
@@ -95,9 +101,12 @@ func (p *ApiParserParser) SyntaxLit() (localctx ISyntaxLitContext) {
localctx.(*SyntaxLitContext).version = _m
}
return localctx
}
// IImportSpecContext is an interface to support dynamic dispatch.
type IImportSpecContext interface {
antlr.ParserRuleContext
@@ -164,6 +173,7 @@ func (s *ImportSpecContext) ToStringTree(ruleNames []string, recog antlr.Recogni
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *ImportSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case ApiParserVisitor:
@@ -174,6 +184,9 @@ func (s *ImportSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
}
}
func (p *ApiParserParser) ImportSpec() (localctx IImportSpecContext) {
localctx = NewImportSpecContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 6, ApiParserParserRULE_importSpec)
@@ -204,6 +217,7 @@ func (p *ApiParserParser) ImportSpec() (localctx IImportSpecContext) {
p.ImportLit()
}
case 2:
p.EnterOuterAlt(localctx, 2)
{
@@ -213,9 +227,11 @@ func (p *ApiParserParser) ImportSpec() (localctx IImportSpecContext) {
}
return localctx
}
// IImportLitContext is an interface to support dynamic dispatch.
type IImportLitContext interface {
antlr.ParserRuleContext
@@ -226,16 +242,18 @@ type IImportLitContext interface {
// GetImportToken returns the importToken token.
GetImportToken() antlr.Token
// SetImportToken sets the importToken token.
SetImportToken(antlr.Token)
// IsImportLitContext differentiates from other interfaces.
IsImportLitContext()
}
type ImportLitContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
parser antlr.Parser
importToken antlr.Token
}
@@ -263,8 +281,10 @@ func (s *ImportLitContext) GetParser() antlr.Parser { return s.parser }
func (s *ImportLitContext) GetImportToken() antlr.Token { return s.importToken }
func (s *ImportLitContext) SetImportToken(v antlr.Token) { s.importToken = v }
func (s *ImportLitContext) ImportValue() IImportValueContext {
var t = s.GetTypedRuleContext(reflect.TypeOf((*IImportValueContext)(nil)).Elem(), 0)
@@ -287,6 +307,7 @@ func (s *ImportLitContext) ToStringTree(ruleNames []string, recog antlr.Recogniz
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *ImportLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case ApiParserVisitor:
@@ -297,6 +318,9 @@ func (s *ImportLitContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
}
}
func (p *ApiParserParser) ImportLit() (localctx IImportLitContext) {
localctx = NewImportLitContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 8, ApiParserParserRULE_importLit)
@@ -318,7 +342,7 @@ func (p *ApiParserParser) ImportLit() (localctx IImportLitContext) {
}()
p.EnterOuterAlt(localctx, 1)
match(p, "import")
match(p,"import")
{
p.SetState(98)
@@ -331,9 +355,12 @@ func (p *ApiParserParser) ImportLit() (localctx IImportLitContext) {
p.ImportValue()
}
return localctx
}
// IImportBlockContext is an interface to support dynamic dispatch.
type IImportBlockContext interface {
antlr.ParserRuleContext
@@ -344,16 +371,18 @@ type IImportBlockContext interface {
// GetImportToken returns the importToken token.
GetImportToken() antlr.Token
// SetImportToken sets the importToken token.
SetImportToken(antlr.Token)
// IsImportBlockContext differentiates from other interfaces.
IsImportBlockContext()
}
type ImportBlockContext struct {
*antlr.BaseParserRuleContext
parser antlr.Parser
parser antlr.Parser
importToken antlr.Token
}
@@ -381,8 +410,10 @@ func (s *ImportBlockContext) GetParser() antlr.Parser { return s.parser }
func (s *ImportBlockContext) GetImportToken() antlr.Token { return s.importToken }
func (s *ImportBlockContext) SetImportToken(v antlr.Token) { s.importToken = v }
func (s *ImportBlockContext) ID() antlr.TerminalNode {
return s.GetToken(ApiParserParserID, 0)
}
@@ -418,6 +449,7 @@ func (s *ImportBlockContext) ToStringTree(ruleNames []string, recog antlr.Recogn
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *ImportBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case ApiParserVisitor:
@@ -428,11 +460,15 @@ func (s *ImportBlockContext) Accept(visitor antlr.ParseTreeVisitor) interface{}
}
}
func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) {
localctx = NewImportBlockContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 10, ApiParserParserRULE_importBlock)
var _la int
defer func() {
p.ExitRule()
}()
@@ -450,7 +486,7 @@ func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) {
}()
p.EnterOuterAlt(localctx, 1)
match(p, "import")
match(p,"import")
{
p.SetState(102)
@@ -471,6 +507,7 @@ func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) {
p.ImportBlockValue()
}
p.SetState(107)
p.GetErrorHandler().Sync(p)
_la = p.GetTokenStream().LA(1)
@@ -480,9 +517,12 @@ func (p *ApiParserParser) ImportBlock() (localctx IImportBlockContext) {
p.Match(ApiParserParserT__2)
}
return localctx
}
// IImportBlockValueContext is an interface to support dynamic dispatch.
type IImportBlockValueContext interface {
antlr.ParserRuleContext
@@ -539,6 +579,7 @@ func (s *ImportBlockValueContext) ToStringTree(ruleNames []string, recog antlr.R
return antlr.TreesStringTree(s, ruleNames, recog)
}
func (s *ImportBlockValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
switch t := visitor.(type) {
case ApiParserVisitor:
@@ -549,6 +590,9 @@ func (s *ImportBlockValueContext) Accept(visitor antlr.ParseTreeVisitor) interfa
}
}
func (p *ApiParserParser) ImportBlockValue() (localctx IImportBlockValueContext) {
localctx = NewImportBlockValueContext(p, p.GetParserRuleContext(), p.GetState())
p.EnterRule(localctx, 12, ApiParserParserRULE_importBlockValue)
@@ -575,9 +619,12 @@ func (p *ApiParserParser) ImportBlockValue() (localctx IImportBlockValueContext)
p.ImportValue()
}
return localctx
}
// IImportValueContext is an interface to support dynamic dispatch.
type IImportValueContext interface {
antlr.ParserRuleContext