Stream primitives: Module parsing.stream¶
-
class
pyrser.parsing.stream.Position(index, lineno, col_offset)¶ Bases:
tuple-
__getnewargs__(self)¶ Return self as a plain tuple. Used by copy and pickle.
-
__getstate__(self)¶ Exclude the OrderedDict from pickling
-
static
__new__(_cls, index, lineno, col_offset)¶ Create new instance of Position(index, lineno, col_offset)
-
__repr__(self)¶ Return a nicely formatted representation string
-
__slots__= ()¶
-
_asdict(self)¶ Return a new OrderedDict which maps field names to their values.
-
_fields= ('index', 'lineno', 'col_offset')¶
-
classmethod
_make(iterable, new= <built-in method __new__ of type object at 0x8490e0>, len= <built-in function len>)¶ Make a new Position object from a sequence or iterable
-
_replace(_self, kwds)¶ Return a new Position object replacing specified fields with new values
-
col_offset¶ Alias for field number 2
-
index¶ Alias for field number 0
-
lineno¶ Alias for field number 1
-
-
class
pyrser.parsing.stream.Cursor(position: pyrser.parsing.stream.Position=Position(index=0, lineno=1, col_offset=1))[source]¶ Bases:
objectA mutable position in a Stream.
It can be initialized or set from an immutable Position.
-
index¶ The current index of the cursor.
-
lineno¶ The current line number of the cursor.
-
col_offset¶ The current column offset of the cursor.
-
position¶ The current position of the cursor.
-
max_readed_position¶ The index of the deepest character readed.
-
-
class
pyrser.parsing.stream.Tag(stream: str, begin: int, end=0)[source]¶ Bases:
objectProvide capture facilities
-
class
pyrser.parsing.stream.Stream(content: str=None, name: str=None)[source]¶ Bases:
objectHelps keep track of stream processing progress.
-
name¶ Name of the stream.
-
eos_index¶ End Of Stream index.
-
index¶ The current position index.
-
lineno¶ The current position line number.
-
col_offset¶ The current position column offset.
-
peek_char¶ The current position character value.
-
last_readed_line¶ Usefull string to compute error message.
-