mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-19 07:25:27 +02:00
1073 lines
26 KiB
Go
1073 lines
26 KiB
Go
// Code generated from Config.g4 by ANTLR 4.13.0. DO NOT EDIT.
|
|
|
|
package parser // Config
|
|
|
|
import (
|
|
"fmt"
|
|
"strconv"
|
|
"sync"
|
|
|
|
"github.com/antlr4-go/antlr/v4"
|
|
)
|
|
|
|
// Suppress unused import errors
|
|
var _ = fmt.Printf
|
|
var _ = strconv.Itoa
|
|
var _ = sync.Once{}
|
|
|
|
type ConfigParser struct {
|
|
*antlr.BaseParser
|
|
}
|
|
|
|
var ConfigParserStaticData struct {
|
|
once sync.Once
|
|
serializedATN []int32
|
|
LiteralNames []string
|
|
SymbolicNames []string
|
|
RuleNames []string
|
|
PredictionContextCache *antlr.PredictionContextCache
|
|
atn *antlr.ATN
|
|
decisionToDFA []*antlr.DFA
|
|
}
|
|
|
|
func configParserInit() {
|
|
staticData := &ConfigParserStaticData
|
|
staticData.LiteralNames = []string{
|
|
"", "'#'",
|
|
}
|
|
staticData.SymbolicNames = []string{
|
|
"", "HASH", "WHITESPACE", "STRING", "NEWLINE",
|
|
}
|
|
staticData.RuleNames = []string{
|
|
"lineStatement", "entry", "separator", "key", "value", "leadingComment",
|
|
}
|
|
staticData.PredictionContextCache = antlr.NewPredictionContextCache()
|
|
staticData.serializedATN = []int32{
|
|
4, 1, 4, 65, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4,
|
|
2, 5, 7, 5, 1, 0, 1, 0, 3, 0, 15, 8, 0, 1, 0, 1, 0, 3, 0, 19, 8, 0, 3,
|
|
0, 21, 8, 0, 1, 0, 1, 0, 1, 1, 3, 1, 26, 8, 1, 1, 1, 3, 1, 29, 8, 1, 1,
|
|
1, 3, 1, 32, 8, 1, 1, 1, 3, 1, 35, 8, 1, 1, 1, 3, 1, 38, 8, 1, 1, 1, 3,
|
|
1, 41, 8, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 3, 4, 49, 8, 4, 1, 4,
|
|
1, 4, 1, 5, 1, 5, 3, 5, 55, 8, 5, 1, 5, 1, 5, 3, 5, 59, 8, 5, 4, 5, 61,
|
|
8, 5, 11, 5, 12, 5, 62, 1, 5, 0, 0, 6, 0, 2, 4, 6, 8, 10, 0, 0, 72, 0,
|
|
20, 1, 0, 0, 0, 2, 25, 1, 0, 0, 0, 4, 42, 1, 0, 0, 0, 6, 44, 1, 0, 0, 0,
|
|
8, 48, 1, 0, 0, 0, 10, 52, 1, 0, 0, 0, 12, 21, 3, 2, 1, 0, 13, 15, 5, 2,
|
|
0, 0, 14, 13, 1, 0, 0, 0, 14, 15, 1, 0, 0, 0, 15, 16, 1, 0, 0, 0, 16, 21,
|
|
3, 10, 5, 0, 17, 19, 5, 2, 0, 0, 18, 17, 1, 0, 0, 0, 18, 19, 1, 0, 0, 0,
|
|
19, 21, 1, 0, 0, 0, 20, 12, 1, 0, 0, 0, 20, 14, 1, 0, 0, 0, 20, 18, 1,
|
|
0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 23, 5, 0, 0, 1, 23, 1, 1, 0, 0, 0, 24,
|
|
26, 5, 2, 0, 0, 25, 24, 1, 0, 0, 0, 25, 26, 1, 0, 0, 0, 26, 28, 1, 0, 0,
|
|
0, 27, 29, 3, 6, 3, 0, 28, 27, 1, 0, 0, 0, 28, 29, 1, 0, 0, 0, 29, 31,
|
|
1, 0, 0, 0, 30, 32, 3, 4, 2, 0, 31, 30, 1, 0, 0, 0, 31, 32, 1, 0, 0, 0,
|
|
32, 34, 1, 0, 0, 0, 33, 35, 3, 8, 4, 0, 34, 33, 1, 0, 0, 0, 34, 35, 1,
|
|
0, 0, 0, 35, 37, 1, 0, 0, 0, 36, 38, 5, 2, 0, 0, 37, 36, 1, 0, 0, 0, 37,
|
|
38, 1, 0, 0, 0, 38, 40, 1, 0, 0, 0, 39, 41, 3, 10, 5, 0, 40, 39, 1, 0,
|
|
0, 0, 40, 41, 1, 0, 0, 0, 41, 3, 1, 0, 0, 0, 42, 43, 5, 2, 0, 0, 43, 5,
|
|
1, 0, 0, 0, 44, 45, 5, 3, 0, 0, 45, 7, 1, 0, 0, 0, 46, 47, 5, 3, 0, 0,
|
|
47, 49, 5, 2, 0, 0, 48, 46, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 50, 1,
|
|
0, 0, 0, 50, 51, 5, 3, 0, 0, 51, 9, 1, 0, 0, 0, 52, 54, 5, 1, 0, 0, 53,
|
|
55, 5, 2, 0, 0, 54, 53, 1, 0, 0, 0, 54, 55, 1, 0, 0, 0, 55, 60, 1, 0, 0,
|
|
0, 56, 58, 5, 3, 0, 0, 57, 59, 5, 2, 0, 0, 58, 57, 1, 0, 0, 0, 58, 59,
|
|
1, 0, 0, 0, 59, 61, 1, 0, 0, 0, 60, 56, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0,
|
|
62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 11, 1, 0, 0, 0, 13, 14, 18,
|
|
20, 25, 28, 31, 34, 37, 40, 48, 54, 58, 62,
|
|
}
|
|
deserializer := antlr.NewATNDeserializer(nil)
|
|
staticData.atn = deserializer.Deserialize(staticData.serializedATN)
|
|
atn := staticData.atn
|
|
staticData.decisionToDFA = make([]*antlr.DFA, len(atn.DecisionToState))
|
|
decisionToDFA := staticData.decisionToDFA
|
|
for index, state := range atn.DecisionToState {
|
|
decisionToDFA[index] = antlr.NewDFA(state, index)
|
|
}
|
|
}
|
|
|
|
// ConfigParserInit initializes any static state used to implement ConfigParser. By default the
|
|
// static state used to implement the parser is lazily initialized during the first call to
|
|
// NewConfigParser(). You can call this function if you wish to initialize the static state ahead
|
|
// of time.
|
|
func ConfigParserInit() {
|
|
staticData := &ConfigParserStaticData
|
|
staticData.once.Do(configParserInit)
|
|
}
|
|
|
|
// NewConfigParser produces a new parser instance for the optional input antlr.TokenStream.
|
|
func NewConfigParser(input antlr.TokenStream) *ConfigParser {
|
|
ConfigParserInit()
|
|
this := new(ConfigParser)
|
|
this.BaseParser = antlr.NewBaseParser(input)
|
|
staticData := &ConfigParserStaticData
|
|
this.Interpreter = antlr.NewParserATNSimulator(this, staticData.atn, staticData.decisionToDFA, staticData.PredictionContextCache)
|
|
this.RuleNames = staticData.RuleNames
|
|
this.LiteralNames = staticData.LiteralNames
|
|
this.SymbolicNames = staticData.SymbolicNames
|
|
this.GrammarFileName = "Config.g4"
|
|
|
|
return this
|
|
}
|
|
|
|
// ConfigParser tokens.
|
|
const (
|
|
ConfigParserEOF = antlr.TokenEOF
|
|
ConfigParserHASH = 1
|
|
ConfigParserWHITESPACE = 2
|
|
ConfigParserSTRING = 3
|
|
ConfigParserNEWLINE = 4
|
|
)
|
|
|
|
// ConfigParser rules.
|
|
const (
|
|
ConfigParserRULE_lineStatement = 0
|
|
ConfigParserRULE_entry = 1
|
|
ConfigParserRULE_separator = 2
|
|
ConfigParserRULE_key = 3
|
|
ConfigParserRULE_value = 4
|
|
ConfigParserRULE_leadingComment = 5
|
|
)
|
|
|
|
// ILineStatementContext is an interface to support dynamic dispatch.
|
|
type ILineStatementContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// Getter signatures
|
|
EOF() antlr.TerminalNode
|
|
Entry() IEntryContext
|
|
LeadingComment() ILeadingCommentContext
|
|
WHITESPACE() antlr.TerminalNode
|
|
|
|
// IsLineStatementContext differentiates from other interfaces.
|
|
IsLineStatementContext()
|
|
}
|
|
|
|
type LineStatementContext struct {
|
|
antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyLineStatementContext() *LineStatementContext {
|
|
var p = new(LineStatementContext)
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_lineStatement
|
|
return p
|
|
}
|
|
|
|
func InitEmptyLineStatementContext(p *LineStatementContext) {
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_lineStatement
|
|
}
|
|
|
|
func (*LineStatementContext) IsLineStatementContext() {}
|
|
|
|
func NewLineStatementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LineStatementContext {
|
|
var p = new(LineStatementContext)
|
|
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = ConfigParserRULE_lineStatement
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *LineStatementContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *LineStatementContext) EOF() antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserEOF, 0)
|
|
}
|
|
|
|
func (s *LineStatementContext) Entry() IEntryContext {
|
|
var t antlr.RuleContext
|
|
for _, ctx := range s.GetChildren() {
|
|
if _, ok := ctx.(IEntryContext); ok {
|
|
t = ctx.(antlr.RuleContext)
|
|
break
|
|
}
|
|
}
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IEntryContext)
|
|
}
|
|
|
|
func (s *LineStatementContext) LeadingComment() ILeadingCommentContext {
|
|
var t antlr.RuleContext
|
|
for _, ctx := range s.GetChildren() {
|
|
if _, ok := ctx.(ILeadingCommentContext); ok {
|
|
t = ctx.(antlr.RuleContext)
|
|
break
|
|
}
|
|
}
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(ILeadingCommentContext)
|
|
}
|
|
|
|
func (s *LineStatementContext) WHITESPACE() antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserWHITESPACE, 0)
|
|
}
|
|
|
|
func (s *LineStatementContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *LineStatementContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *LineStatementContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.EnterLineStatement(s)
|
|
}
|
|
}
|
|
|
|
func (s *LineStatementContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.ExitLineStatement(s)
|
|
}
|
|
}
|
|
|
|
func (p *ConfigParser) LineStatement() (localctx ILineStatementContext) {
|
|
localctx = NewLineStatementContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 0, ConfigParserRULE_lineStatement)
|
|
var _la int
|
|
|
|
p.EnterOuterAlt(localctx, 1)
|
|
p.SetState(20)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
|
|
switch p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 2, p.GetParserRuleContext()) {
|
|
case 1:
|
|
{
|
|
p.SetState(12)
|
|
p.Entry()
|
|
}
|
|
|
|
case 2:
|
|
p.SetState(14)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ConfigParserWHITESPACE {
|
|
{
|
|
p.SetState(13)
|
|
p.Match(ConfigParserWHITESPACE)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
}
|
|
{
|
|
p.SetState(16)
|
|
p.LeadingComment()
|
|
}
|
|
|
|
case 3:
|
|
p.SetState(18)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ConfigParserWHITESPACE {
|
|
{
|
|
p.SetState(17)
|
|
p.Match(ConfigParserWHITESPACE)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
case antlr.ATNInvalidAltNumber:
|
|
goto errorExit
|
|
}
|
|
{
|
|
p.SetState(22)
|
|
p.Match(ConfigParserEOF)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
errorExit:
|
|
if p.HasError() {
|
|
v := p.GetError()
|
|
localctx.SetException(v)
|
|
p.GetErrorHandler().ReportError(p, v)
|
|
p.GetErrorHandler().Recover(p, v)
|
|
p.SetError(nil)
|
|
}
|
|
p.ExitRule()
|
|
return localctx
|
|
goto errorExit // Trick to prevent compiler error if the label is not used
|
|
}
|
|
|
|
// IEntryContext is an interface to support dynamic dispatch.
|
|
type IEntryContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// Getter signatures
|
|
AllWHITESPACE() []antlr.TerminalNode
|
|
WHITESPACE(i int) antlr.TerminalNode
|
|
Key() IKeyContext
|
|
Separator() ISeparatorContext
|
|
Value() IValueContext
|
|
LeadingComment() ILeadingCommentContext
|
|
|
|
// IsEntryContext differentiates from other interfaces.
|
|
IsEntryContext()
|
|
}
|
|
|
|
type EntryContext struct {
|
|
antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyEntryContext() *EntryContext {
|
|
var p = new(EntryContext)
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_entry
|
|
return p
|
|
}
|
|
|
|
func InitEmptyEntryContext(p *EntryContext) {
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_entry
|
|
}
|
|
|
|
func (*EntryContext) IsEntryContext() {}
|
|
|
|
func NewEntryContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EntryContext {
|
|
var p = new(EntryContext)
|
|
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = ConfigParserRULE_entry
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *EntryContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *EntryContext) AllWHITESPACE() []antlr.TerminalNode {
|
|
return s.GetTokens(ConfigParserWHITESPACE)
|
|
}
|
|
|
|
func (s *EntryContext) WHITESPACE(i int) antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserWHITESPACE, i)
|
|
}
|
|
|
|
func (s *EntryContext) Key() IKeyContext {
|
|
var t antlr.RuleContext
|
|
for _, ctx := range s.GetChildren() {
|
|
if _, ok := ctx.(IKeyContext); ok {
|
|
t = ctx.(antlr.RuleContext)
|
|
break
|
|
}
|
|
}
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IKeyContext)
|
|
}
|
|
|
|
func (s *EntryContext) Separator() ISeparatorContext {
|
|
var t antlr.RuleContext
|
|
for _, ctx := range s.GetChildren() {
|
|
if _, ok := ctx.(ISeparatorContext); ok {
|
|
t = ctx.(antlr.RuleContext)
|
|
break
|
|
}
|
|
}
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(ISeparatorContext)
|
|
}
|
|
|
|
func (s *EntryContext) Value() IValueContext {
|
|
var t antlr.RuleContext
|
|
for _, ctx := range s.GetChildren() {
|
|
if _, ok := ctx.(IValueContext); ok {
|
|
t = ctx.(antlr.RuleContext)
|
|
break
|
|
}
|
|
}
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(IValueContext)
|
|
}
|
|
|
|
func (s *EntryContext) LeadingComment() ILeadingCommentContext {
|
|
var t antlr.RuleContext
|
|
for _, ctx := range s.GetChildren() {
|
|
if _, ok := ctx.(ILeadingCommentContext); ok {
|
|
t = ctx.(antlr.RuleContext)
|
|
break
|
|
}
|
|
}
|
|
|
|
if t == nil {
|
|
return nil
|
|
}
|
|
|
|
return t.(ILeadingCommentContext)
|
|
}
|
|
|
|
func (s *EntryContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *EntryContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *EntryContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.EnterEntry(s)
|
|
}
|
|
}
|
|
|
|
func (s *EntryContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.ExitEntry(s)
|
|
}
|
|
}
|
|
|
|
func (p *ConfigParser) Entry() (localctx IEntryContext) {
|
|
localctx = NewEntryContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 2, ConfigParserRULE_entry)
|
|
var _la int
|
|
|
|
p.EnterOuterAlt(localctx, 1)
|
|
p.SetState(25)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 3, p.GetParserRuleContext()) == 1 {
|
|
{
|
|
p.SetState(24)
|
|
p.Match(ConfigParserWHITESPACE)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
} else if p.HasError() { // JIM
|
|
goto errorExit
|
|
}
|
|
p.SetState(28)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 4, p.GetParserRuleContext()) == 1 {
|
|
{
|
|
p.SetState(27)
|
|
p.Key()
|
|
}
|
|
|
|
} else if p.HasError() { // JIM
|
|
goto errorExit
|
|
}
|
|
p.SetState(31)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 5, p.GetParserRuleContext()) == 1 {
|
|
{
|
|
p.SetState(30)
|
|
p.Separator()
|
|
}
|
|
|
|
} else if p.HasError() { // JIM
|
|
goto errorExit
|
|
}
|
|
p.SetState(34)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ConfigParserSTRING {
|
|
{
|
|
p.SetState(33)
|
|
p.Value()
|
|
}
|
|
|
|
}
|
|
p.SetState(37)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ConfigParserWHITESPACE {
|
|
{
|
|
p.SetState(36)
|
|
p.Match(ConfigParserWHITESPACE)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
}
|
|
p.SetState(40)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ConfigParserHASH {
|
|
{
|
|
p.SetState(39)
|
|
p.LeadingComment()
|
|
}
|
|
|
|
}
|
|
|
|
errorExit:
|
|
if p.HasError() {
|
|
v := p.GetError()
|
|
localctx.SetException(v)
|
|
p.GetErrorHandler().ReportError(p, v)
|
|
p.GetErrorHandler().Recover(p, v)
|
|
p.SetError(nil)
|
|
}
|
|
p.ExitRule()
|
|
return localctx
|
|
goto errorExit // Trick to prevent compiler error if the label is not used
|
|
}
|
|
|
|
// ISeparatorContext is an interface to support dynamic dispatch.
|
|
type ISeparatorContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// Getter signatures
|
|
WHITESPACE() antlr.TerminalNode
|
|
|
|
// IsSeparatorContext differentiates from other interfaces.
|
|
IsSeparatorContext()
|
|
}
|
|
|
|
type SeparatorContext struct {
|
|
antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptySeparatorContext() *SeparatorContext {
|
|
var p = new(SeparatorContext)
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_separator
|
|
return p
|
|
}
|
|
|
|
func InitEmptySeparatorContext(p *SeparatorContext) {
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_separator
|
|
}
|
|
|
|
func (*SeparatorContext) IsSeparatorContext() {}
|
|
|
|
func NewSeparatorContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SeparatorContext {
|
|
var p = new(SeparatorContext)
|
|
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = ConfigParserRULE_separator
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *SeparatorContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *SeparatorContext) WHITESPACE() antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserWHITESPACE, 0)
|
|
}
|
|
|
|
func (s *SeparatorContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *SeparatorContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *SeparatorContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.EnterSeparator(s)
|
|
}
|
|
}
|
|
|
|
func (s *SeparatorContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.ExitSeparator(s)
|
|
}
|
|
}
|
|
|
|
func (p *ConfigParser) Separator() (localctx ISeparatorContext) {
|
|
localctx = NewSeparatorContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 4, ConfigParserRULE_separator)
|
|
p.EnterOuterAlt(localctx, 1)
|
|
{
|
|
p.SetState(42)
|
|
p.Match(ConfigParserWHITESPACE)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
errorExit:
|
|
if p.HasError() {
|
|
v := p.GetError()
|
|
localctx.SetException(v)
|
|
p.GetErrorHandler().ReportError(p, v)
|
|
p.GetErrorHandler().Recover(p, v)
|
|
p.SetError(nil)
|
|
}
|
|
p.ExitRule()
|
|
return localctx
|
|
goto errorExit // Trick to prevent compiler error if the label is not used
|
|
}
|
|
|
|
// IKeyContext is an interface to support dynamic dispatch.
|
|
type IKeyContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// Getter signatures
|
|
STRING() antlr.TerminalNode
|
|
|
|
// IsKeyContext differentiates from other interfaces.
|
|
IsKeyContext()
|
|
}
|
|
|
|
type KeyContext struct {
|
|
antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyKeyContext() *KeyContext {
|
|
var p = new(KeyContext)
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_key
|
|
return p
|
|
}
|
|
|
|
func InitEmptyKeyContext(p *KeyContext) {
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_key
|
|
}
|
|
|
|
func (*KeyContext) IsKeyContext() {}
|
|
|
|
func NewKeyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KeyContext {
|
|
var p = new(KeyContext)
|
|
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = ConfigParserRULE_key
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *KeyContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *KeyContext) STRING() antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserSTRING, 0)
|
|
}
|
|
|
|
func (s *KeyContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *KeyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *KeyContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.EnterKey(s)
|
|
}
|
|
}
|
|
|
|
func (s *KeyContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.ExitKey(s)
|
|
}
|
|
}
|
|
|
|
func (p *ConfigParser) Key() (localctx IKeyContext) {
|
|
localctx = NewKeyContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 6, ConfigParserRULE_key)
|
|
p.EnterOuterAlt(localctx, 1)
|
|
{
|
|
p.SetState(44)
|
|
p.Match(ConfigParserSTRING)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
errorExit:
|
|
if p.HasError() {
|
|
v := p.GetError()
|
|
localctx.SetException(v)
|
|
p.GetErrorHandler().ReportError(p, v)
|
|
p.GetErrorHandler().Recover(p, v)
|
|
p.SetError(nil)
|
|
}
|
|
p.ExitRule()
|
|
return localctx
|
|
goto errorExit // Trick to prevent compiler error if the label is not used
|
|
}
|
|
|
|
// IValueContext is an interface to support dynamic dispatch.
|
|
type IValueContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// Getter signatures
|
|
AllSTRING() []antlr.TerminalNode
|
|
STRING(i int) antlr.TerminalNode
|
|
WHITESPACE() antlr.TerminalNode
|
|
|
|
// IsValueContext differentiates from other interfaces.
|
|
IsValueContext()
|
|
}
|
|
|
|
type ValueContext struct {
|
|
antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyValueContext() *ValueContext {
|
|
var p = new(ValueContext)
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_value
|
|
return p
|
|
}
|
|
|
|
func InitEmptyValueContext(p *ValueContext) {
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_value
|
|
}
|
|
|
|
func (*ValueContext) IsValueContext() {}
|
|
|
|
func NewValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ValueContext {
|
|
var p = new(ValueContext)
|
|
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = ConfigParserRULE_value
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *ValueContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *ValueContext) AllSTRING() []antlr.TerminalNode {
|
|
return s.GetTokens(ConfigParserSTRING)
|
|
}
|
|
|
|
func (s *ValueContext) STRING(i int) antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserSTRING, i)
|
|
}
|
|
|
|
func (s *ValueContext) WHITESPACE() antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserWHITESPACE, 0)
|
|
}
|
|
|
|
func (s *ValueContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *ValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *ValueContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.EnterValue(s)
|
|
}
|
|
}
|
|
|
|
func (s *ValueContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.ExitValue(s)
|
|
}
|
|
}
|
|
|
|
func (p *ConfigParser) Value() (localctx IValueContext) {
|
|
localctx = NewValueContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 8, ConfigParserRULE_value)
|
|
p.EnterOuterAlt(localctx, 1)
|
|
p.SetState(48)
|
|
p.GetErrorHandler().Sync(p)
|
|
|
|
if p.GetInterpreter().AdaptivePredict(p.BaseParser, p.GetTokenStream(), 9, p.GetParserRuleContext()) == 1 {
|
|
{
|
|
p.SetState(46)
|
|
p.Match(ConfigParserSTRING)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
{
|
|
p.SetState(47)
|
|
p.Match(ConfigParserWHITESPACE)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
} else if p.HasError() { // JIM
|
|
goto errorExit
|
|
}
|
|
{
|
|
p.SetState(50)
|
|
p.Match(ConfigParserSTRING)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
errorExit:
|
|
if p.HasError() {
|
|
v := p.GetError()
|
|
localctx.SetException(v)
|
|
p.GetErrorHandler().ReportError(p, v)
|
|
p.GetErrorHandler().Recover(p, v)
|
|
p.SetError(nil)
|
|
}
|
|
p.ExitRule()
|
|
return localctx
|
|
goto errorExit // Trick to prevent compiler error if the label is not used
|
|
}
|
|
|
|
// ILeadingCommentContext is an interface to support dynamic dispatch.
|
|
type ILeadingCommentContext interface {
|
|
antlr.ParserRuleContext
|
|
|
|
// GetParser returns the parser.
|
|
GetParser() antlr.Parser
|
|
|
|
// Getter signatures
|
|
HASH() antlr.TerminalNode
|
|
AllWHITESPACE() []antlr.TerminalNode
|
|
WHITESPACE(i int) antlr.TerminalNode
|
|
AllSTRING() []antlr.TerminalNode
|
|
STRING(i int) antlr.TerminalNode
|
|
|
|
// IsLeadingCommentContext differentiates from other interfaces.
|
|
IsLeadingCommentContext()
|
|
}
|
|
|
|
type LeadingCommentContext struct {
|
|
antlr.BaseParserRuleContext
|
|
parser antlr.Parser
|
|
}
|
|
|
|
func NewEmptyLeadingCommentContext() *LeadingCommentContext {
|
|
var p = new(LeadingCommentContext)
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_leadingComment
|
|
return p
|
|
}
|
|
|
|
func InitEmptyLeadingCommentContext(p *LeadingCommentContext) {
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, nil, -1)
|
|
p.RuleIndex = ConfigParserRULE_leadingComment
|
|
}
|
|
|
|
func (*LeadingCommentContext) IsLeadingCommentContext() {}
|
|
|
|
func NewLeadingCommentContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *LeadingCommentContext {
|
|
var p = new(LeadingCommentContext)
|
|
|
|
antlr.InitBaseParserRuleContext(&p.BaseParserRuleContext, parent, invokingState)
|
|
|
|
p.parser = parser
|
|
p.RuleIndex = ConfigParserRULE_leadingComment
|
|
|
|
return p
|
|
}
|
|
|
|
func (s *LeadingCommentContext) GetParser() antlr.Parser { return s.parser }
|
|
|
|
func (s *LeadingCommentContext) HASH() antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserHASH, 0)
|
|
}
|
|
|
|
func (s *LeadingCommentContext) AllWHITESPACE() []antlr.TerminalNode {
|
|
return s.GetTokens(ConfigParserWHITESPACE)
|
|
}
|
|
|
|
func (s *LeadingCommentContext) WHITESPACE(i int) antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserWHITESPACE, i)
|
|
}
|
|
|
|
func (s *LeadingCommentContext) AllSTRING() []antlr.TerminalNode {
|
|
return s.GetTokens(ConfigParserSTRING)
|
|
}
|
|
|
|
func (s *LeadingCommentContext) STRING(i int) antlr.TerminalNode {
|
|
return s.GetToken(ConfigParserSTRING, i)
|
|
}
|
|
|
|
func (s *LeadingCommentContext) GetRuleContext() antlr.RuleContext {
|
|
return s
|
|
}
|
|
|
|
func (s *LeadingCommentContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
|
|
return antlr.TreesStringTree(s, ruleNames, recog)
|
|
}
|
|
|
|
func (s *LeadingCommentContext) EnterRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.EnterLeadingComment(s)
|
|
}
|
|
}
|
|
|
|
func (s *LeadingCommentContext) ExitRule(listener antlr.ParseTreeListener) {
|
|
if listenerT, ok := listener.(ConfigListener); ok {
|
|
listenerT.ExitLeadingComment(s)
|
|
}
|
|
}
|
|
|
|
func (p *ConfigParser) LeadingComment() (localctx ILeadingCommentContext) {
|
|
localctx = NewLeadingCommentContext(p, p.GetParserRuleContext(), p.GetState())
|
|
p.EnterRule(localctx, 10, ConfigParserRULE_leadingComment)
|
|
var _la int
|
|
|
|
p.EnterOuterAlt(localctx, 1)
|
|
{
|
|
p.SetState(52)
|
|
p.Match(ConfigParserHASH)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
p.SetState(54)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ConfigParserWHITESPACE {
|
|
{
|
|
p.SetState(53)
|
|
p.Match(ConfigParserWHITESPACE)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
}
|
|
p.SetState(60)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
for ok := true; ok; ok = _la == ConfigParserSTRING {
|
|
{
|
|
p.SetState(56)
|
|
p.Match(ConfigParserSTRING)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
p.SetState(58)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
_la = p.GetTokenStream().LA(1)
|
|
|
|
if _la == ConfigParserWHITESPACE {
|
|
{
|
|
p.SetState(57)
|
|
p.Match(ConfigParserWHITESPACE)
|
|
if p.HasError() {
|
|
// Recognition error - abort rule
|
|
goto errorExit
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
p.SetState(62)
|
|
p.GetErrorHandler().Sync(p)
|
|
if p.HasError() {
|
|
goto errorExit
|
|
}
|
|
_la = p.GetTokenStream().LA(1)
|
|
}
|
|
|
|
errorExit:
|
|
if p.HasError() {
|
|
v := p.GetError()
|
|
localctx.SetException(v)
|
|
p.GetErrorHandler().ReportError(p, v)
|
|
p.GetErrorHandler().Recover(p, v)
|
|
p.SetError(nil)
|
|
}
|
|
p.ExitRule()
|
|
return localctx
|
|
goto errorExit // Trick to prevent compiler error if the label is not used
|
|
}
|