LGFileParser class

Extends

Parser

Constructors

LGFileParser(TokenStream)

Properties

COMMENT
ESCAPE_CHARACTER
grammarFileName
IMPORT
INLINE_MULTILINE
INVALID_LINE
MULTILINE_PREFIX
MULTILINE_SUFFIX
MULTILINE_TEXT
NEWLINE
OPTION
ruleNames
ruleNames
RULE_commentDefinition
RULE_errorDefinition
RULE_file
RULE_importDefinition
RULE_optionDefinition
RULE_paragraph
RULE_templateBody
RULE_templateBodyLine
RULE_templateDefinition
RULE_templateNameLine
serializedATN
TEMPLATE_BODY
TEMPLATE_NAME_LINE
VOCABULARY
vocabulary

Inherited Properties

atn

Get the serializedATN used by the recognizer for prediction.

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.

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.

EOF
errorHandler
inputStream

Set the token stream and reset the parser.

interpreter

Set the ATN interpreter used by the recognizer for prediction.

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.

numberOfSyntaxErrors

Gets the number of syntax errors reported during parsing. This value is incremented each time <xref:%23notifyErrorListeners> is called.

See #notifyErrorListeners

parseInfo
precedence

Get the precedence level for the top-most precedence rule.

ruleContext
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.

tokenFactory

Methods

commentDefinition()
errorDefinition()
file()
importDefinition()
optionDefinition()
paragraph()
templateBody()
templateBodyLine()
templateDefinition()
templateNameLine()

Inherited Methods

action(RuleContext | undefined, number, number)
addErrorListener(ANTLRErrorListener<Token>)
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.
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");
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.

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.

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.

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.

dumpDFA()

For debugging and other purposes.

enterLeftFactoredRule(ParserRuleContext, number, number)
enterOuterAlt(ParserRuleContext, number)
enterRecursionRule(ParserRuleContext, number, number, number)
enterRule(ParserRuleContext, number, number)

Always called by generated parsers upon entry to a rule. Access field <xref:%23_ctx> get the current context.

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.

getDFAStrings()

For debugging and other purposes.

getErrorHeader(RecognitionException)

What is the error header, normally line/character position information?

getErrorListenerDispatch()
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)

getExpectedTokensWithinCurrentRule()
getInvokingContext(number)
getParseListeners()
getRuleIndex(string)

Get a rule's index (i.e., RULE_ruleName field) or -1 if not found.

getRuleIndexMap()

Get a map from rule names to rule indexes. Used for XPath and tree pattern compilation.

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.

getTokenType(string)
getTokenTypeMap()

Get a map from token names to token types. Used for XPath and tree pattern compilation.

inContext(string)
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);
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)>.

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)>.

notifyErrorListeners(string)
notifyErrorListeners(string, Token | null, RecognitionException | undefined)
precpred(RuleContext, number)
pushNewRecursionContext(ParserRuleContext, number, number)

Like <xref:%23enterRule> but for recursive rules. Make the current context the child of the incoming localctx.

removeErrorListener(ANTLRErrorListener<Token>)
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

removeParseListeners()

Remove all parse listeners.

See #addParseListener

reset()

reset the parser's state

reset(boolean)
sempred(RuleContext | undefined, number, number)
setProfile(boolean)
unrollRecursionContexts(ParserRuleContext)

Constructor Details

LGFileParser(TokenStream)

new LGFileParser(input: TokenStream)

Parameters

input

TokenStream

Property Details

COMMENT

public static COMMENT: 3 = 3

Property Value

3

ESCAPE_CHARACTER

public static ESCAPE_CHARACTER: 11 = 11

Property Value

11

grammarFileName

string grammarFileName

Property Value

string

IMPORT

public static IMPORT: 4 = 4

Property Value

4

INLINE_MULTILINE

public static INLINE_MULTILINE: 6 = 6

Property Value

6

INVALID_LINE

public static INVALID_LINE: 9 = 9

Property Value

9

MULTILINE_PREFIX

public static MULTILINE_PREFIX: 7 = 7

Property Value

7

MULTILINE_SUFFIX

public static MULTILINE_SUFFIX: 10 = 10

Property Value

10

MULTILINE_TEXT

public static MULTILINE_TEXT: 12 = 12

Property Value

12

NEWLINE

public static NEWLINE: 1 = 1

Property Value

1

OPTION

public static OPTION: 2 = 2

Property Value

2

ruleNames

public static ruleNames: string[] = [
		"file", "paragraph", "commentDefinition", "importDefinition", "optionDefinition", 
		"errorDefinition", "templateDefinition", "templateNameLine", "templateBody", 
		"templateBodyLine",
	]

Property Value

string[]

ruleNames

string[] ruleNames

Property Value

string[]

RULE_commentDefinition

public static RULE_commentDefinition: 2 = 2

Property Value

2

RULE_errorDefinition

public static RULE_errorDefinition: 5 = 5

Property Value

5

RULE_file

public static RULE_file: 0 = 0

Property Value

0

RULE_importDefinition

public static RULE_importDefinition: 3 = 3

Property Value

3

RULE_optionDefinition

public static RULE_optionDefinition: 4 = 4

Property Value

4

RULE_paragraph

public static RULE_paragraph: 1 = 1

Property Value

1

RULE_templateBody

public static RULE_templateBody: 8 = 8

Property Value

8

RULE_templateBodyLine

public static RULE_templateBodyLine: 9 = 9

Property Value

9

RULE_templateDefinition

public static RULE_templateDefinition: 6 = 6

Property Value

6

RULE_templateNameLine

public static RULE_templateNameLine: 7 = 7

Property Value

7

serializedATN

string serializedATN

Property Value

string

TEMPLATE_BODY

public static TEMPLATE_BODY: 8 = 8

Property Value

8

TEMPLATE_NAME_LINE

public static TEMPLATE_NAME_LINE: 5 = 5

Property Value

5

VOCABULARY

public static VOCABULARY: Vocabulary = new VocabularyImpl(LGFileParser._LITERAL_NAMES, LGFileParser._SYMBOLIC_NAMES, [])

Property Value

Vocabulary

vocabulary

Vocabulary vocabulary

Property Value

Vocabulary

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

commentDefinition()

function commentDefinition(): CommentDefinitionContext

Returns

errorDefinition()

function errorDefinition(): ErrorDefinitionContext

Returns

file()

function file(): FileContext

Returns

importDefinition()

function importDefinition(): ImportDefinitionContext

Returns

optionDefinition()

function optionDefinition(): OptionDefinitionContext

Returns

paragraph()

function paragraph(): ParagraphContext

Returns

templateBody()

function templateBody(): TemplateBodyContext

Returns

templateBodyLine()

function templateBodyLine(): TemplateBodyLineContext

Returns

templateDefinition()

function templateDefinition(): TemplateDefinitionContext

Returns

templateNameLine()

function templateNameLine(): TemplateNameLineContext

Returns

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