def mcompose(*mfuncs): return compose(unit, bind_compose(*mfuncs))
import ast import collections import operator from hornet.util import pairwise, identity, const, decrement from hornet.util import compose2 as compose from hornet.expressions import is_name, is_operator, is_tuple, is_astwrapper from hornet.expressions import lift, promote class ParseError(Exception): pass parse_error = compose('Precedence conflict: ({}) {} ({})'.format, ParseError) class Token(collections.namedtuple('BaseToken', 'lbp rbp node')): __slots__ = () def __lt__(self, other): return self.rbp < other.lbp def __gt__(self, other): return self.rbp > other.lbp @classmethod def fixity(cls, left, right):
def lift(func): return compose(func, unit)