import os

from .character import Character

class Scanner(object):
    """docstring for Scanner."""
    ENDMARK = '\0'

    def __init__(self, source_text):
        super(Scanner, self).__init__()

        self.source_text = source_text
        self.last_index = len(source_text) - 1
        self.source_index = -1
        self.line_index = 0
        self.col_index = -1

    def get_next(self):
        self.source_index += 1

        if self.source_index > 0:
            if self.source_text[self.source_index-1] == os.linesep:  # the previous character was a newline
                self.line_index += 1
                self.col_index = -1

        self.col_index += 1

        if self.source_index > self.last_index: # end of source_text
            value = self.ENDMARK
        else:
            value = self.source_text[self.source_index]

        return Character(
            value,
            self.line_index,
            self.col_index,
            self.source_index
        )

    def peek_next(self):
        pass

@@ -997,32 +997,42 @@
 f peek_next(self
+, offset=1
 ):%0A        pass%0A
@@ -1030,9 +1030,835 @@
     
-pass
+source_index = self.source_index%0A        line_index = self.line_index%0A        col_index = self.col_index%0A%0A        source_index += 1%0A%0A        if source_index %3E 0:%0A            if self.source_text%5Bsource_index-1%5D == os.linesep:  # the previous character was a newline%0A                line_index += 1%0A                col_index = -1%0A%0A        col_index += 1%0A%0A        if source_index %3E self.last_index: # end of source_text%0A            value = self.ENDMARK%0A        else:%0A            value = self.source_text%5Bsource_index%5D%0A%0A        return Character(%0A            value,%0A            line_index,%0A            col_index,%0A            source_index%0A        )%0A%0A    def lookahead(self, offset=1):%0A        index = self.source_index + offset%0A%0A        if index %3E self.last_index:%0A            return self.ENDMARK%0A%0A        return self.source_text%5Bindex%5D
 %0A

fix peek_next method and create lookahead method