LGTemplateParser class
- Extends
-
Parser
Constructors
LGTemplate |
Properties
Inherited Properties
atn | Get the serializedATN used by the recognizer for prediction. |
build |
Track the <xref:ParserRuleContext> objects during the parse and hook them up using the <xref:ParserRuleContext%23children> list so that it forms a parse tree. The <xref:ParserRuleContext> returned from the start rule represents the root of the parse tree. Note that if we are not building parse trees, rule contexts only point upwards. When a rule exits, it returns the context but that gets garbage collected if nobody holds a reference. It points upwards but nobody points at it. When we build parse trees, we are adding all of these contexts to <xref:ParserRuleContext%23children> list. Contexts are then not candidates for garbage collection. |
context | |
current |
Match needs to return the current input symbol, which gets put into the label for the associated token ref; e.g., x=ID. |
EOF | |
error |
|
input |
Set the token stream and reset the parser. |
interpreter | Set the ATN interpreter used by the recognizer for prediction. |
is |
|
is |
During a parse 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. |
number |
Gets the number of syntax errors reported during parsing. This value is incremented each time <xref:%23notifyErrorListeners> is called. See #notifyErrorListeners |
parse |
|
precedence | Get the precedence level for the top-most precedence rule. |
rule |
|
source |
|
state | Indicate that the recognizer has changed internal state that is consistent with the ATN state passed in. This way we always know where we are in the ATN as the parser goes along. The rule context objects form a stack that lets us see the stack of invoking rules. Combine this and we have complete ATN configuration information. |
token |
Methods
Inherited Methods
action(Rule |
|
add |
|
add |
Registers 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.
|
compile |
The preferred method of getting a tree pattern. For example, here's a sample use:
|
compile |
The same as [int)](xref:%23compileParseTreePattern(String%2C) but specify a LGFileLexer rather than trying to deduce it from this parser. |
consume() | Consume and return the current symbol.
E.g., given the following input with
If the parser is not in error recovery mode, the consumed symbol is added to the parse tree using <xref:ParserRuleContext%23addChild(TerminalNode)>, and <xref:ParseTreeListener%23visitTerminal> is called on any parse listeners. If the parser is in error recovery mode, the consumed symbol is added to the parse tree using [Token)](xref:%23createErrorNode(ParserRuleContext%2C) then <xref:ParserRuleContext%23addErrorNode(ErrorNode)> and <xref:ParseTreeListener%23visitErrorNode> is called on any parse listeners. |
create |
How to create an error node, given a token, associated with a parent. Typically, the error node to create is not a function of the parent. |
create |
How to create a token leaf node associated with a parent. Typically, the terminal node to create is not a function of the parent. |
dumpDFA() | For debugging and other purposes. |
enter |
|
enter |
|
enter |
|
enter |
Always called by generated parsers upon entry to a rule. Access field <xref:%23_ctx> get the current context. |
exit |
|
get |
The ATN with bypass alternatives is expensive to create so we create it
lazily.
@ if the current parser does not
implement the |
get |
For debugging and other purposes. |
get |
What is the error header, normally line/character position information? |
get |
|
get |
|
get |
Computes the set of input symbols which could follow the current parser state and context, as given by <xref:%23getState> and <xref:%23getContext>, respectively. See ATN#getExpectedTokens(int, RuleContext) |
get |
|
get |
|
get |
|
get |
Get a rule's index (i.e., |
get |
Get a map from rule names to rule indexes. Used for XPath and tree pattern compilation. |
get |
Return List<String> 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. This is very useful for error messages. |
get |
|
get |
Get a map from token names to token types. Used for XPath and tree pattern compilation. |
in |
|
is |
Checks whether or not
|
match(number) | Match current input symbol against |
match |
Match current input symbol as a wildcard. If the symbol type matches
(i.e. has a value greater than 0), <xref:ANTLRErrorStrategy%23reportMatch>
and <xref:%23consume> are called to complete the match process.
If the symbol type does not match,
<xref:ANTLRErrorStrategy%23recoverInline> is called on the current error
strategy to attempt recovery. If <xref:%23getBuildParseTree> is
|
notify |
|
notify |
|
precpred(Rule |
|
push |
Like <xref:%23enterRule> but for recursive rules. Make the current context the child of the incoming localctx. |
remove |
|
remove |
|
remove |
Remove See #addParseListener |
remove |
Remove all parse listeners. See #addParseListener |
reset() | reset the parser's state |
reset(boolean) | |
sempred(Rule |
|
set |
|
unroll |
Constructor Details
LGTemplateParser(TokenStream)
new LGTemplateParser(input: TokenStream)
Parameters
- input
-
TokenStream
Property Details
CASE
public static CASE: 14 = 14
Property Value
14
COMMENTS
public static COMMENTS: 3 = 3
Property Value
3
DASH
public static DASH: 4 = 4
Property Value
4
DEFAULT
public static DEFAULT: 15 = 15
Property Value
15
ELSE
public static ELSE: 12 = 12
Property Value
12
ELSEIF
public static ELSEIF: 11 = 11
Property Value
11
ESCAPE_CHARACTER
public static ESCAPE_CHARACTER: 16 = 16
Property Value
16
ESCAPE_CHARACTER_IN_STRUCTURE_BODY
public static ESCAPE_CHARACTER_IN_STRUCTURE_BODY: 31 = 31
Property Value
31
EXPRESSION
public static EXPRESSION: 17 = 17
Property Value
17
EXPRESSION_IN_STRUCTURE_BODY
public static EXPRESSION_IN_STRUCTURE_BODY: 32 = 32
Property Value
32
grammarFileName
string grammarFileName
Property Value
string
IF
public static IF: 10 = 10
Property Value
10
INVALID_TOKEN
public static INVALID_TOKEN: 6 = 6
Property Value
6
LEFT_SQUARE_BRACKET
public static LEFT_SQUARE_BRACKET: 5 = 5
Property Value
5
MULTILINE_PREFIX
public static MULTILINE_PREFIX: 8 = 8
Property Value
8
MULTILINE_SUFFIX
public static MULTILINE_SUFFIX: 19 = 19
Property Value
19
NEWLINE
public static NEWLINE: 2 = 2
Property Value
2
NEWLINE_IN_BODY
public static NEWLINE_IN_BODY: 9 = 9
Property Value
9
NEWLINE_IN_STRUCTURE_NAME
public static NEWLINE_IN_STRUCTURE_NAME: 21 = 21
Property Value
21
ruleNames
public static ruleNames: string[] = [
"template", "body", "structuredTemplateBody", "structuredBodyNameLine",
"errorStructuredName", "structuredBodyContentLine", "errorStructureLine",
"keyValueStructureLine", "keyValueStructureValue", "structuredBodyEndLine",
"normalTemplateBody", "templateString", "normalTemplateString", "errorTemplateString",
"ifElseTemplateBody", "ifConditionRule", "ifCondition", "switchCaseTemplateBody",
"switchCaseRule", "switchCaseStat", "expression", "expressionInStructure",
]
Property Value
string[]
ruleNames
string[] ruleNames
Property Value
string[]
RULE_body
public static RULE_body: 1 = 1
Property Value
1
RULE_errorStructuredName
public static RULE_errorStructuredName: 4 = 4
Property Value
4
RULE_errorStructureLine
public static RULE_errorStructureLine: 6 = 6
Property Value
6
RULE_errorTemplateString
public static RULE_errorTemplateString: 13 = 13
Property Value
13
RULE_expression
public static RULE_expression: 20 = 20
Property Value
20
RULE_expressionInStructure
public static RULE_expressionInStructure: 21 = 21
Property Value
21
RULE_ifCondition
public static RULE_ifCondition: 16 = 16
Property Value
16
RULE_ifConditionRule
public static RULE_ifConditionRule: 15 = 15
Property Value
15
RULE_ifElseTemplateBody
public static RULE_ifElseTemplateBody: 14 = 14
Property Value
14
RULE_keyValueStructureLine
public static RULE_keyValueStructureLine: 7 = 7
Property Value
7
RULE_keyValueStructureValue
public static RULE_keyValueStructureValue: 8 = 8
Property Value
8
RULE_normalTemplateBody
public static RULE_normalTemplateBody: 10 = 10
Property Value
10
RULE_normalTemplateString
public static RULE_normalTemplateString: 12 = 12
Property Value
12
RULE_structuredBodyContentLine
public static RULE_structuredBodyContentLine: 5 = 5
Property Value
5
RULE_structuredBodyEndLine
public static RULE_structuredBodyEndLine: 9 = 9
Property Value
9
RULE_structuredBodyNameLine
public static RULE_structuredBodyNameLine: 3 = 3
Property Value
3
RULE_structuredTemplateBody
public static RULE_structuredTemplateBody: 2 = 2
Property Value
2
RULE_switchCaseRule
public static RULE_switchCaseRule: 18 = 18
Property Value
18
RULE_switchCaseStat
public static RULE_switchCaseStat: 19 = 19
Property Value
19
RULE_switchCaseTemplateBody
public static RULE_switchCaseTemplateBody: 17 = 17
Property Value
17
RULE_template
public static RULE_template: 0 = 0
Property Value
0
RULE_templateString
public static RULE_templateString: 11 = 11
Property Value
11
serializedATN
string serializedATN
Property Value
string
STRUCTURED_BODY_END
public static STRUCTURED_BODY_END: 27 = 27
Property Value
27
STRUCTURED_COMMENTS
public static STRUCTURED_COMMENTS: 24 = 24
Property Value
24
STRUCTURED_NEWLINE
public static STRUCTURED_NEWLINE: 26 = 26
Property Value
26
STRUCTURE_EQUALS
public static STRUCTURE_EQUALS: 29 = 29
Property Value
29
STRUCTURE_IDENTIFIER
public static STRUCTURE_IDENTIFIER: 28 = 28
Property Value
28
STRUCTURE_NAME
public static STRUCTURE_NAME: 22 = 22
Property Value
22
STRUCTURE_OR_MARK
public static STRUCTURE_OR_MARK: 30 = 30
Property Value
30
SWITCH
public static SWITCH: 13 = 13
Property Value
13
TEXT
public static TEXT: 18 = 18
Property Value
18
TEXT_IN_STRUCTURE_BODY
public static TEXT_IN_STRUCTURE_BODY: 33 = 33
Property Value
33
TEXT_IN_STRUCTURE_NAME
public static TEXT_IN_STRUCTURE_NAME: 23 = 23
Property Value
23
VOCABULARY
public static VOCABULARY: Vocabulary = new VocabularyImpl(LGTemplateParser._LITERAL_NAMES, LGTemplateParser._SYMBOLIC_NAMES, [])
Property Value
Vocabulary
vocabulary
Vocabulary vocabulary
Property Value
Vocabulary
WS
public static WS: 1 = 1
Property Value
1
WS_IN_BODY
public static WS_IN_BODY: 7 = 7
Property Value
7
WS_IN_STRUCTURE_BODY
public static WS_IN_STRUCTURE_BODY: 25 = 25
Property Value
25
WS_IN_STRUCTURE_NAME
public static WS_IN_STRUCTURE_NAME: 20 = 20
Property Value
20
Inherited Property Details
atn
Get the serializedATN used by the recognizer for prediction.
atn: ATN
Property Value
ATN
Inherited From Recognizer.atn
buildParseTree
Track the <xref:ParserRuleContext> objects during the parse and hook them up using the <xref:ParserRuleContext%23children> list so that it forms a parse tree. The <xref:ParserRuleContext> returned from the start rule represents the root of the parse tree. Note that if we are not building parse trees, rule contexts only point upwards. When a rule exits, it returns the context but that gets garbage collected if nobody holds a reference. It points upwards but nobody points at it.
When we build parse trees, we are adding all of these contexts to <xref:ParserRuleContext%23children> list. Contexts are then not candidates for garbage collection.
buildParseTree: boolean
Property Value
boolean
Inherited From Parser.buildParseTree
context
context: ParserRuleContext
Property Value
ParserRuleContext
Inherited From Parser.context
currentToken
Match needs to return the current input symbol, which gets put into the label for the associated token ref; e.g., x=ID.
currentToken: Token
Property Value
Token
Inherited From Parser.currentToken
EOF
static EOF: number
Property Value
number
Inherited From Recognizer.EOF
errorHandler
errorHandler: ANTLRErrorStrategy
Property Value
ANTLRErrorStrategy
Inherited From Parser.errorHandler
inputStream
Set the token stream and reset the parser.
inputStream: TokenStream
Property Value
TokenStream
Inherited From Parser.inputStream
interpreter
Set the ATN interpreter used by the recognizer for prediction.
interpreter: ParserATNSimulator
Property Value
ParserATNSimulator
Inherited From Recognizer.interpreter
isMatchedEOF
isMatchedEOF: boolean
Property Value
boolean
Inherited From Parser.isMatchedEOF
isTrace
During a parse 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.
isTrace: boolean
Property Value
boolean
Inherited From Parser.isTrace
numberOfSyntaxErrors
Gets the number of syntax errors reported during parsing. This value is incremented each time <xref:%23notifyErrorListeners> is called.
See #notifyErrorListeners
numberOfSyntaxErrors: number
Property Value
number
Inherited From Parser.numberOfSyntaxErrors
parseInfo
parseInfo: Promise<ParseInfo | undefined>
Property Value
Promise<ParseInfo | undefined>
Inherited From Parser.parseInfo
precedence
Get the precedence level for the top-most precedence rule.
precedence: number
Property Value
number
Inherited From Parser.precedence
ruleContext
ruleContext: ParserRuleContext
Property Value
ParserRuleContext
Inherited From Parser.ruleContext
sourceName
sourceName: string
Property Value
string
Inherited From Parser.sourceName
state
Indicate that the recognizer has changed internal state that is consistent with the ATN state passed in. This way we always know where we are in the ATN as the parser goes along. The rule context objects form a stack that lets us see the stack of invoking rules. Combine this and we have complete ATN configuration information.
state: number
Property Value
number
Inherited From Recognizer.state
tokenFactory
tokenFactory: TokenFactory
Property Value
TokenFactory
Inherited From Parser.tokenFactory
Method Details
body()
errorStructuredName()
errorStructureLine()
errorTemplateString()
expression()
expressionInStructure()
ifCondition()
ifConditionRule()
ifElseTemplateBody()
keyValueStructureLine()
keyValueStructureValue()
function keyValueStructureValue(): KeyValueStructureValueContext
Returns
normalTemplateBody()
normalTemplateString()
structuredBodyContentLine()
function structuredBodyContentLine(): StructuredBodyContentLineContext
Returns
structuredBodyEndLine()
structuredBodyNameLine()
function structuredBodyNameLine(): StructuredBodyNameLineContext
Returns
structuredTemplateBody()
function structuredTemplateBody(): StructuredTemplateBodyContext
Returns
switchCaseRule()
switchCaseStat()
switchCaseTemplateBody()
function switchCaseTemplateBody(): SwitchCaseTemplateBodyContext
Returns
template()
templateString()
Inherited Method Details
action(RuleContext | undefined, number, number)
function action(_localctx: RuleContext | undefined, ruleIndex: number, actionIndex: number)
Parameters
- _localctx
-
RuleContext | undefined
- ruleIndex
-
number
- actionIndex
-
number
Inherited From Recognizer.action
addErrorListener(ANTLRErrorListener<Token>)
function addErrorListener(listener: ANTLRErrorListener<Token>)
Parameters
- listener
-
ANTLRErrorListener<Token>
Inherited From Recognizer.addErrorListener
addParseListener(ParseTreeListener)
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
<xref:ParseTreeWalker%23DEFAULT> 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.
function addParseListener(listener: ParseTreeListener)
Parameters
- listener
-
ParseTreeListener
the listener to add
Inherited From Parser.addParseListener
compileParseTreePattern(string, number)
The preferred method of getting a tree pattern. For example, here's a sample use:
let t: ParseTree = parser.expr();
let p: ParseTreePattern = await parser.compileParseTreePattern("<ID>+0", MyParser.RULE_expr);
let m: ParseTreeMatch = p.match(t);
let id: string = m.get("ID");
function compileParseTreePattern(pattern: string, patternRuleIndex: number): Promise<ParseTreePattern>
Parameters
- pattern
-
string
- patternRuleIndex
-
number
Returns
Promise<ParseTreePattern>
Inherited From Parser.compileParseTreePattern
compileParseTreePattern(string, number, Lexer)
The same as [int)](xref:%23compileParseTreePattern(String%2C) but specify a LGFileLexer rather than trying to deduce it from this parser.
function compileParseTreePattern(pattern: string, patternRuleIndex: number, lexer?: Lexer): Promise<ParseTreePattern>
Parameters
- pattern
-
string
- patternRuleIndex
-
number
- lexer
-
Lexer
Returns
Promise<ParseTreePattern>
Inherited From Parser.compileParseTreePattern
consume()
Consume and return the current symbol.
E.g., given the following input with A
being the current
lookahead symbol, this function moves the cursor to B
and returns
A
.
A B
^
If the parser is not in error recovery mode, the consumed symbol is added to the parse tree using <xref:ParserRuleContext%23addChild(TerminalNode)>, and <xref:ParseTreeListener%23visitTerminal> is called on any parse listeners. If the parser is in error recovery mode, the consumed symbol is added to the parse tree using [Token)](xref:%23createErrorNode(ParserRuleContext%2C) then <xref:ParserRuleContext%23addErrorNode(ErrorNode)> and <xref:ParseTreeListener%23visitErrorNode> is called on any parse listeners.
function consume(): Token
Returns
Token
Inherited From Parser.consume
createErrorNode(ParserRuleContext, Token)
How to create an error node, given a token, associated with a parent. Typically, the error node to create is not a function of the parent.
function createErrorNode(parent: ParserRuleContext, t: Token): ErrorNode
Parameters
- parent
-
ParserRuleContext
- t
-
Token
Returns
ErrorNode
Inherited From Parser.createErrorNode
createTerminalNode(ParserRuleContext, Token)
How to create a token leaf node associated with a parent. Typically, the terminal node to create is not a function of the parent.
function createTerminalNode(parent: ParserRuleContext, t: Token): TerminalNode
Parameters
- parent
-
ParserRuleContext
- t
-
Token
Returns
TerminalNode
Inherited From Parser.createTerminalNode
dumpDFA()
For debugging and other purposes.
function dumpDFA()
Inherited From Parser.dumpDFA
enterLeftFactoredRule(ParserRuleContext, number, number)
function enterLeftFactoredRule(localctx: ParserRuleContext, state: number, ruleIndex: number)
Parameters
- localctx
-
ParserRuleContext
- state
-
number
- ruleIndex
-
number
Inherited From Parser.enterLeftFactoredRule
enterOuterAlt(ParserRuleContext, number)
function enterOuterAlt(localctx: ParserRuleContext, altNum: number)
Parameters
- localctx
-
ParserRuleContext
- altNum
-
number
Inherited From Parser.enterOuterAlt
enterRecursionRule(ParserRuleContext, number, number, number)
function enterRecursionRule(localctx: ParserRuleContext, state: number, ruleIndex: number, precedence: number)
Parameters
- localctx
-
ParserRuleContext
- state
-
number
- ruleIndex
-
number
- precedence
-
number
Inherited From Parser.enterRecursionRule
enterRule(ParserRuleContext, number, number)
Always called by generated parsers upon entry to a rule. Access field <xref:%23_ctx> get the current context.
function enterRule(localctx: ParserRuleContext, state: number, ruleIndex: number)
Parameters
- localctx
-
ParserRuleContext
- state
-
number
- ruleIndex
-
number
Inherited From Parser.enterRule
exitRule()
function exitRule()
Inherited From Parser.exitRule
getATNWithBypassAlts()
The ATN with bypass alternatives is expensive to create so we create it
lazily.
@ if the current parser does not
implement the serializedATN
property.
function getATNWithBypassAlts(): ATN
Returns
ATN
Inherited From Parser.getATNWithBypassAlts
getDFAStrings()
For debugging and other purposes.
function getDFAStrings(): string[]
Returns
string[]
Inherited From Parser.getDFAStrings
getErrorHeader(RecognitionException)
What is the error header, normally line/character position information?
function getErrorHeader(e: RecognitionException): string
Parameters
- e
-
RecognitionException
Returns
string
Inherited From Recognizer.getErrorHeader
getErrorListenerDispatch()
function getErrorListenerDispatch(): ParserErrorListener
Returns
ParserErrorListener
Inherited From Parser.getErrorListenerDispatch
getErrorListeners()
function getErrorListeners(): Array<ANTLRErrorListener<Token>>
Returns
Array<ANTLRErrorListener<Token>>
Inherited From Recognizer.getErrorListeners
getExpectedTokens()
Computes the set of input symbols which could follow the current parser state and context, as given by <xref:%23getState> and <xref:%23getContext>, respectively.
See ATN#getExpectedTokens(int, RuleContext)
function getExpectedTokens(): IntervalSet
Returns
IntervalSet
Inherited From Parser.getExpectedTokens
getExpectedTokensWithinCurrentRule()
function getExpectedTokensWithinCurrentRule(): IntervalSet
Returns
IntervalSet
Inherited From Parser.getExpectedTokensWithinCurrentRule
getInvokingContext(number)
function getInvokingContext(ruleIndex: number): ParserRuleContext | undefined
Parameters
- ruleIndex
-
number
Returns
ParserRuleContext | undefined
Inherited From Parser.getInvokingContext
getParseListeners()
function getParseListeners(): ParseTreeListener[]
Returns
ParseTreeListener[]
Inherited From Parser.getParseListeners
getRuleIndex(string)
Get a rule's index (i.e., RULE_ruleName
field) or -1 if not found.
function getRuleIndex(ruleName: string): number
Parameters
- ruleName
-
string
Returns
number
Inherited From Parser.getRuleIndex
getRuleIndexMap()
Get a map from rule names to rule indexes. Used for XPath and tree pattern compilation.
function getRuleIndexMap(): ReadonlyMap<string, number>
Returns
ReadonlyMap<string, number>
Inherited From Recognizer.getRuleIndexMap
getRuleInvocationStack(RuleContext)
Return List<String> 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. This is very useful for error messages.
function getRuleInvocationStack(ctx?: RuleContext): string[]
Parameters
- ctx
-
RuleContext
Returns
string[]
Inherited From Parser.getRuleInvocationStack
getTokenType(string)
function getTokenType(tokenName: string): number
Parameters
- tokenName
-
string
Returns
number
Inherited From Recognizer.getTokenType
getTokenTypeMap()
Get a map from token names to token types. Used for XPath and tree pattern compilation.
function getTokenTypeMap(): ReadonlyMap<string, number>
Returns
ReadonlyMap<string, number>
Inherited From Recognizer.getTokenTypeMap
inContext(string)
function inContext(context: string): boolean
Parameters
- context
-
string
Returns
boolean
Inherited From Parser.inContext
isExpectedToken(number)
Checks whether or not symbol
can follow the current state in the
ATN. The behavior of this 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);
function isExpectedToken(symbol: number): boolean
Parameters
- symbol
-
number
the symbol type to check
Returns
boolean
true
if symbol
can follow the current state in
the ATN, otherwise false
.
Inherited From Parser.isExpectedToken
match(number)
Match current input symbol against ttype
. If the symbol type
matches, <xref:ANTLRErrorStrategy%23reportMatch> and <xref:%23consume> are
called to complete the match process.
If the symbol type does not match,
<xref:ANTLRErrorStrategy%23recoverInline> is called on the current error
strategy to attempt recovery. If <xref:%23getBuildParseTree> is
true
and the token index of the symbol returned by
<xref:ANTLRErrorStrategy%23recoverInline> is -1, the symbol is added to
the parse tree by calling [Token)](xref:%23createErrorNode(ParserRuleContext%2C) then
<xref:ParserRuleContext%23addErrorNode(ErrorNode)>.
function match(ttype: number): Token
Parameters
- ttype
-
number
the token type to match
Returns
Token
the matched symbol
@ if the current input symbol did not match
ttype
and the error strategy could not recover from the
mismatched symbol
Inherited From Parser.match
matchWildcard()
Match current input symbol as a wildcard. If the symbol type matches
(i.e. has a value greater than 0), <xref:ANTLRErrorStrategy%23reportMatch>
and <xref:%23consume> are called to complete the match process.
If the symbol type does not match,
<xref:ANTLRErrorStrategy%23recoverInline> is called on the current error
strategy to attempt recovery. If <xref:%23getBuildParseTree> is
true
and the token index of the symbol returned by
<xref:ANTLRErrorStrategy%23recoverInline> is -1, the symbol is added to
the parse tree by calling [Token)](xref:Parser%23createErrorNode(ParserRuleContext%2C) then
<xref:ParserRuleContext%23addErrorNode(ErrorNode)>.
function matchWildcard(): Token
Returns
Token
the matched symbol @ if the current input symbol did not match a wildcard and the error strategy could not recover from the mismatched symbol
Inherited From Parser.matchWildcard
notifyErrorListeners(string)
function notifyErrorListeners(msg: string)
Parameters
- msg
-
string
Inherited From Parser.notifyErrorListeners
notifyErrorListeners(string, Token | null, RecognitionException | undefined)
function notifyErrorListeners(msg: string, offendingToken: Token | null, e: RecognitionException | undefined)
Parameters
- msg
-
string
- offendingToken
-
Token | null
- e
-
RecognitionException | undefined
Inherited From Parser.notifyErrorListeners
precpred(RuleContext, number)
function precpred(localctx: RuleContext, precedence: number): boolean
Parameters
- localctx
-
RuleContext
- precedence
-
number
Returns
boolean
Inherited From Parser.precpred
pushNewRecursionContext(ParserRuleContext, number, number)
Like <xref:%23enterRule> but for recursive rules. Make the current context the child of the incoming localctx.
function pushNewRecursionContext(localctx: ParserRuleContext, state: number, ruleIndex: number)
Parameters
- localctx
-
ParserRuleContext
- state
-
number
- ruleIndex
-
number
Inherited From Parser.pushNewRecursionContext
removeErrorListener(ANTLRErrorListener<Token>)
function removeErrorListener(listener: ANTLRErrorListener<Token>)
Parameters
- listener
-
ANTLRErrorListener<Token>
Inherited From Recognizer.removeErrorListener
removeErrorListeners()
function removeErrorListeners()
Inherited From Recognizer.removeErrorListeners
removeParseListener(ParseTreeListener)
Remove listener
from the list of parse listeners.
If listener
is undefined
or has not been added as a parse
listener, this method does nothing.
See #addParseListener
function removeParseListener(listener: ParseTreeListener)
Parameters
- listener
-
ParseTreeListener
the listener to remove
Inherited From Parser.removeParseListener
removeParseListeners()
Remove all parse listeners.
See #addParseListener
function removeParseListeners()
Inherited From Parser.removeParseListeners
reset()
reset the parser's state
function reset()
Inherited From Parser.reset
reset(boolean)
function reset(resetInput: boolean)
Parameters
- resetInput
-
boolean
Inherited From Parser.reset
sempred(RuleContext | undefined, number, number)
function sempred(_localctx: RuleContext | undefined, ruleIndex: number, actionIndex: number): boolean
Parameters
- _localctx
-
RuleContext | undefined
- ruleIndex
-
number
- actionIndex
-
number
Returns
boolean
Inherited From Recognizer.sempred
setProfile(boolean)
function setProfile(profile: boolean): Promise<void>
Parameters
- profile
-
boolean
Returns
Promise<void>
Inherited From Parser.setProfile
unrollRecursionContexts(ParserRuleContext)
function unrollRecursionContexts(_parentctx: ParserRuleContext)
Parameters
- _parentctx
-
ParserRuleContext
Inherited From Parser.unrollRecursionContexts