Parser

TODO add class description

abstract
class Parser : Recognizer!(Token, ParserATNSimulator), InterfaceParser {}

Constructors

this
this()
Undocumented in source.
this
this(TokenStream input)
Undocumented in source.

Members

Classes

TraceListener
class TraceListener

TODO add class description

TrimToSizeListener
class TrimToSizeListener

TODO add class description

Functions

addContextToParseTree
void addContextToParseTree()
Undocumented in source. Be warned that the author may not have intended to support it.
addParseListener
void addParseListener(ParseTreeListener listener)

@uml Registers {@code listener} to receive events during the parsing process.

compileParseTreePattern
ParseTreePattern compileParseTreePattern(string pattern, int patternRuleIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
compileParseTreePattern
ParseTreePattern compileParseTreePattern(string pattern, int patternRuleIndex, Lexer lexer)

@uml The same as {@link #compileParseTreePattern(String, int)} but specify a {@link Lexer} rather than trying to deduce it from this parser.

consume
Token consume()

@uml Consume and return the {@linkplain #getCurrentToken current symbol}.

ctx
ParserRuleContext ctx()
Undocumented in source. Be warned that the author may not have intended to support it.
ctx
void ctx(ParserRuleContext ctx)
Undocumented in source. Be warned that the author may not have intended to support it.
dumpDFA
void dumpDFA()

@uml For debugging and other purposes.

enterOuterAlt
void enterOuterAlt(ParserRuleContext localctx, int altNum)
Undocumented in source. Be warned that the author may not have intended to support it.
enterRecursionRule
void enterRecursionRule(ParserRuleContext localctx, int ruleIndex)

@uml . @deprecated Use {@link #enterRecursionRule(ParserRuleContext, int, int, int)} instead.

enterRecursionRule
void enterRecursionRule(ParserRuleContext localctx, int state, int ruleIndex, int precedence)
Undocumented in source. Be warned that the author may not have intended to support it.
enterRule
void enterRule(ParserRuleContext localctx, int state, int ruleIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
exitRule
void exitRule()
Undocumented in source. Be warned that the author may not have intended to support it.
getATNWithBypassAlts
ATN getATNWithBypassAlts()

@uml The ATN with bypass alternatives is expensive to create so we create it lazily.

getBuildParseTree
bool getBuildParseTree()

@uml Gets whether or not a complete parse tree will be constructed while parsing. This property is {@code true} for a newly constructed parser.

getCurrentToken
Token getCurrentToken()

@uml Match needs to return the current input symbol, which gets put into the label for the associated token ref; e.g., x=ID.

getDFAStrings
string[] getDFAStrings()

@uml For debugging and other purposes.

getErrorHandler
auto getErrorHandler()
Undocumented in source. Be warned that the author may not have intended to support it.
getExpectedTokens
IntervalSet getExpectedTokens()

@uml Computes the set of input symbols which could follow the current parser state and context, as given by {@link #getState} and {@link #getContext}, espectively.

getExpectedTokensWithinCurrentRule
IntervalSet getExpectedTokensWithinCurrentRule()
Undocumented in source. Be warned that the author may not have intended to support it.
getInputStream
TokenStream getInputStream()

@uml @override

getInvokingContext
ParserRuleContext getInvokingContext(int ruleIndex)
Undocumented in source. Be warned that the author may not have intended to support it.
getParseInfo
ParseInfo getParseInfo()

@uml @override

getParseListeners
ParseTreeListener[] getParseListeners()
Undocumented in source. Be warned that the author may not have intended to support it.
getPrecedence
int getPrecedence()

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

getRuleContext
ParserRuleContext getRuleContext()
Undocumented in source. Be warned that the author may not have intended to support it.
getRuleIndex
int getRuleIndex(string ruleName)

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

getRuleInvocationStack
string[] getRuleInvocationStack()

@uml 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.

getRuleInvocationStack
string[] getRuleInvocationStack(RuleContext p)
Undocumented in source. Be warned that the author may not have intended to support it.
getSourceName
string getSourceName()
Undocumented in source. Be warned that the author may not have intended to support it.
getTokenStream
TokenStream getTokenStream()
Undocumented in source. Be warned that the author may not have intended to support it.
getTrimParseTree
bool getTrimParseTree()

@uml The @return {@code true} if the {@link ParserRuleContext#children} list is trimed using the default {@link Parser.TrimToSizeListener} during the parse process.

inContext
bool inContext(string context)
Undocumented in source. Be warned that the author may not have intended to support it.
isExpectedToken
bool isExpectedToken(int symbol)

@uml Checks whether or not {@code 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.

isMatchedEOF
bool isMatchedEOF()
Undocumented in source. Be warned that the author may not have intended to support it.
isTrace
bool isTrace()

@uml Gets whether a {@link TraceListener} is registered as a parse listener for the parser.

match
Token match(int ttype)

@uml Match current input symbol against {@code ttype}. If the symbol type matches, {@link ANTLRErrorStrategy#reportMatch} and {@link #consume} are called to complete the match process.

matchWildcard
Token matchWildcard()

@uml Match current input symbol as a wildcard. If the symbol type matches (i.e. has a value greater than 0), {@link ANTLRErrorStrategy#reportMatch} and {@link #consume} are called to complete the match process.

notifyErrorListeners
void notifyErrorListeners(string msg)

@uml @final

notifyErrorListeners
void notifyErrorListeners(Token offendingToken, string msg, RecognitionException e)
Undocumented in source. Be warned that the author may not have intended to support it.
numberOfSyntaxErrors
int numberOfSyntaxErrors()
Undocumented in source. Be warned that the author may not have intended to support it.
precpred
bool precpred(InterfaceRuleContext localctx, int precedence)

@uml @override

pushNewRecursionContext
void pushNewRecursionContext(ParserRuleContext localctx, int state, size_t ruleIndex)

@uml Like {@link #enterRule} but for recursive rules. Make the current context the child of the incoming localctx.

removeParseListener
void removeParseListener(ParseTreeListener listener)
Undocumented in source. Be warned that the author may not have intended to support it.
removeParseListeners
void removeParseListeners()

@uml Remove all parse listeners.

reset
void reset()

@uml reset the parser's state

setBuildParseTree
void setBuildParseTree(bool buildParseTrees)

@uml Track the {@link ParserRuleContext} objects during the parse and hook them up using the {@link ParserRuleContext#children} list so that it forms a parse tree. The {@link ParserRuleContext} returned from the start rule represents the root of the parse tree.

setErrorHandler
void setErrorHandler(ANTLRErrorStrategy handler)
Undocumented in source. Be warned that the author may not have intended to support it.
setInputStream
void setInputStream(IntStream input)

@uml @override

setProfile
void setProfile(bool profile)
Undocumented in source. Be warned that the author may not have intended to support it.
setTokenStream
void setTokenStream(TokenStream input)

@uml Set the token stream and reset the parser.

setTrace
void setTrace(bool trace)
Undocumented in source. Be warned that the author may not have intended to support it.
setTrimParseTree
void setTrimParseTree(bool trimParseTrees)

@uml Trim the internal lists of the parse tree during parsing to conserve memory. This property is set to {@code false} by default for a newly constructed parser.

tokenFactory
TokenFactory!CommonToken tokenFactory()

@uml @override

tokenFactory
void tokenFactory(TokenFactory!CommonToken factory)

Tell our token source and error strategy about a new way to create tokens. @uml @override

triggerEnterRuleEvent
void triggerEnterRuleEvent()

@uml Notify any parse listeners of an enter rule event.

triggerExitRuleEvent
void triggerExitRuleEvent()

@uml Notify any parse listeners of an exit rule event.

unrollRecursionContexts
void unrollRecursionContexts(ParserRuleContext _parentctx)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_buildParseTrees
bool _buildParseTrees;

@uml Specifies whether or not the parser should construct a parse tree during the parsing process. The default value is {@code true}.

_errHandler
ANTLRErrorStrategy _errHandler;
Undocumented in source.
_input
TokenStream _input;
Undocumented in source.
_parseListeners
ParseTreeListener[] _parseListeners;

@uml The list of {@link ParseTreeListener} listeners registered to receive events during the parse.

_precedenceStack
IntegerStack _precedenceStack;
Undocumented in source.
_tracer
TraceListener _tracer;
Undocumented in source.
ctx_
ParserRuleContext ctx_;

@uml The {@link ParserRuleContext} object for the currently executing rule. This is always non-null during the parsing process. @read @write

matchedEOF
bool matchedEOF;

@uml Indicates parser has match()ed EOF token. See {@link #exitRule()}.

Inherited Members

From InterfaceParser

getRuleInvocationStack
string[] getRuleInvocationStack(RuleContext ruleContext)
Undocumented in source.
getRuleNames
string[] getRuleNames()
Undocumented in source.
getTokenStream
TokenStream getTokenStream()
Undocumented in source.
notifyErrorListeners
void notifyErrorListeners(string msg)
Undocumented in source.

Meta