
Public Member Functions | |
| def | __init__ |
| def | setInput |
| def | reset |
| reset the parser's state; subclasses must rewinds the input stream | |
| def | match |
| Match current input symbol against ttype. | |
| def | matchAny |
| Match the wildcard: in a symbol. | |
| def | mismatchIsUnwantedToken |
| def | mismatchIsMissingToken |
| def | mismatch |
| Factor out what to do upon token mismatch so tree parsers can behave differently. | |
Public Attributes | |
| input | |
Static Public Attributes | |
| int | MEMO_RULE_FAILED = 2 |
| int | MEMO_RULE_UNKNOWN = 1 |
| DEFAULT_TOKEN_CHANNEL = DEFAULT_CHANNEL | |
| HIDDEN = HIDDEN_CHANNEL | |
| tokenNames = None | |
Private Attributes | |
| _state | |
| State of a lexer, parser, or tree parser are collected into a state object so the state can be shared. | |
A generic recognizer that can handle recognizers generated from lexer, parser, and tree grammars. This is all the parsing support code essentially; most of it is error recovery stuff and backtracking.
Definition at line 2428 of file antlr3.py.
| def antlr3.BaseRecognizer.__init__ | ( | self, | ||
state = None | ||||
| ) |
| def antlr3.BaseRecognizer.reset | ( | self | ) |
reset the parser's state; subclasses must rewinds the input stream
Reimplemented in antlr3.Lexer, and antlr3.Parser.
| def antlr3.BaseRecognizer.match | ( | self, | ||
| input, | ||||
| ttype, | ||||
| follow | ||||
| ) |
Match current input symbol against ttype.
Attempt single token insertion or deletion error recovery. If that fails, throw MismatchedTokenException.
To turn off single token insertion or deletion error recovery, override mismatchRecover() and have it call plain mismatch(), which does not recover. Then any error in a rule will cause an exception and immediate exit from rule. Rule would recover by resynchronizing to the set of symbols that can follow rule ref.
| def antlr3.BaseRecognizer.matchAny | ( | self, | ||
| input | ||||
| ) |
| def antlr3.BaseRecognizer.mismatchIsUnwantedToken | ( | self, | ||
| input, | ||||
| ttype | ||||
| ) |
| def antlr3.BaseRecognizer.mismatchIsMissingToken | ( | self, | ||
| input, | ||||
| follow | ||||
| ) |
| def antlr3.BaseRecognizer.mismatch | ( | self, | ||
| input, | ||||
| ttype, | ||||
| follow | ||||
| ) |
Factor out what to do upon token mismatch so tree parsers can behave differently.
Override and call mismatchRecover(input, ttype, follow) to get single token insertion and deletion. Use this to turn of single token insertion and deletion. Override mismatchRecover to call this instead.
int antlr3.BaseRecognizer.MEMO_RULE_FAILED = 2 [static] |
int antlr3.BaseRecognizer.MEMO_RULE_UNKNOWN = 1 [static] |
antlr3.BaseRecognizer.HIDDEN = HIDDEN_CHANNEL [static] |
antlr3.BaseRecognizer.tokenNames = None [static] |
antlr3.BaseRecognizer._state [private] |
State of a lexer, parser, or tree parser are collected into a state object so the state can be shared.
This sharing is needed to have one grammar import others and share same error variables and other state variables. It's a kind of explicit multiple inheritance via delegation of methods and shared state.
1.5.5