def eat_length(self, length):
        """Move current position forward by length and sets eos if needed."""
        pos = self.pos
        if self.eos or pos + length > self.length:
            return None

        col = self.col
        row = self.row
        for char in self.string[pos:pos + length]:
            col += 1
            pos += 1
            if char == '\n':  # handle a newline char
                col = 0
                row += 1

        self.pos = pos
        self.col = col
        self.row = row

        if not self.has_space():  # Set eos if there is no more space left.
            self.eos = 1
def eat_length ( self , length ) : pos = self . pos if self . eos or pos + length > self . length : return None col = self . col row = self . row for char in self . string [ pos : pos + length ] : col += 1 pos += 1 if char == '\n' : col = 0 row += 1 self . pos = pos self . col = col self . row = row if not self . has_space ( ) : self . eos = 1
Move current position forward by length and sets eos if needed.