type Parser … type BaseParser … // NewBaseParser contains all the parsing support code to embed in parsers. Essentially most of it is error // recovery stuff. // //goland:noinspection GoUnusedExportedFunction func NewBaseParser(input TokenStream) *BaseParser { … } var bypassAltsAtnCache … // reset the parser's state// func (p *BaseParser) reset() { … } func (p *BaseParser) GetErrorHandler() ErrorStrategy { … } func (p *BaseParser) SetErrorHandler(e ErrorStrategy) { … } func (p *BaseParser) Match(ttype int) Token { … } func (p *BaseParser) MatchWildcard() Token { … } func (p *BaseParser) GetParserRuleContext() ParserRuleContext { … } func (p *BaseParser) SetParserRuleContext(v ParserRuleContext) { … } func (p *BaseParser) GetParseListeners() []ParseTreeListener { … } // AddParseListener registers listener to receive events during the parsing process. // // To support output-preserving grammar transformations (including but not // limited to left-recursion removal, automated left-factoring, and // optimized code generation), calls to listener methods during the parse // may differ substantially from calls made by // [ParseTreeWalker.DEFAULT] used after the parse is complete. In // particular, rule entry and exit events may occur in a different order // during the parse than after the parser. In addition, calls to certain // rule entry methods may be omitted. // // With the following specific exceptions, calls to listener events are // deterministic, i.e. for identical input the calls to listener // methods will be the same. // // - Alterations to the grammar used to generate code may change the // behavior of the listener calls. // - Alterations to the command line options passed to ANTLR 4 when // generating the parser may change the behavior of the listener calls. // - Changing the version of the ANTLR Tool used to generate the parser // may change the behavior of the listener calls. func (p *BaseParser) AddParseListener(listener ParseTreeListener) { … } // RemoveParseListener removes listener from the list of parse listeners. // // If listener is nil or has not been added as a parse // listener, this func does nothing. func (p *BaseParser) RemoveParseListener(listener ParseTreeListener) { … } // Remove all parse listeners. func (p *BaseParser) removeParseListeners() { … } // TriggerEnterRuleEvent notifies all parse listeners of an enter rule event. func (p *BaseParser) TriggerEnterRuleEvent() { … } // TriggerExitRuleEvent notifies any parse listeners of an exit rule event. func (p *BaseParser) TriggerExitRuleEvent() { … } func (p *BaseParser) GetInterpreter() *ParserATNSimulator { … } func (p *BaseParser) GetATN() *ATN { … } func (p *BaseParser) GetTokenFactory() TokenFactory { … } // setTokenFactory is used to tell our token source and error strategy about a new way to create tokens. func (p *BaseParser) setTokenFactory(factory TokenFactory) { … } // GetATNWithBypassAlts - the ATN with bypass alternatives is expensive to create, so we create it // lazily. func (p *BaseParser) GetATNWithBypassAlts() { … } //goland:noinspection GoUnusedParameter func (p *BaseParser) compileParseTreePattern(pattern, patternRuleIndex, lexer Lexer) { … } func (p *BaseParser) GetInputStream() IntStream { … } func (p *BaseParser) SetInputStream(input TokenStream) { … } func (p *BaseParser) GetTokenStream() TokenStream { … } // SetTokenStream installs input as the token stream and resets the parser. func (p *BaseParser) SetTokenStream(input TokenStream) { … } // GetCurrentToken returns the current token at LT(1). // // [Match] needs to return the current input symbol, which gets put // into the label for the associated token ref e.g., x=ID. func (p *BaseParser) GetCurrentToken() Token { … } func (p *BaseParser) NotifyErrorListeners(msg string, offendingToken Token, err RecognitionException) { … } func (p *BaseParser) Consume() Token { … } func (p *BaseParser) addContextToParseTree() { … } func (p *BaseParser) EnterRule(localctx ParserRuleContext, state, _ int) { … } func (p *BaseParser) ExitRule() { … } func (p *BaseParser) EnterOuterAlt(localctx ParserRuleContext, altNum int) { … } func (p *BaseParser) GetPrecedence() int { … } func (p *BaseParser) EnterRecursionRule(localctx ParserRuleContext, state, _, precedence int) { … } func (p *BaseParser) PushNewRecursionContext(localctx ParserRuleContext, state, _ int) { … } func (p *BaseParser) UnrollRecursionContexts(parentCtx ParserRuleContext) { … } func (p *BaseParser) GetInvokingContext(ruleIndex int) ParserRuleContext { … } func (p *BaseParser) Precpred(_ RuleContext, precedence int) bool { … } //goland:noinspection GoUnusedParameter func (p *BaseParser) inContext(context ParserRuleContext) bool { … } // IsExpectedToken checks whether symbol can follow the current state in the // {ATN}. The behavior of p.method is equivalent to the following, but is // implemented such that the complete context-sensitive follow set does not // need to be explicitly constructed. // // return getExpectedTokens().contains(symbol) func (p *BaseParser) IsExpectedToken(symbol int) bool { … } // GetExpectedTokens and returns the set of input symbols which could follow the current parser // state and context, as given by [GetState] and [GetContext], // respectively. func (p *BaseParser) GetExpectedTokens() *IntervalSet { … } func (p *BaseParser) GetExpectedTokensWithinCurrentRule() *IntervalSet { … } // GetRuleIndex get a rule's index (i.e., RULE_ruleName field) or -1 if not found. func (p *BaseParser) GetRuleIndex(ruleName string) int { … } // GetRuleInvocationStack returns a list of the rule names in your parser instance // leading up to a call to the current rule. You could override if // you want more details such as the file/line info of where // in the ATN a rule is invoked. func (p *BaseParser) GetRuleInvocationStack(c ParserRuleContext) []string { … } // GetDFAStrings returns a list of all DFA states used for debugging purposes func (p *BaseParser) GetDFAStrings() string { … } // DumpDFA prints the whole of the DFA for debugging func (p *BaseParser) DumpDFA() { … } func (p *BaseParser) GetSourceName() string { … } // SetTrace installs a trace listener for the parse. // // During a parse it is sometimes useful to listen in on the rule entry and exit // events as well as token Matches. This is for quick and dirty debugging. func (p *BaseParser) SetTrace(trace *TraceListener) { … }