def __init__(self, parent:CharacterStream): CharacterStream.__init__(self, parent.name) # The stream from which we obtain the (absolute) characters. self._parent = parent # Keeps the first StreamPosition_ of the various indentation levels self._stack = [parent.copy_position()] # Keeps the StreamPosition_ of the current character, relative to the position in the top of the stack self.current_relative_position = StreamPosition(self.name, 0, 1, 1, 1) # Remembers whether the substream has finished reading self.relative_eof = False
def __init__(self, string, name="<string>"): CharacterStream.__init__(self, name) self.string = string self.current_stream_position = StreamPosition(self.name, 0, 1, 1, 1) self.stream_positions = [self.current_stream_position] self.eof = False