Public Member Functions | |
def | __init__ |
def | consume |
def | getCharPositionInLine |
def | getLine |
def | getSourceName |
def | index |
def | LA |
def | LT |
def | mark |
def | release |
def | reset |
def | rewind |
def | seek |
def | setCharPositionInLine |
def | setLine |
def | size |
def | substring |
Public Attributes | |
charPositionInLine | |
data | |
lastMarker | |
line | |
markDepth | |
n | |
name | |
p | |
strdata | |
Private Attributes | |
_markers |
@brief CharStream that pull data from a unicode string. A pretty quick CharStream that pulls all data from an array directly. Every method call counts in the lexer.
Definition at line 315 of file streams.py.
def rve_interface_gen.antlr3.streams.ANTLRStringStream.__init__ | ( | self, | |
data | |||
) |
@param data This should be a unicode string holding the data you want to parse. If you pass in a byte string, the Lexer will choke on non-ascii data.
Definition at line 325 of file streams.py.
Reimplemented from rve_interface_gen.antlr3.streams.IntStream.
Definition at line 376 of file streams.py.
Using setter/getter methods is deprecated. Use o.charPositionInLine instead.
Reimplemented from rve_interface_gen.antlr3.streams.CharStream.
Definition at line 490 of file streams.py.
Using setter/getter methods is deprecated. Use o.line instead.
Reimplemented from rve_interface_gen.antlr3.streams.CharStream.
Definition at line 485 of file streams.py.
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.
Reimplemented from rve_interface_gen.antlr3.streams.IntStream.
Reimplemented in rve_interface_gen.antlr3.streams.ANTLRFileStream.
Definition at line 511 of file streams.py.
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).
Reimplemented from rve_interface_gen.antlr3.streams.IntStream.
Definition at line 420 of file streams.py.
def rve_interface_gen.antlr3.streams.ANTLRStringStream.LA | ( | self, | |
i | |||
) |
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 / EOF.
Reimplemented from rve_interface_gen.antlr3.streams.IntStream.
Definition at line 393 of file streams.py.
def rve_interface_gen.antlr3.streams.ANTLRStringStream.LT | ( | self, | |
i | |||
) |
Get the ith character of lookahead. This is the same usually 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.
Reimplemented from rve_interface_gen.antlr3.streams.CharStream.
Definition at line 407 of file streams.py.
Tell the stream to start buffering if it hasn't already. Return current input position, index(), or some other marker so that when passed to rewind() you get back to the same spot. rewind(mark()) should not affect the input cursor. The Lexer track line/col info as well as input index so its markers are not pure input indexes. Same for tree node streams.
Reimplemented from rve_interface_gen.antlr3.streams.IntStream.
Definition at line 434 of file streams.py.
def rve_interface_gen.antlr3.streams.ANTLRStringStream.release | ( | self, | |
marker = None |
|||
) |
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 rewind() 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.
Reimplemented from rve_interface_gen.antlr3.streams.IntStream.
Definition at line 459 of file streams.py.
Reset the stream so that it's in the same state it was when the object was created *except* the data array is not touched.
Definition at line 363 of file streams.py.
def rve_interface_gen.antlr3.streams.ANTLRStringStream.rewind | ( | self, | |
marker = None |
|||
) |
Reset the stream so that next call to index would return marker. The marker will usually be 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 release() and seek(). If there are markers created after this marker argument, this routine must unroll them like a stack. Assume the state the stream was in when this marker was created. If marker is None: 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).
Reimplemented from rve_interface_gen.antlr3.streams.IntStream.
Definition at line 447 of file streams.py.
def rve_interface_gen.antlr3.streams.ANTLRStringStream.seek | ( | self, | |
index | |||
) |
consume() ahead until p==index; can't just set p=index as we must update line and charPositionInLine.
Reimplemented from rve_interface_gen.antlr3.streams.IntStream.
Definition at line 466 of file streams.py.
def rve_interface_gen.antlr3.streams.ANTLRStringStream.setCharPositionInLine | ( | self, | |
pos | |||
) |
Using setter/getter methods is deprecated. Use o.charPositionInLine instead.
Reimplemented from rve_interface_gen.antlr3.streams.CharStream.
Definition at line 503 of file streams.py.
def rve_interface_gen.antlr3.streams.ANTLRStringStream.setLine | ( | self, | |
line | |||
) |
Using setter/getter methods is deprecated. Use o.line instead.
Reimplemented from rve_interface_gen.antlr3.streams.CharStream.
Definition at line 498 of file streams.py.
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.
Reimplemented from rve_interface_gen.antlr3.streams.IntStream.
Definition at line 430 of file streams.py.
def rve_interface_gen.antlr3.streams.ANTLRStringStream.substring | ( | self, | |
start, | |||
stop | |||
) |
For infinite streams, you don't need this; primarily I'm providing a useful interface for action code. Just make sure actions don't use this on streams that don't support it.
Reimplemented from rve_interface_gen.antlr3.streams.CharStream.
Definition at line 481 of file streams.py.
Definition at line 330 of file streams.py.
Definition at line 330 of file streams.py.
Definition at line 330 of file streams.py.
Definition at line 330 of file streams.py.
Definition at line 330 of file streams.py.
Definition at line 330 of file streams.py.
Definition at line 330 of file streams.py.
Definition at line 330 of file streams.py.
Definition at line 330 of file streams.py.
Definition at line 330 of file streams.py.