

Public Member Functions | |
| DebugTokenStream (ITokenStream input, IDebugEventListener dbg) | |
| virtual void | Consume () |
| virtual IToken | LT (int i) |
| Get Token at current input pointer + i ahead (where i=1 is next Token). i < 0 indicates tokens in the past. So -1 is previous token and -2 is two tokens ago. LT(0) is undefined. For i>=n, return Token.EOFToken. Return null for LT(0) and any index that results in an absolute address that is negative. | |
| virtual int | LA (int i) |
| virtual IToken | Get (int i) |
| Get a token at an absolute index i; 0..n-1. This is really only needed for profiling and debugging and token stream rewriting. If you don't want to buffer up tokens, then this method makes no sense for you. Naturally you can't use the rewrite stream feature. I believe DebugTokenStream can easily be altered to not use this method, removing the dependency. | |
| virtual int | Mark () |
| Tell the stream to start buffering if it hasn't already. | |
| virtual int | Index () |
| virtual void | Rewind (int marker) |
| virtual void | Rewind () |
| Rewind to the input position of the last marker. | |
| virtual void | Release (int marker) |
| virtual void | Seek (int index) |
| virtual int | Size () |
| Returns the size of the entire stream. | |
| override string | ToString () |
| virtual string | ToString (int start, int stop) |
| Return the text of all tokens from start to stop, inclusive. If the stream does not buffer all the tokens then it can just return "" or null; Users should not access $ruleLabel.text in an action of course in that case. | |
| virtual string | ToString (IToken start, IToken stop) |
| Because the user is not required to use a token with an index stored in it, we must provide a means for two token objects themselves to indicate the start/end location. Most often this will just delegate to the other toString(int,int). This is also parallel with the TreeNodeStream.toString(Object,Object). | |
Public Attributes | |
| ITokenStream | input |
Protected Member Functions | |
| virtual internal void | ConsumeInitialHiddenTokens () |
| consume all initial off-channel tokens | |
Protected Attributes | |
| internal IDebugEventListener | dbg |
| internal bool | initialStreamState = true |
| int | lastMarker |
| Track the last Mark() call result value for use in Rewind(). | |
Properties | |
| virtual IDebugEventListener | DebugListener [set] |
| virtual ITokenSource | TokenSource [get] |
| Where is this stream pulling tokens from? This is not the name, but the object that provides Token objects. | |
| virtual string | SourceName [get] |
| Where are you getting symbols from? Normally, implementations will pass the buck all the way to the lexer who can ask its input stream for the file name or whatever. | |
Definition at line 41 of file DebugTokenStream.cs.
| Antlr.Runtime.Debug.DebugTokenStream.DebugTokenStream | ( | ITokenStream | input, | |
| IDebugEventListener | dbg | |||
| ) |
Definition at line 56 of file DebugTokenStream.cs.
| virtual void Antlr.Runtime.Debug.DebugTokenStream.Consume | ( | ) | [virtual] |
| virtual internal void Antlr.Runtime.Debug.DebugTokenStream.ConsumeInitialHiddenTokens | ( | ) | [protected, virtual] |
| virtual IToken Antlr.Runtime.Debug.DebugTokenStream.LT | ( | int | k | ) | [virtual] |
Get Token at current input pointer + i ahead (where i=1 is next Token). i < 0 indicates tokens in the past. So -1 is previous token and -2 is two tokens ago. LT(0) is undefined. For i>=n, return Token.EOFToken. Return null for LT(0) and any index that results in an absolute address that is negative.
Implements Antlr.Runtime.ITokenStream.
Definition at line 97 of file DebugTokenStream.cs.
| virtual int Antlr.Runtime.Debug.DebugTokenStream.LA | ( | int | i | ) | [virtual] |
Get int at current input pointer + i ahead (where i=1 is next int) Negative indexes are allowed. LA(-1) is previous token (token just matched). LA(-i) where i is before first token should yield -1, invalid char or EOF.
Implements Antlr.Runtime.IIntStream.
Definition at line 107 of file DebugTokenStream.cs.
| virtual IToken Antlr.Runtime.Debug.DebugTokenStream.Get | ( | int | i | ) | [virtual] |
Get a token at an absolute index i; 0..n-1. This is really only needed for profiling and debugging and token stream rewriting. If you don't want to buffer up tokens, then this method makes no sense for you. Naturally you can't use the rewrite stream feature. I believe DebugTokenStream can easily be altered to not use this method, removing the dependency.
Implements Antlr.Runtime.ITokenStream.
Definition at line 117 of file DebugTokenStream.cs.
| virtual int Antlr.Runtime.Debug.DebugTokenStream.Mark | ( | ) | [virtual] |
Tell the stream to start buffering if it hasn't already.
Executing Rewind(Mark()) on a stream should not affect the input position. The Lexer tracks line/col info as well as input index so its markers are not pure input indexes. Same for tree node streams.
Implements Antlr.Runtime.IIntStream.
Definition at line 122 of file DebugTokenStream.cs.
| virtual int Antlr.Runtime.Debug.DebugTokenStream.Index | ( | ) | [virtual] |
Return the current input symbol index 0..n where n indicates the last symbol has been read. The index is the symbol about to be read not the most recently read symbol.
Implements Antlr.Runtime.IIntStream.
Definition at line 129 of file DebugTokenStream.cs.
| virtual void Antlr.Runtime.Debug.DebugTokenStream.Rewind | ( | int | marker | ) | [virtual] |
Resets the stream so that the next call to IIntStream.Index would return marker.
The marker will usually be IIntStream.Index but it doesn't have to be. It's just a marker to indicate what state the stream was in. This is essentially calling IIntStream.Release and IIntStream.Seek. If there are other markers created after the specified marker, this routine must unroll them like a stack. Assumes the state the stream was in when this marker was created.
Implements Antlr.Runtime.IIntStream.
Definition at line 134 of file DebugTokenStream.cs.
| virtual void Antlr.Runtime.Debug.DebugTokenStream.Rewind | ( | ) | [virtual] |
Rewind to the input position of the last marker.
Used currently only after a cyclic DFA and just before starting a sem/syn predicate to get the input position back to the start of the decision. Do not "pop" the marker off the state. Mark(i) and Rewind(i) should balance still. It is like invoking Rewind(last marker) but it should not "pop" the marker off. It's like Seek(last marker's input position).
Implements Antlr.Runtime.IIntStream.
Definition at line 140 of file DebugTokenStream.cs.
| virtual void Antlr.Runtime.Debug.DebugTokenStream.Release | ( | int | marker | ) | [virtual] |
You may want to commit to a backtrack but don't want to force the stream to keep bookkeeping objects around for a marker that is no longer necessary. This will have the same behavior as IIntStream.Rewind(int) except it releases resources without the backward seek.
This must throw away resources for all markers back to the marker argument. So if you're nested 5 levels of Mark(), and then Release(2) you have to release resources for depths 2..5.
Implements Antlr.Runtime.IIntStream.
Definition at line 146 of file DebugTokenStream.cs.
| virtual void Antlr.Runtime.Debug.DebugTokenStream.Seek | ( | int | index | ) | [virtual] |
Set the input cursor to the position indicated by index. This is normally used to seek ahead in the input stream.
No buffering is required to do this unless you know your stream will use seek to move backwards such as when backtracking. This is different from rewind in its multi-directional requirement and in that its argument is strictly an input cursor (index). For char streams, seeking forward must update the stream state such as line number. For seeking backwards, you will be presumably backtracking using the IIntStream.Mark/IIntStream.Rewind(int) mechanism that restores state and so this method does not need to update state when seeking backwards. Currently, this method is only used for efficient backtracking using memoization, but in the future it may be used for incremental parsing.
The index is 0..n-1. A seek to position i means that LA(1) will return the ith symbol. So, seeking to 0 means LA(1) will return the first element in the stream.
Implements Antlr.Runtime.IIntStream.
Definition at line 150 of file DebugTokenStream.cs.
| virtual int Antlr.Runtime.Debug.DebugTokenStream.Size | ( | ) | [virtual] |
Returns the size of the entire stream.
Only makes sense for streams that buffer everything up probably, but might be useful to display the entire stream or for testing. This value includes a single EOF.
Implements Antlr.Runtime.IIntStream.
Definition at line 155 of file DebugTokenStream.cs.
| override string Antlr.Runtime.Debug.DebugTokenStream.ToString | ( | ) |
Definition at line 169 of file DebugTokenStream.cs.
| virtual string Antlr.Runtime.Debug.DebugTokenStream.ToString | ( | int | start, | |
| int | stop | |||
| ) | [virtual] |
Return the text of all tokens from start to stop, inclusive. If the stream does not buffer all the tokens then it can just return "" or null; Users should not access $ruleLabel.text in an action of course in that case.
Implements Antlr.Runtime.ITokenStream.
Definition at line 174 of file DebugTokenStream.cs.
| virtual string Antlr.Runtime.Debug.DebugTokenStream.ToString | ( | IToken | start, | |
| IToken | stop | |||
| ) | [virtual] |
Because the user is not required to use a token with an index stored in it, we must provide a means for two token objects themselves to indicate the start/end location. Most often this will just delegate to the other toString(int,int). This is also parallel with the TreeNodeStream.toString(Object,Object).
Implements Antlr.Runtime.ITokenStream.
Definition at line 179 of file DebugTokenStream.cs.
internal IDebugEventListener Antlr.Runtime.Debug.DebugTokenStream.dbg [protected] |
Definition at line 43 of file DebugTokenStream.cs.
Definition at line 44 of file DebugTokenStream.cs.
internal bool Antlr.Runtime.Debug.DebugTokenStream.initialStreamState = true [protected] |
Definition at line 45 of file DebugTokenStream.cs.
int Antlr.Runtime.Debug.DebugTokenStream.lastMarker [protected] |
Track the last Mark() call result value for use in Rewind().
Definition at line 49 of file DebugTokenStream.cs.
virtual IDebugEventListener Antlr.Runtime.Debug.DebugTokenStream.DebugListener [set] |
Definition at line 52 of file DebugTokenStream.cs.
virtual ITokenSource Antlr.Runtime.Debug.DebugTokenStream.TokenSource [get] |
Where is this stream pulling tokens from? This is not the name, but the object that provides Token objects.
Implements Antlr.Runtime.ITokenStream.
Definition at line 161 of file DebugTokenStream.cs.
virtual string Antlr.Runtime.Debug.DebugTokenStream.SourceName [get] |
Where are you getting symbols from? Normally, implementations will pass the buck all the way to the lexer who can ask its input stream for the file name or whatever.
Implements Antlr.Runtime.IIntStream.
Definition at line 165 of file DebugTokenStream.cs.
1.5.5