

Public Member Functions | |
| ANTLRStringStream (string input) | |
| Initializes a new instance of the ANTLRStringStream class for the specified string. This copies data from the string to a local character array. | |
| ANTLRStringStream (char[] data, int numberOfActualCharsInArray) | |
| Initializes a new instance of the ANTLRStringStream class for the specified character array. This is the preferred constructor as no data is copied. | |
| virtual void | Reset () |
| Resets the stream so that it is in the same state it was when the object was created *except* the data array is not touched. | |
| virtual void | Consume () |
| Advances the read position of the stream. Updates line and column state. | |
| virtual int | LA (int i) |
| Return lookahead characters at the specified offset from the current read position. The lookahead offset can be negative. | |
| virtual int | LT (int i) |
| Get the ith character of lookahead. This is usually the same as LA(i). This will be used for labels in the generated lexer code. I'd prefer to return a char here type-wise, but it's probably better to be 32-bit clean and be consistent with LA. | |
| virtual int | Index () |
| Return the current input symbol index 0..n where n indicates the. | |
| virtual int | Size () |
| Returns the size of the stream. | |
| virtual int | Mark () |
| Tell the stream to start buffering if it hasn't already. | |
| virtual void | Rewind (int m) |
| virtual void | Rewind () |
| Rewind to the input position of the last marker. | |
| virtual void | Release (int marker) |
| virtual void | Seek (int index) |
| Seeks to the specified position. | |
| virtual string | Substring (int start, int stop) |
Protected Member Functions | |
| ANTLRStringStream () | |
| Initializes a new instance of the ANTLRStringStream class. | |
Protected Attributes | |
| internal char[] | data |
| The data for the stream. | |
| int | n |
| How many characters are actually in the buffer? | |
| internal int | p = 0 |
| Index in our array for the next char (0..n-1). | |
| internal int | line = 1 |
| Current line number within the input (1..n ). | |
| internal int | charPositionInLine = 0 |
| The index of the character relative to the beginning of the line (0..n-1). | |
| internal int | markDepth = 0 |
| Tracks the depth of nested IIntStream.Mark calls. | |
| internal IList | markers |
| A list of CharStreamState objects that tracks the stream state (i.e. line, charPositionInLine, and p) that can change as you move through the input stream. Indexed from 1..markDepth. A null is kept @ index 0. Create upon first call to Mark(). | |
| int | lastMarker |
| Track the last Mark() call result value for use in Rewind(). | |
| string | name |
| What is name or source of this char stream? | |
Properties | |
| virtual int | Line [get, set] |
| Current line position in stream. | |
| virtual int | CharPositionInLine [get, set] |
| Current character position on the current line stream (i.e. columnn position). | |
| virtual string | SourceName [get, set] |
| 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 46 of file ANTLRStringStream.cs.
| Antlr.Runtime.ANTLRStringStream.ANTLRStringStream | ( | ) | [protected] |
Initializes a new instance of the ANTLRStringStream class.
Definition at line 53 of file ANTLRStringStream.cs.
| Antlr.Runtime.ANTLRStringStream.ANTLRStringStream | ( | string | input | ) |
Initializes a new instance of the ANTLRStringStream class for the specified string. This copies data from the string to a local character array.
Definition at line 62 of file ANTLRStringStream.cs.
| Antlr.Runtime.ANTLRStringStream.ANTLRStringStream | ( | char[] | data, | |
| int | numberOfActualCharsInArray | |||
| ) |
Initializes a new instance of the ANTLRStringStream class for the specified character array. This is the preferred constructor as no data is copied.
Definition at line 73 of file ANTLRStringStream.cs.
| virtual void Antlr.Runtime.ANTLRStringStream.Reset | ( | ) | [virtual] |
Resets the stream so that it is in the same state it was when the object was created *except* the data array is not touched.
Definition at line 109 of file ANTLRStringStream.cs.
| virtual void Antlr.Runtime.ANTLRStringStream.Consume | ( | ) | [virtual] |
Advances the read position of the stream. Updates line and column state.
Implements Antlr.Runtime.IIntStream.
Definition at line 120 of file ANTLRStringStream.cs.
| virtual int Antlr.Runtime.ANTLRStringStream.LA | ( | int | i | ) | [virtual] |
Return lookahead characters at the specified offset from the current read position. The lookahead offset can be negative.
Implements Antlr.Runtime.IIntStream.
Definition at line 138 of file ANTLRStringStream.cs.
| virtual int Antlr.Runtime.ANTLRStringStream.LT | ( | int | i | ) | [virtual] |
Get the ith character of lookahead. This is usually the same as LA(i). This will be used for labels in the generated lexer code. I'd prefer to return a char here type-wise, but it's probably better to be 32-bit clean and be consistent with LA.
Implements Antlr.Runtime.ICharStream.
Definition at line 160 of file ANTLRStringStream.cs.
| virtual int Antlr.Runtime.ANTLRStringStream.Index | ( | ) | [virtual] |
Return the current input symbol index 0..n where n indicates the.
last symbol has been read. The index is the index of char to be returned from LA(1).
Implements Antlr.Runtime.IIntStream.
Definition at line 170 of file ANTLRStringStream.cs.
| virtual int Antlr.Runtime.ANTLRStringStream.Size | ( | ) | [virtual] |
Returns the size of the stream.
Implements Antlr.Runtime.IIntStream.
Definition at line 178 of file ANTLRStringStream.cs.
| virtual int Antlr.Runtime.ANTLRStringStream.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 183 of file ANTLRStringStream.cs.
| virtual void Antlr.Runtime.ANTLRStringStream.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 208 of file ANTLRStringStream.cs.
| virtual void Antlr.Runtime.ANTLRStringStream.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 218 of file ANTLRStringStream.cs.
| virtual void Antlr.Runtime.ANTLRStringStream.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 223 of file ANTLRStringStream.cs.
| virtual void Antlr.Runtime.ANTLRStringStream.Seek | ( | int | index | ) | [virtual] |
Seeks to the specified position.
Consume ahead until p==index; can't just set p=index as we must update line and charPositionInLine.
Implements Antlr.Runtime.IIntStream.
Definition at line 236 of file ANTLRStringStream.cs.
| virtual string Antlr.Runtime.ANTLRStringStream.Substring | ( | int | start, | |
| int | stop | |||
| ) | [virtual] |
This primarily a useful interface for action code (just make sure actions don't use this on streams that don't support it). For infinite streams, you don't need this.
Implements Antlr.Runtime.ICharStream.
Definition at line 250 of file ANTLRStringStream.cs.
internal char [] Antlr.Runtime.ANTLRStringStream.data [protected] |
int Antlr.Runtime.ANTLRStringStream.n [protected] |
How many characters are actually in the buffer?
Definition at line 269 of file ANTLRStringStream.cs.
internal int Antlr.Runtime.ANTLRStringStream.p = 0 [protected] |
internal int Antlr.Runtime.ANTLRStringStream.line = 1 [protected] |
internal int Antlr.Runtime.ANTLRStringStream.charPositionInLine = 0 [protected] |
The index of the character relative to the beginning of the line (0..n-1).
Definition at line 282 of file ANTLRStringStream.cs.
internal int Antlr.Runtime.ANTLRStringStream.markDepth = 0 [protected] |
Tracks the depth of nested IIntStream.Mark calls.
Definition at line 287 of file ANTLRStringStream.cs.
internal IList Antlr.Runtime.ANTLRStringStream.markers [protected] |
A list of CharStreamState objects that tracks the stream state (i.e. line, charPositionInLine, and p) that can change as you move through the input stream. Indexed from 1..markDepth. A null is kept @ index 0. Create upon first call to Mark().
Definition at line 295 of file ANTLRStringStream.cs.
int Antlr.Runtime.ANTLRStringStream.lastMarker [protected] |
Track the last Mark() call result value for use in Rewind().
Definition at line 300 of file ANTLRStringStream.cs.
string Antlr.Runtime.ANTLRStringStream.name [protected] |
virtual int Antlr.Runtime.ANTLRStringStream.Line [get, set] |
Current line position in stream.
Implements Antlr.Runtime.ICharStream.
Definition at line 87 of file ANTLRStringStream.cs.
virtual int Antlr.Runtime.ANTLRStringStream.CharPositionInLine [get, set] |
Current character position on the current line stream (i.e. columnn position).
Implements Antlr.Runtime.ICharStream.
Definition at line 98 of file ANTLRStringStream.cs.
virtual string Antlr.Runtime.ANTLRStringStream.SourceName [get, set] |
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.
Reimplemented in Antlr.Runtime.ANTLRFileStream.
Definition at line 255 of file ANTLRStringStream.cs.
1.5.5