ExpressionAntlrParser class

Extends

Parser

Constructors

ExpressionAntlrParser(TokenStream)

Properties

ARROW
ASTERISK
CLOSE_BRACKET
CLOSE_CURLY_BRACKET
CLOSE_SQUARE_BRACKET
COLON
COMMA
DOT
DOUBLE_AND
DOUBLE_EQUAL
DOUBLE_VERTICAL_CYLINDER
ESCAPE_CHARACTER
grammarFileName
IDENTIFIER
INVALID_TOKEN_DEFAULT_MODE
LESS_OR_EQUAl
LESS_THAN
MORE_OR_EQUAL
MORE_THAN
NEWLINE
NON
NOT_EQUAL
NULL_COALESCE
NUMBER
OPEN_BRACKET
OPEN_CURLY_BRACKET
OPEN_SQUARE_BRACKET
PERCENT
PLUS
QUESTION_MARK
ruleNames
ruleNames
RULE_argsList
RULE_expression
RULE_file
RULE_key
RULE_keyValuePair
RULE_keyValuePairList
RULE_lambda
RULE_primaryExpression
RULE_stringInterpolation
RULE_textContent
serializedATN
SINGLE_AND
SLASH
STRING
STRING_INTERPOLATION_START
SUBSTRACT
TEMPLATE
TEXT_CONTENT
VOCABULARY
vocabulary
WHITESPACE
XOR

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

argsList()
expression()
expression(number)
file()
key()
keyValuePair()
keyValuePairList()
lambda()
primaryExpression()
primaryExpression(number)
sempred(RuleContext, number, number)
stringInterpolation()
textContent()

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 CommonRegexLexer 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)
setProfile(boolean)
unrollRecursionContexts(ParserRuleContext)

Constructor Details

ExpressionAntlrParser(TokenStream)

new ExpressionAntlrParser(input: TokenStream)

Parameters

input

TokenStream

Property Details

ARROW

public static ARROW: 27 = 27

Property Value

27

ASTERISK

public static ASTERISK: 6 = 6

Property Value

6

CLOSE_BRACKET

public static CLOSE_BRACKET: 19 = 19

Property Value

19

CLOSE_CURLY_BRACKET

public static CLOSE_CURLY_BRACKET: 24 = 24

Property Value

24

CLOSE_SQUARE_BRACKET

public static CLOSE_SQUARE_BRACKET: 22 = 22

Property Value

22

COLON

public static COLON: 26 = 26

Property Value

26

COMMA

public static COMMA: 25 = 25

Property Value

25

DOT

public static DOT: 20 = 20

Property Value

20

DOUBLE_AND

public static DOUBLE_AND: 12 = 12

Property Value

12

DOUBLE_EQUAL

public static DOUBLE_EQUAL: 9 = 9

Property Value

9

DOUBLE_VERTICAL_CYLINDER

public static DOUBLE_VERTICAL_CYLINDER: 13 = 13

Property Value

13

ESCAPE_CHARACTER

public static ESCAPE_CHARACTER: 37 = 37

Property Value

37

grammarFileName

string grammarFileName

Property Value

string

IDENTIFIER

public static IDENTIFIER: 32 = 32

Property Value

32

INVALID_TOKEN_DEFAULT_MODE

public static INVALID_TOKEN_DEFAULT_MODE: 35 = 35

Property Value

35

LESS_OR_EQUAl

public static LESS_OR_EQUAl: 16 = 16

Property Value

16

LESS_THAN

public static LESS_THAN: 14 = 14

Property Value

14

MORE_OR_EQUAL

public static MORE_OR_EQUAL: 17 = 17

Property Value

17

MORE_THAN

public static MORE_THAN: 15 = 15

Property Value

15

NEWLINE

public static NEWLINE: 33 = 33

Property Value

33

NON

public static NON: 4 = 4

Property Value

4

NOT_EQUAL

