# Path: z80/_source.py
# class _SourcePos(object):
#     def __init__(self, offset, file):
#         self.__offset = offset
#         self.__file = file
# 
#     @property
#     def __coordinates(self):
#         return self.__file.get_coordinates(self.__offset)
# 
#     @property
#     def column_no(self):
#         line, line_no, column_no = self.__coordinates
#         return column_no
# 
#     @property
#     def inline_text(self):
#         line, line_no, column_no = self.__coordinates
#         return '%s:%s:%s' % (self.__file, line_no, column_no)
# 
#     def __str__(self):
#         return self.inline_text
# 
#     @property
#     def context_text(self):
#         line, line_no, column_no = self.__coordinates
#         return '%s\n%s^\n' % (line, ' ' * column_no)


import re
from ._source import _SourcePos
class _Token(object):
    def __init__(self, literal, pos):
        self.literal = literal
        self.pos = pos

    def __eq__(self, other):
        literal = other.literal if isinstance(other, _Token) else other
        return self.literal == literal

    def __repr__(self):
        return '%s: %s' % (self.pos, self.literal)

    def __str__(self):
        return self.literal

    @property
    def origin(self):
        return self.pos


class _Tokeniser(object):
    __WHITESPACE = re.compile(r'(\ |\t)+')
    __END_OF_LINE = re.compile(r'(\n|$)')

    def __init__(self, source_file):
        self.__source_file = source_file
        self.__image = self.__source_file.get_image()
        self.__offset = 0
        self.__token_offset = self.__offset


# Path: z80/_source.py
# class _SourcePos(object):
#     def __init__(self, offset, file):
#         self.__offset = offset
#         self.__file = file
# 
#     @property
#     def __coordinates(self):
#         return self.__file.get_coordinates(self.__offset)
# 
#     @property
#     def column_no(self):
#         line, line_no, column_no = self.__coordinates
#         return column_no
# 
#     @property
#     def inline_text(self):
#         line, line_no, column_no = self.__coordinates
#         return '%s:%s:%s' % (self.__file, line_no, column_no)
# 
#     def __str__(self):
#         return self.inline_text
# 
#     @property
#     def context_text(self):
#         line, line_no, column_no = self.__coordinates
#         return '%s\n%s^\n' % (line, ' ' * column_no)


# Path: z80/_token.py
import re
from ._source import _SourcePos

class _Token(object):
    def __init__(self, literal, pos):
        self.literal = literal
        self.pos = pos

    def __eq__(self, other):
        literal = other.literal if isinstance(other, _Token) else other
        return self.literal == literal

    def __repr__(self):
        return '%s: %s' % (self.pos, self.literal)

    def __str__(self):
        return self.literal

    @property
    def origin(self):
        return self.pos


class _Tokeniser(object):
    __WHITESPACE = re.compile(r'(\ |\t)+')
    __END_OF_LINE = re.compile(r'(\n|$)')

    def __init__(self, source_file):
        self.__source_file = source_file
        self.__image = self.__source_file.get_image()
        self.__offset = 0
        self.__token_offset = self.__offset


    @property