

Public Member Functions | |
| Parser (ITokenStream input) | |
| Parser (ITokenStream input, RecognizerSharedState state) | |
| override void | Reset () |
| Reset the parser's state. Subclasses must rewind the input stream. | |
| virtual void | TraceIn (string ruleName, int ruleIndex) |
| virtual void | TraceOut (string ruleName, int ruleIndex) |
Protected Member Functions | |
| override object | GetCurrentInputSymbol (IIntStream input) |
| Match needs to return the current input symbol, which gets put into the label for the associated token ref; e.g., x=ID. Token and tree parsers need to return different objects. Rather than test for input stream type or change the IntStream interface, I use a simple method to ask the recognizer to tell me what the current input symbol is. | |
| override object | GetMissingSymbol (IIntStream input, RecognitionException e, int expectedTokenType, BitSet follow) |
| Conjure up a missing token during error recovery. | |
Protected Attributes | |
| internal ITokenStream | input |
Properties | |
| virtual ITokenStream | TokenStream [get, set] |
| Set the token stream and reset the parser. | |
| override string | SourceName [get] |
| For debugging and other purposes, might want the source name. Have ANTLR provide a hook for this property. | |
| override IIntStream | Input [get] |
Definition at line 43 of file Parser.cs.
| Antlr.Runtime.Parser.Parser | ( | ITokenStream | input | ) |
| Antlr.Runtime.Parser.Parser | ( | ITokenStream | input, | |
| RecognizerSharedState | state | |||
| ) |
| override void Antlr.Runtime.Parser.Reset | ( | ) | [virtual] |
Reset the parser's state. Subclasses must rewind the input stream.
Reimplemented from Antlr.Runtime.BaseRecognizer.
| override object Antlr.Runtime.Parser.GetCurrentInputSymbol | ( | IIntStream | input | ) | [protected, virtual] |
Match needs to return the current input symbol, which gets put into the label for the associated token ref; e.g., x=ID. Token and tree parsers need to return different objects. Rather than test for input stream type or change the IntStream interface, I use a simple method to ask the recognizer to tell me what the current input symbol is.
This is ignored for lexers.
Reimplemented from Antlr.Runtime.BaseRecognizer.
| override object Antlr.Runtime.Parser.GetMissingSymbol | ( | IIntStream | input, | |
| RecognitionException | e, | |||
| int | expectedTokenType, | |||
| BitSet | follow | |||
| ) | [protected, virtual] |
Conjure up a missing token during error recovery.
The recognizer attempts to recover from single missing symbols. But, actions might refer to that missing symbol. For example, x=ID {f($x);}. The action clearly assumes that there has been an identifier matched previously and that $x points at that token. If that token is missing, but the next token in the stream is what we want we assume that this token is missing and we keep going. Because we have to return some token to replace the missing token, we have to conjure one up. This method gives the user control over the tokens returned for missing tokens. Mostly, you will want to create something special for identifier tokens. For literals such as '{' and ',', the default action in the parser or tree parser works. It simply creates a CommonToken of the appropriate type. The text will be the token. If you change what tokens must be created by the lexer, override this method to create the appropriate tokens.
Reimplemented from Antlr.Runtime.BaseRecognizer.
| virtual void Antlr.Runtime.Parser.TraceIn | ( | string | ruleName, | |
| int | ruleIndex | |||
| ) | [virtual] |
| virtual void Antlr.Runtime.Parser.TraceOut | ( | string | ruleName, | |
| int | ruleIndex | |||
| ) | [virtual] |
internal ITokenStream Antlr.Runtime.Parser.input [protected] |
virtual ITokenStream Antlr.Runtime.Parser.TokenStream [get, set] |
override string Antlr.Runtime.Parser.SourceName [get] |
For debugging and other purposes, might want the source name. Have ANTLR provide a hook for this property.
Reimplemented from Antlr.Runtime.BaseRecognizer.
override IIntStream Antlr.Runtime.Parser.Input [get] |
1.5.5