* g4 code generation * Update grammar * g4 code generation * fix #2108 * fix #2102 * Remove comments
This commit is contained in:
@@ -10,276 +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.
|
||||
|
||||
// IArrayTypeContext is an interface to support dynamic dispatch.
|
||||
type IArrayTypeContext interface {
|
||||
antlr.ParserRuleContext
|
||||
|
||||
// GetParser returns the parser.
|
||||
GetParser() antlr.Parser
|
||||
|
||||
// GetLbrack returns the lbrack token.
|
||||
GetLbrack() antlr.Token
|
||||
|
||||
// GetRbrack returns the rbrack token.
|
||||
GetRbrack() antlr.Token
|
||||
|
||||
// SetLbrack sets the lbrack token.
|
||||
SetLbrack(antlr.Token)
|
||||
|
||||
// SetRbrack sets the rbrack token.
|
||||
SetRbrack(antlr.Token)
|
||||
|
||||
// IsArrayTypeContext differentiates from other interfaces.
|
||||
IsArrayTypeContext()
|
||||
}
|
||||
|
||||
type ArrayTypeContext struct {
|
||||
*antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
lbrack antlr.Token
|
||||
rbrack antlr.Token
|
||||
}
|
||||
|
||||
func NewEmptyArrayTypeContext() *ArrayTypeContext {
|
||||
p := new(ArrayTypeContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_arrayType
|
||||
return p
|
||||
}
|
||||
|
||||
func (*ArrayTypeContext) IsArrayTypeContext() {}
|
||||
|
||||
func NewArrayTypeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ArrayTypeContext {
|
||||
p := new(ArrayTypeContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
p.parser = parser
|
||||
p.RuleIndex = ApiParserParserRULE_arrayType
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (s *ArrayTypeContext) GetParser() antlr.Parser { return s.parser }
|
||||
|
||||
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 {
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*IDataTypeContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.(IDataTypeContext)
|
||||
}
|
||||
|
||||
func (s *ArrayTypeContext) GetRuleContext() antlr.RuleContext {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *ArrayTypeContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
func (s *ArrayTypeContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
return t.VisitArrayType(s)
|
||||
|
||||
default:
|
||||
return t.VisitChildren(s)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ApiParserParser) ArrayType() (localctx IArrayTypeContext) {
|
||||
localctx = NewArrayTypeContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 48, ApiParserParserRULE_arrayType)
|
||||
|
||||
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(233)
|
||||
|
||||
_m := p.Match(ApiParserParserT__7)
|
||||
|
||||
localctx.(*ArrayTypeContext).lbrack = _m
|
||||
}
|
||||
{
|
||||
p.SetState(234)
|
||||
|
||||
_m := p.Match(ApiParserParserT__8)
|
||||
|
||||
localctx.(*ArrayTypeContext).rbrack = _m
|
||||
}
|
||||
{
|
||||
p.SetState(235)
|
||||
p.DataType()
|
||||
}
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
// IServiceSpecContext is an interface to support dynamic dispatch.
|
||||
type IServiceSpecContext interface {
|
||||
antlr.ParserRuleContext
|
||||
|
||||
// GetParser returns the parser.
|
||||
GetParser() antlr.Parser
|
||||
|
||||
// IsServiceSpecContext differentiates from other interfaces.
|
||||
IsServiceSpecContext()
|
||||
}
|
||||
|
||||
type ServiceSpecContext struct {
|
||||
*antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
}
|
||||
|
||||
func NewEmptyServiceSpecContext() *ServiceSpecContext {
|
||||
p := new(ServiceSpecContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_serviceSpec
|
||||
return p
|
||||
}
|
||||
|
||||
func (*ServiceSpecContext) IsServiceSpecContext() {}
|
||||
|
||||
func NewServiceSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceSpecContext {
|
||||
p := new(ServiceSpecContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
p.parser = parser
|
||||
p.RuleIndex = ApiParserParserRULE_serviceSpec
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (s *ServiceSpecContext) GetParser() antlr.Parser { return s.parser }
|
||||
|
||||
func (s *ServiceSpecContext) ServiceApi() IServiceApiContext {
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceApiContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.(IServiceApiContext)
|
||||
}
|
||||
|
||||
func (s *ServiceSpecContext) AtServer() IAtServerContext {
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.(IAtServerContext)
|
||||
}
|
||||
|
||||
func (s *ServiceSpecContext) GetRuleContext() antlr.RuleContext {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *ServiceSpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
func (s *ServiceSpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
return t.VisitServiceSpec(s)
|
||||
|
||||
default:
|
||||
return t.VisitChildren(s)
|
||||
}
|
||||
}
|
||||
|
||||
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()
|
||||
}()
|
||||
|
||||
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(238)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
if _la == ApiParserParserATSERVER {
|
||||
{
|
||||
p.SetState(237)
|
||||
p.AtServer()
|
||||
}
|
||||
}
|
||||
{
|
||||
p.SetState(240)
|
||||
p.ServiceApi()
|
||||
}
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
// IAtServerContext is an interface to support dynamic dispatch.
|
||||
type IAtServerContext 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)
|
||||
|
||||
// IsAtServerContext differentiates from other interfaces.
|
||||
IsAtServerContext()
|
||||
}
|
||||
|
||||
type AtServerContext struct {
|
||||
*antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
@@ -288,7 +18,7 @@ type AtServerContext struct {
|
||||
}
|
||||
|
||||
func NewEmptyAtServerContext() *AtServerContext {
|
||||
p := new(AtServerContext)
|
||||
var p = new(AtServerContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_atServer
|
||||
return p
|
||||
@@ -297,7 +27,7 @@ func NewEmptyAtServerContext() *AtServerContext {
|
||||
func (*AtServerContext) IsAtServerContext() {}
|
||||
|
||||
func NewAtServerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtServerContext {
|
||||
p := new(AtServerContext)
|
||||
var p = new(AtServerContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
@@ -322,8 +52,8 @@ func (s *AtServerContext) ATSERVER() antlr.TerminalNode {
|
||||
}
|
||||
|
||||
func (s *AtServerContext) AllKvLit() []IKvLitContext {
|
||||
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
|
||||
tst := make([]IKvLitContext, len(ts))
|
||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
|
||||
var tst = make([]IKvLitContext, len(ts))
|
||||
|
||||
for i, t := range ts {
|
||||
if t != nil {
|
||||
@@ -335,7 +65,7 @@ func (s *AtServerContext) AllKvLit() []IKvLitContext {
|
||||
}
|
||||
|
||||
func (s *AtServerContext) KvLit(i int) IKvLitContext {
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
@@ -385,33 +115,34 @@ func (p *ApiParserParser) AtServer() (localctx IAtServerContext) {
|
||||
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
{
|
||||
p.SetState(242)
|
||||
p.SetState(244)
|
||||
p.Match(ApiParserParserATSERVER)
|
||||
}
|
||||
{
|
||||
p.SetState(243)
|
||||
p.SetState(245)
|
||||
|
||||
_m := p.Match(ApiParserParserT__1)
|
||||
var _m = p.Match(ApiParserParserT__1)
|
||||
|
||||
localctx.(*AtServerContext).lp = _m
|
||||
}
|
||||
p.SetState(245)
|
||||
p.SetState(247)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
for ok := true; ok; ok = _la == ApiParserParserID {
|
||||
{
|
||||
p.SetState(244)
|
||||
p.SetState(246)
|
||||
p.KvLit()
|
||||
}
|
||||
|
||||
p.SetState(247)
|
||||
p.SetState(249)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
}
|
||||
{
|
||||
p.SetState(249)
|
||||
p.SetState(251)
|
||||
|
||||
_m := p.Match(ApiParserParserT__2)
|
||||
var _m = p.Match(ApiParserParserT__2)
|
||||
|
||||
localctx.(*AtServerContext).rp = _m
|
||||
}
|
||||
@@ -457,7 +188,7 @@ type ServiceApiContext struct {
|
||||
}
|
||||
|
||||
func NewEmptyServiceApiContext() *ServiceApiContext {
|
||||
p := new(ServiceApiContext)
|
||||
var p = new(ServiceApiContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_serviceApi
|
||||
return p
|
||||
@@ -466,7 +197,7 @@ func NewEmptyServiceApiContext() *ServiceApiContext {
|
||||
func (*ServiceApiContext) IsServiceApiContext() {}
|
||||
|
||||
func NewServiceApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceApiContext {
|
||||
p := new(ServiceApiContext)
|
||||
var p = new(ServiceApiContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
@@ -491,7 +222,7 @@ 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 {
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceNameContext)(nil)).Elem(), 0)
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceNameContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
@@ -505,8 +236,8 @@ func (s *ServiceApiContext) ID() antlr.TerminalNode {
|
||||
}
|
||||
|
||||
func (s *ServiceApiContext) AllServiceRoute() []IServiceRouteContext {
|
||||
ts := s.GetTypedRuleContexts(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem())
|
||||
tst := make([]IServiceRouteContext, len(ts))
|
||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem())
|
||||
var tst = make([]IServiceRouteContext, len(ts))
|
||||
|
||||
for i, t := range ts {
|
||||
if t != nil {
|
||||
@@ -518,7 +249,7 @@ func (s *ServiceApiContext) AllServiceRoute() []IServiceRouteContext {
|
||||
}
|
||||
|
||||
func (s *ServiceApiContext) ServiceRoute(i int) IServiceRouteContext {
|
||||
t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem(), i)
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IServiceRouteContext)(nil)).Elem(), i)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
@@ -569,44 +300,396 @@ func (p *ApiParserParser) ServiceApi() (localctx IServiceApiContext) {
|
||||
p.EnterOuterAlt(localctx, 1)
|
||||
match(p, "service")
|
||||
{
|
||||
p.SetState(252)
|
||||
p.SetState(254)
|
||||
|
||||
_m := p.Match(ApiParserParserID)
|
||||
var _m = p.Match(ApiParserParserID)
|
||||
|
||||
localctx.(*ServiceApiContext).serviceToken = _m
|
||||
}
|
||||
{
|
||||
p.SetState(253)
|
||||
p.SetState(255)
|
||||
p.ServiceName()
|
||||
}
|
||||
{
|
||||
p.SetState(254)
|
||||
p.SetState(256)
|
||||
|
||||
_m := p.Match(ApiParserParserT__3)
|
||||
var _m = p.Match(ApiParserParserT__3)
|
||||
|
||||
localctx.(*ServiceApiContext).lbrace = _m
|
||||
}
|
||||
p.SetState(258)
|
||||
p.SetState(260)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
for ((_la)&-(0x1f+1)) == 0 && ((1<<uint(_la))&((1<<ApiParserParserATDOC)|(1<<ApiParserParserATHANDLER)|(1<<ApiParserParserATSERVER))) != 0 {
|
||||
{
|
||||
p.SetState(255)
|
||||
p.SetState(257)
|
||||
p.ServiceRoute()
|
||||
}
|
||||
|
||||
p.SetState(260)
|
||||
p.SetState(262)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
}
|
||||
{
|
||||
p.SetState(261)
|
||||
p.SetState(263)
|
||||
|
||||
_m := p.Match(ApiParserParserT__4)
|
||||
var _m = p.Match(ApiParserParserT__4)
|
||||
|
||||
localctx.(*ServiceApiContext).rbrace = _m
|
||||
}
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
// IServiceRouteContext is an interface to support dynamic dispatch.
|
||||
type IServiceRouteContext interface {
|
||||
antlr.ParserRuleContext
|
||||
|
||||
// GetParser returns the parser.
|
||||
GetParser() antlr.Parser
|
||||
|
||||
// IsServiceRouteContext differentiates from other interfaces.
|
||||
IsServiceRouteContext()
|
||||
}
|
||||
|
||||
type ServiceRouteContext struct {
|
||||
*antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
}
|
||||
|
||||
func NewEmptyServiceRouteContext() *ServiceRouteContext {
|
||||
var p = new(ServiceRouteContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_serviceRoute
|
||||
return p
|
||||
}
|
||||
|
||||
func (*ServiceRouteContext) IsServiceRouteContext() {}
|
||||
|
||||
func NewServiceRouteContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ServiceRouteContext {
|
||||
var p = new(ServiceRouteContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
p.parser = parser
|
||||
p.RuleIndex = ApiParserParserRULE_serviceRoute
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (s *ServiceRouteContext) GetParser() antlr.Parser { return s.parser }
|
||||
|
||||
func (s *ServiceRouteContext) Route() IRouteContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IRouteContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.(IRouteContext)
|
||||
}
|
||||
|
||||
func (s *ServiceRouteContext) AtServer() IAtServerContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtServerContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.(IAtServerContext)
|
||||
}
|
||||
|
||||
func (s *ServiceRouteContext) AtHandler() IAtHandlerContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtHandlerContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.(IAtHandlerContext)
|
||||
}
|
||||
|
||||
func (s *ServiceRouteContext) AtDoc() IAtDocContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IAtDocContext)(nil)).Elem(), 0)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.(IAtDocContext)
|
||||
}
|
||||
|
||||
func (s *ServiceRouteContext) GetRuleContext() antlr.RuleContext {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *ServiceRouteContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
func (s *ServiceRouteContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
return t.VisitServiceRoute(s)
|
||||
|
||||
default:
|
||||
return t.VisitChildren(s)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ApiParserParser) ServiceRoute() (localctx IServiceRouteContext) {
|
||||
localctx = NewServiceRouteContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 56, ApiParserParserRULE_serviceRoute)
|
||||
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(266)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
if _la == ApiParserParserATDOC {
|
||||
{
|
||||
p.SetState(265)
|
||||
p.AtDoc()
|
||||
}
|
||||
|
||||
}
|
||||
p.SetState(270)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
|
||||
switch p.GetTokenStream().LA(1) {
|
||||
case ApiParserParserATSERVER:
|
||||
{
|
||||
p.SetState(268)
|
||||
p.AtServer()
|
||||
}
|
||||
|
||||
case ApiParserParserATHANDLER:
|
||||
{
|
||||
p.SetState(269)
|
||||
p.AtHandler()
|
||||
}
|
||||
|
||||
default:
|
||||
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
|
||||
}
|
||||
{
|
||||
p.SetState(272)
|
||||
p.Route()
|
||||
}
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
// IAtDocContext is an interface to support dynamic dispatch.
|
||||
type IAtDocContext 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)
|
||||
|
||||
// IsAtDocContext differentiates from other interfaces.
|
||||
IsAtDocContext()
|
||||
}
|
||||
|
||||
type AtDocContext struct {
|
||||
*antlr.BaseParserRuleContext
|
||||
parser antlr.Parser
|
||||
lp antlr.Token
|
||||
rp antlr.Token
|
||||
}
|
||||
|
||||
func NewEmptyAtDocContext() *AtDocContext {
|
||||
var p = new(AtDocContext)
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
|
||||
p.RuleIndex = ApiParserParserRULE_atDoc
|
||||
return p
|
||||
}
|
||||
|
||||
func (*AtDocContext) IsAtDocContext() {}
|
||||
|
||||
func NewAtDocContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtDocContext {
|
||||
var p = new(AtDocContext)
|
||||
|
||||
p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
|
||||
|
||||
p.parser = parser
|
||||
p.RuleIndex = ApiParserParserRULE_atDoc
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (s *AtDocContext) GetParser() antlr.Parser { return s.parser }
|
||||
|
||||
func (s *AtDocContext) GetLp() antlr.Token { return s.lp }
|
||||
|
||||
func (s *AtDocContext) GetRp() antlr.Token { return s.rp }
|
||||
|
||||
func (s *AtDocContext) SetLp(v antlr.Token) { s.lp = v }
|
||||
|
||||
func (s *AtDocContext) SetRp(v antlr.Token) { s.rp = v }
|
||||
|
||||
func (s *AtDocContext) ATDOC() antlr.TerminalNode {
|
||||
return s.GetToken(ApiParserParserATDOC, 0)
|
||||
}
|
||||
|
||||
func (s *AtDocContext) STRING() antlr.TerminalNode {
|
||||
return s.GetToken(ApiParserParserSTRING, 0)
|
||||
}
|
||||
|
||||
func (s *AtDocContext) AllKvLit() []IKvLitContext {
|
||||
var ts = s.GetTypedRuleContexts(reflect.TypeOf((*IKvLitContext)(nil)).Elem())
|
||||
var tst = make([]IKvLitContext, len(ts))
|
||||
|
||||
for i, t := range ts {
|
||||
if t != nil {
|
||||
tst[i] = t.(IKvLitContext)
|
||||
}
|
||||
}
|
||||
|
||||
return tst
|
||||
}
|
||||
|
||||
func (s *AtDocContext) KvLit(i int) IKvLitContext {
|
||||
var t = s.GetTypedRuleContext(reflect.TypeOf((*IKvLitContext)(nil)).Elem(), i)
|
||||
|
||||
if t == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return t.(IKvLitContext)
|
||||
}
|
||||
|
||||
func (s *AtDocContext) GetRuleContext() antlr.RuleContext {
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *AtDocContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
||||
return antlr.TreesStringTree(s, ruleNames, recog)
|
||||
}
|
||||
|
||||
func (s *AtDocContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
switch t := visitor.(type) {
|
||||
case ApiParserVisitor:
|
||||
return t.VisitAtDoc(s)
|
||||
|
||||
default:
|
||||
return t.VisitChildren(s)
|
||||
}
|
||||
}
|
||||
|
||||
func (p *ApiParserParser) AtDoc() (localctx IAtDocContext) {
|
||||
localctx = NewAtDocContext(p, p.GetParserRuleContext(), p.GetState())
|
||||
p.EnterRule(localctx, 58, ApiParserParserRULE_atDoc)
|
||||
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(274)
|
||||
p.Match(ApiParserParserATDOC)
|
||||
}
|
||||
p.SetState(276)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
if _la == ApiParserParserT__1 {
|
||||
{
|
||||
p.SetState(275)
|
||||
|
||||
var _m = p.Match(ApiParserParserT__1)
|
||||
|
||||
localctx.(*AtDocContext).lp = _m
|
||||
}
|
||||
|
||||
}
|
||||
p.SetState(284)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
|
||||
switch p.GetTokenStream().LA(1) {
|
||||
case ApiParserParserID:
|
||||
p.SetState(279)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
for ok := true; ok; ok = _la == ApiParserParserID {
|
||||
{
|
||||
p.SetState(278)
|
||||
p.KvLit()
|
||||
}
|
||||
|
||||
p.SetState(281)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
}
|
||||
|
||||
case ApiParserParserSTRING:
|
||||
{
|
||||
p.SetState(283)
|
||||
p.Match(ApiParserParserSTRING)
|
||||
}
|
||||
|
||||
default:
|
||||
panic(antlr.NewNoViableAltException(p, nil, nil, nil, nil, nil))
|
||||
}
|
||||
p.SetState(287)
|
||||
p.GetErrorHandler().Sync(p)
|
||||
_la = p.GetTokenStream().LA(1)
|
||||
|
||||
if _la == ApiParserParserT__2 {
|
||||
{
|
||||
p.SetState(286)
|
||||
|
||||
var _m = p.Match(ApiParserParserT__2)
|
||||
|
||||
localctx.(*AtDocContext).rp = _m
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return localctx
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user