public static NOT_EQUAL: 10 = 10

Property Value

10

NULL_COALESCE

public static NULL_COALESCE: 28 = 28

Property Value

28

NUMBER

public static NUMBER: 30 = 30

Property Value

30

OPEN_BRACKET

public static OPEN_BRACKET: 18 = 18

Property Value

18

OPEN_CURLY_BRACKET

public static OPEN_CURLY_BRACKET: 23 = 23

Property Value

23

OPEN_SQUARE_BRACKET

public static OPEN_SQUARE_BRACKET: 21 = 21

Property Value

21

PERCENT

public static PERCENT: 8 = 8

Property Value

8

PLUS

public static PLUS: 2 = 2

Property Value

2

QUESTION_MARK

public static QUESTION_MARK: 29 = 29

Property Value

29

ruleNames

public static ruleNames: string[] = [
		"file", "expression", "primaryExpression", "stringInterpolation", "textContent", 
		"argsList", "lambda", "keyValuePairList", "keyValuePair", "key",
	]

Property Value

string[]

ruleNames

string[] ruleNames

Property Value

string[]

RULE_argsList

public static RULE_argsList: 5 = 5

Property Value

5

RULE_expression

public static RULE_expression: 1 = 1

Property Value

1

RULE_file

public static RULE_file: 0 = 0

Property Value

0

RULE_key

public static RULE_key: 9 = 9

Property Value

9

RULE_keyValuePair

public static RULE_keyValuePair: 8 = 8

Property Value

8

RULE_keyValuePairList

public static RULE_keyValuePairList: 7 = 7

Property Value

7

RULE_lambda

public static RULE_lambda: 6 = 6

Property Value

6

RULE_primaryExpression

public static RULE_primaryExpression: 2 = 2

Property Value

2

RULE_stringInterpolation

public static RULE_stringInterpolation: 3 = 3

Property Value

3

RULE_textContent

public static RULE_textContent: 4 = 4

Property Value

4

serializedATN

string serializedATN

Property Value

string

SINGLE_AND

public static SINGLE_AND: 11 = 11

Property Value

11

SLASH

public static SLASH: 7 = 7

Property Value

7

STRING

public static STRING: 34 = 34

Property Value

34

STRING_INTERPOLATION_START

public static STRING_INTERPOLATION_START: 1 = 1

Property Value

1

SUBSTRACT

public static SUBSTRACT: 3 = 3

Property Value

3

TEMPLATE

public static TEMPLATE: 36 = 36

Property Value

36

TEXT_CONTENT

public static TEXT_CONTENT: 38 = 38

Property Value

38

VOCABULARY

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

Property Value

Vocabulary

vocabulary

Vocabulary vocabulary

Property Value

Vocabulary

WHITESPACE

public static WHITESPACE: 31 = 31

Property Value

31

XOR

public static XOR: 5 = 5

Property Value

5

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

argsList()

function argsList(): ArgsListContext

Returns

expression()

function expression(): ExpressionContext

Returns

expression(number)

function expression(_p: number): ExpressionContext

Parameters

_p

number

Returns

file()

function file(): FileContext

Returns

key()

function key(): KeyContext

Returns

keyValuePair()

function keyValuePair(): KeyValuePairContext

Returns

keyValuePairList()

function keyValuePairList(): KeyValuePairListContext

Returns

lambda()

function lambda(): LambdaContext

Returns

primaryExpression()

function primaryExpression(): PrimaryExpressionContext

Returns

primaryExpression(number)

function primaryExpression(_p: number): PrimaryExpressionContext

Parameters

_p

number

Returns

sempred(RuleContext, number, number)

function sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean

Parameters

_localctx

RuleContext

ruleIndex

number

predIndex

number

Returns

boolean

stringInterpolation()

function stringInterpolation(): StringInterpolationContext

Returns

textContent()

function textContent(): TextContentContext

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 CommonRegexLexer 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

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