Classes | |
class | BacktrackingFailed |
Raised to signal failed backtrack attempt. More... | |
class | RecognitionException |
The root of the ANTLR exception hierarchy. More... | |
class | MismatchedTokenException |
A mismatched char or Token or tree node. More... | |
class | UnwantedTokenException |
An extra token while parsing a TokenStream. More... | |
class | MissingTokenException |
We were expecting a token but it's not found. More... | |
class | MismatchedRangeException |
The next token does not match a range of expected types. More... | |
class | MismatchedSetException |
The next token does not match a set of expected types. More... | |
class | MismatchedNotSetException |
Used for remote debugger deserialization. More... | |
class | NoViableAltException |
Unable to decide which alternative to choose. More... | |
class | EarlyExitException |
The recognizer did not match anything for a (. More... | |
class | FailedPredicateException |
A semantic predicate failed during validation. More... | |
class | MismatchedTreeNodeException |
The next tree mode does not match the expected type. More... | |
class | Token |
Abstract token baseclass. More... | |
class | CommonToken |
Basic token implementation. More... | |
class | ClassicToken |
Alternative token implementation. More... | |
class | IntStream |
Base interface for streams of integer values. More... | |
class | CharStream |
A source of characters for an ANTLR lexer. More... | |
class | TokenStream |
A stream of tokens accessing tokens from a TokenSource. More... | |
class | ANTLRStringStream |
CharStream that pull data from a unicode string. More... | |
class | ANTLRFileStream |
CharStream that opens a file to read the data. More... | |
class | ANTLRInputStream |
CharStream that reads data from a file-like object. More... | |
class | CommonTokenStream |
The most common stream of tokens. More... | |
class | RewriteOperation |
Internal helper class. More... | |
class | InsertBeforeOp |
Internal helper class. More... | |
class | ReplaceOp |
Internal helper class. More... | |
class | DeleteOp |
Internal helper class. More... | |
class | TokenRewriteStream |
CommonTokenStream that can be modified. More... | |
class | RecognizerSharedState |
The set of fields needed by an abstract recognizer to recognize input and recover from errors etc. More... | |
class | BaseRecognizer |
Common recognizer functionality. More... | |
class | TokenSource |
Abstract baseclass for token producers. More... | |
class | Lexer |
Baseclass for generated lexer classes. More... | |
class | Parser |
Baseclass for generated parser classes. More... | |
class | RuleReturnScope |
Rules can return start/stop info as well as possible trees and templates. More... | |
class | ParserRuleReturnScope |
Rules that return more than a single value must return an object containing all the values. More... | |
Packages | |
package | tree |
ANTLR3 runtime package, tree module. | |
package | treewizard |
Functions | |
def | version_str_to_tuple |
def | consumeUntil |
def recoverFromMissingElement(self, input, e, follow): """ This code is factored out from mismatched token and mismatched set recovery. | |
def | getRuleInvocationStack |
def | _getRuleInvocationStack |
A more general version of getRuleInvocationStack where you can pass in, for example, a RecognitionException to get it's rule stack trace. | |
def | getBacktrackingLevel |
def | setBacktrackingLevel |
def | failed |
Return whether or not a backtracking attempt failed. | |
def | getGrammarFileName |
For debugging and other purposes, might want the grammar name. | |
def | getSourceName |
def | toStrings |
A convenience method for use most often with template rewrites. | |
def | getRuleMemoization |
Given a rule number and a start token index number, return MEMO_RULE_UNKNOWN if the rule has not parsed input starting from start index. | |
def | alreadyParsedRule |
Has this rule already parsed input at the current index in the input stream? Return the stop token index or MEMO_RULE_UNKNOWN. | |
def | memoize |
Record whether or not this rule parsed the input at this position successfully. | |
def | traceIn |
def | traceOut |
Variables | |
string | __version__ = '3.1.3' |
runtime_version_str = __version__ | |
tuple | runtime_version = version_str_to_tuple(runtime_version_str) |
int | EOF = 1 |
int | DEFAULT_CHANNEL = 0 |
All tokens go to the parser (unless skip() is called in that rule) on a particular "channel". | |
int | HIDDEN_CHANNEL = 99 |
Anything on different channel than DEFAULT_CHANNEL is not parsed by parser. | |
int | EOR_TOKEN_TYPE = 1 |
int | DOWN = 2 |
imaginary tree navigation type; traverse "get child" link | |
int | UP = 3 |
imaginary tree navigation type; finish with a child list | |
int | MIN_TOKEN_TYPE = 1 |
int | INVALID_TOKEN_TYPE = 0 |
tuple | EOF_TOKEN = CommonToken(type=EOF) |
tuple | INVALID_TOKEN = CommonToken(type=INVALID_TOKEN_TYPE) |
tuple | SKIP_TOKEN = CommonToken(type=INVALID_TOKEN_TYPE) |
StringStream = ANTLRStringStream | |
FileStream = ANTLRFileStream | |
InputStream = ANTLRInputStream | |
tuple | _getRuleInvocationStack = classmethod(_getRuleInvocationStack) |
This module contains all support classes, which are needed to use recognizers generated by ANTLR3.
def antlr3._getRuleInvocationStack | ( | cls, | ||
module | ||||
) | [private] |
A more general version of getRuleInvocationStack where you can pass in, for example, a RecognitionException to get it's rule stack trace.
This routine is shared with all recognizers, hence, static.
TODO: move to a utility class or something; weird having lexer call this
def antlr3.alreadyParsedRule | ( | self, | ||
input, | ||||
ruleIndex | ||||
) |
Has this rule already parsed input at the current index in the input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
If we attempted but failed to parse properly before, return MEMO_RULE_FAILED.
This method has a side-effect: if we have seen this input for this rule and successfully parsed before, then seek ahead to 1 past the stop token matched for this rule last time.
def antlr3.consumeUntil | ( | self, | ||
input, | ||||
tokenTypes | ||||
) |
def recoverFromMissingElement(self, input, e, follow): """ This code is factored out from mismatched token and mismatched set recovery.
It handles "single token insertion" error recovery for both. No tokens are consumed to recover from insertions. Return true if recovery was possible else return false. """ if self.mismatchIsMissingToken(input, follow): self.reportError(e) return True # nothing to do; throw exception return False Consume tokens until one matches the given token or token set
tokenTypes can be a single token type or a set of token types
def antlr3.failed | ( | self | ) |
def antlr3.getGrammarFileName | ( | self | ) |
def antlr3.getRuleMemoization | ( | self, | ||
ruleIndex, | ||||
ruleStartIndex | ||||
) |
Given a rule number and a start token index number, return MEMO_RULE_UNKNOWN if the rule has not parsed input starting from start index.
If this rule has parsed input starting from the start index before, then return where the rule stopped parsing. It returns the index of the last token matched by the rule.
def antlr3.memoize | ( | self, | ||
input, | ||||
ruleIndex, | ||||
ruleStartIndex, | ||||
success | ||||
) |
def antlr3.toStrings | ( | self, | ||
tokens | ||||
) |
def antlr3.traceIn | ( | self, | ||
ruleName, | ||||
ruleIndex, | ||||
inputSymbol | ||||
) |
def antlr3.traceOut | ( | self, | ||
ruleName, | ||||
ruleIndex, | ||||
inputSymbol | ||||
) |
string antlr3.__version__ = '3.1.3' |
tuple antlr3._getRuleInvocationStack = classmethod(_getRuleInvocationStack) |
int antlr3.DEFAULT_CHANNEL = 0 |
int antlr3.DOWN = 2 |
int antlr3.EOF = 1 |
tuple antlr3.EOF_TOKEN = CommonToken(type=EOF) |
int antlr3.EOR_TOKEN_TYPE = 1 |
int antlr3.HIDDEN_CHANNEL = 99 |
tuple antlr3.INVALID_TOKEN = CommonToken(type=INVALID_TOKEN_TYPE) |
int antlr3.INVALID_TOKEN_TYPE = 0 |
int antlr3.MIN_TOKEN_TYPE = 1 |
tuple antlr3.runtime_version = version_str_to_tuple(runtime_version_str) |
tuple antlr3.SKIP_TOKEN = CommonToken(type=INVALID_TOKEN_TYPE) |
int antlr3.UP = 3 |