# Path: bigrig/parser/utils.py
# def is_identifier_start(char):
#     return char in IDENTIFIER_START_CHARS or ud.category(char) in IDENTIFIER_START_CLASSES
# 
# def is_identifier_part(char):
#     return char in IDENTIFIER_START_CHARS or ud.category(char) in IDENTIFIER_PART_CLASSES
# 
# def is_whitespace_char(char):
#     return char in WHITESPACE_CHARS or ud.category(char) == 'Zs'
# 
# def is_line_terminator(char):
#     return char in LINE_TERMINATOR_CHARS
# 
# class Locator(object):
#     """
#     Contains source location tracking information.
#     """
#     __slots__ = ('filename', 'line', 'column', 'offset')
#     def __init__(self, filename, line, column, offset):
#         self.filename = filename
#         self.line = line
#         self.column = column
#         self.offset = offset
# 
#     def __repr__(self):
#         return '<%s line %d, column %d>' % (self.filename, self.line, self.column)
# 
# class Stream(object):
#     """
#     A light wrapper on a codecs.Reader object that provides position tracking
#     and a peek method.
#     """
#     def __init__(self, stream, offset=0):
#         self.stream = stream
#         self.offset = offset
#         self.next_char = None
#         self.next()
# 
#     def peek(self):
#         return self.next_char
# 
#     def next(self):
#         char = self.next_char
#         self.next_char = self.stream.read(chars=1)
#         return char


from .token import *
from .constants import *
from .utils import (
    is_identifier_start, is_identifier_part, is_whitespace_char,
    is_line_terminator, Locator, Stream
)
        from cStringIO import StringIO
        from StringIO import StringIO
    import codecs
    def advance(self):
        """
        Move the state forward one character.

        Note that this sets up location tracking and increments the
        column count.
        """
        self.buffer.append(self.stream.next())
        self.column += 1
        if self.locator is None:
            self.locator = self.make_locator()

    def make_token(self, type):
        """
        Make a lexical token with the given type using the stored state.
        """
        value = u''.join(self.buffer)
        token = Token(type, value, self.locator)
        self.buffer = []
        self.locator = None
        return token

    def make_invalid_token(self):
        """
        A quick shortcut to produce an INVALID token when the peeked char is
        invalid in the current context.
        """
        self.advance()
        return self.make_token(INVALID)


# Path: bigrig/parser/utils.py
# def is_identifier_start(char):
#     return char in IDENTIFIER_START_CHARS or ud.category(char) in IDENTIFIER_START_CLASSES
# 
# def is_identifier_part(char):
#     return char in IDENTIFIER_START_CHARS or ud.category(char) in IDENTIFIER_PART_CLASSES
# 
# def is_whitespace_char(char):
#     return char in WHITESPACE_CHARS or ud.category(char) == 'Zs'
# 
# def is_line_terminator(char):
#     return char in LINE_TERMINATOR_CHARS
# 
# class Locator(object):
#     """
#     Contains source location tracking information.
#     """
#     __slots__ = ('filename', 'line', 'column', 'offset')
#     def __init__(self, filename, line, column, offset):
#         self.filename = filename
#         self.line = line
#         self.column = column
#         self.offset = offset
# 
#     def __repr__(self):
#         return '<%s line %d, column %d>' % (self.filename, self.line, self.column)
# 
# class Stream(object):
#     """
#     A light wrapper on a codecs.Reader object that provides position tracking
#     and a peek method.
#     """
#     def __init__(self, stream, offset=0):
#         self.stream = stream
#         self.offset = offset
#         self.next_char = None
#         self.next()
# 
#     def peek(self):
#         return self.next_char
# 
#     def next(self):
#         char = self.next_char
#         self.next_char = self.stream.read(chars=1)
#         return char


# Path: bigrig/parser/scanner.py
from .token import *
from .constants import *
from .utils import (
    is_identifier_start, is_identifier_part, is_whitespace_char,
    is_line_terminator, Locator, Stream
)
        from cStringIO import StringIO
        from StringIO import StringIO
    import codecs

    def advance(self):
        """
        Move the state forward one character.

        Note that this sets up location tracking and increments the
        column count.
        """
        self.buffer.append(self.stream.next())
        self.column += 1
        if self.locator is None:
            self.locator = self.make_locator()

    def make_token(self, type):
        """
        Make a lexical token with the given type using the stored state.
        """
        value = u''.join(self.buffer)
        token = Token(type, value, self.locator)
        self.buffer = []
        self.locator = None
        return token

    def make_invalid_token(self):
        """
        A quick shortcut to produce an INVALID token when the peeked char is
        invalid in the current context.
        """
        self.advance()
        return self.make_token(INVALID)


    def is_whitespace_char(self, char):