# Path: schemepy/skime/skime/types/symbol.py
# class Symbol(object):
#     symbols = weakref.WeakValueDictionary({})
# 
#     def __new__(cls, name):
#         """\
#         Get the interned symbol of name. If no found, create
#         a new interned symbol.
#         """
#         if cls.symbols.has_key(name):
#             return cls.symbols[name]
# 
#         sym = object.__new__(cls)
#         sym._name = name
#         cls.symbols[name] = sym
#         return sym
# 
#     def __eq__(self, other):
#         return self is other
#     def __ne__(self, other):
#         return not self.__eq__(other)
# 
#     def get_name(self):
#         return self._name
#     def set_name(self):
#         raise AttributeError("Can't modify name of a symbol.")
#     name = property(get_name, set_name)
# 
#     def __str__(self):
#         return self.name
#     def __repr__(self):
#         return "<symbol %s>" % self._name.__repr__()
# 
# Path: schemepy/skime/skime/types/pair.py
# class Pair(object):
#     """\
#     The Pair pair of Scheme.
# 
#     Pair can be chained to form a list. The Python value None acts as
#     end-of-list.
# 
#       Pair(1, Pair(2, None)) <==> '(1 2) <==> '(1 . (2 . ()))
#     """
#     __slots__ = ['first', 'rest']
# 
#     def __init__(self, first, rest):
#         self.first = first
#         self.rest = rest
# 
#     def get_car(self):
#         return self.first
#     def set_car(self, val):
#         self.first = val
#     def get_cdr(self):
#         return self.rest
#     def set_cdr(self, val):
#         self.rest = val
#     car = property(get_car, set_car)
#     cdr = property(get_cdr, set_cdr)
# 
#     def __eq__(self, other):
#         return isinstance(other, Pair) and \
#                self.first == other.first and \
#                self.rest == other.rest
#     def __ne__(self, other):
#         return not self.__eq__(other)
# 
#     def __str__(self):
#         segments = [self.first.__str__()]
#         elems = self.rest
# 
#         while isinstance(elems, Pair):
#             segments.append(elems.first.__str__())
#             elems = elems.rest
# 
#         if elems is not None:
#             segments.append(".")
#             segments.append(elems.__str__())
#         return '(' + ' '.join(segments) + ')'
# 
# Path: schemepy/skime/skime/errors.py
# class ParseError(CompileError):
#     pass


from ..types.symbol import Symbol as sym
from ..types.pair   import Pair as pair
from ..errors import ParseError


def parse(text, name="__unknown__"):
    "Parse a piece of text."
    return Parser(text, name).parse()

class Parser(object):
    "A simple recursive descent parser for Scheme."

# Path: schemepy/skime/skime/types/symbol.py
# class Symbol(object):
#     symbols = weakref.WeakValueDictionary({})
# 
#     def __new__(cls, name):
#         """\
#         Get the interned symbol of name. If no found, create
#         a new interned symbol.
#         """
#         if cls.symbols.has_key(name):
#             return cls.symbols[name]
# 
#         sym = object.__new__(cls)
#         sym._name = name
#         cls.symbols[name] = sym
#         return sym
# 
#     def __eq__(self, other):
#         return self is other
#     def __ne__(self, other):
#         return not self.__eq__(other)
# 
#     def get_name(self):
#         return self._name
#     def set_name(self):
#         raise AttributeError("Can't modify name of a symbol.")
#     name = property(get_name, set_name)
# 
#     def __str__(self):
#         return self.name
#     def __repr__(self):
#         return "<symbol %s>" % self._name.__repr__()
# 
# Path: schemepy/skime/skime/types/pair.py
# class Pair(object):
#     """\
#     The Pair pair of Scheme.
# 
#     Pair can be chained to form a list. The Python value None acts as
#     end-of-list.
# 
#       Pair(1, Pair(2, None)) <==> '(1 2) <==> '(1 . (2 . ()))
#     """
#     __slots__ = ['first', 'rest']
# 
#     def __init__(self, first, rest):
#         self.first = first
#         self.rest = rest
# 
#     def get_car(self):
#         return self.first
#     def set_car(self, val):
#         self.first = val
#     def get_cdr(self):
#         return self.rest
#     def set_cdr(self, val):
#         self.rest = val
#     car = property(get_car, set_car)
#     cdr = property(get_cdr, set_cdr)
# 
#     def __eq__(self, other):
#         return isinstance(other, Pair) and \
#                self.first == other.first and \
#                self.rest == other.rest
#     def __ne__(self, other):
#         return not self.__eq__(other)
# 
#     def __str__(self):
#         segments = [self.first.__str__()]
#         elems = self.rest
# 
#         while isinstance(elems, Pair):
#             segments.append(elems.first.__str__())
#             elems = elems.rest
# 
#         if elems is not None:
#             segments.append(".")
#             segments.append(elems.__str__())
#         return '(' + ' '.join(segments) + ')'
# 
# Path: schemepy/skime/skime/errors.py
# class ParseError(CompileError):
#     pass


# Path: schemepy/skime/skime/compiler/parser.py
from ..types.symbol import Symbol as sym
from ..types.pair   import Pair as pair
from ..errors import ParseError



def parse(text, name="__unknown__"):
    "Parse a piece of text."
    return Parser(text, name).parse()

class Parser(object):
    "A simple recursive descent parser for Scheme."

    sym_quote = sym("quote")