Beispiel #1
0
 def __init__(self):
     super(TokenNamespace, self).__init__({
         ADD:
         lambda a, b: Add(And(a, b)),
         AND:
         And,
         OR:
         Or,
         APPLY:
         Apply,
         APPLY_RAW:
         lambda a, b: Apply(a, b, raw=True),
         NOT:
         Drop,
         KARGS:
         KApply,
         RAISE:
         lambda a, b: KApply(a, raise_error(b)),
         REPEAT:
         RepeatWrapper,
         FIRST:
         First,
         MAP:
         Map,
         REDUCE:
         None,
     })
Beispiel #2
0
 def __init__(self):
     super(TokenNamespace, self).__init__({
         ADD:       lambda a, b: Add(And(a, b)),
         AND:       And,
         OR:        Or,
         APPLY:     Apply,
         APPLY_RAW: lambda a, b: Apply(a, b, raw=True),
         NOT:       Drop,
         KARGS:     KApply,
         RAISE:     lambda a, b: KApply(a, raise_error(b)),
         REPEAT:    Repeat,
         FIRST:     First,
         MAP:       Map,
     })
Beispiel #3
0
 def __init__(self):
     # Handle circular dependencies
     from lepl.matchers.error import raise_error
     from lepl.matchers.derived import Space, Add, Apply, KApply, Drop, \
         Repeat, Map
     from lepl.matchers.combine import And, Or, First
     super(OperatorNamespace, self).__init__({
         SPACE_OPT: lambda a, b: And(a, Space()[0:,...], b),
         SPACE_REQ: lambda a, b: And(a, Space()[1:,...], b),
         ADD:       lambda a, b: Add(And(a, b)),
         AND:       And,
         OR:        Or,
         APPLY:     Apply,
         APPLY_RAW: lambda a, b: Apply(a, b, raw=True),
         NOT:       Drop,
         KARGS:     KApply,
         RAISE:     lambda a, b: KApply(a, raise_error(b)),
         REPEAT:    Repeat,
         FIRST:     First,
         MAP:       Map
     })
Beispiel #4
0
 def __init__(self):
     # Handle circular dependencies
     from lepl.matchers.error import raise_error
     from lepl.matchers.derived import Space, Add, Apply, KApply, Drop, Map
     from lepl.matchers.combine import And, Or, First
     super(OperatorNamespace, self).__init__({
         SPACE_OPT:
         lambda a, b: And(a,
                          Space()[0:, ...], b),
         SPACE_REQ:
         lambda a, b: And(a,
                          Space()[1:, ...], b),
         ADD:
         lambda a, b: Add(And(a, b)),
         AND:
         And,
         OR:
         Or,
         APPLY:
         Apply,
         APPLY_RAW:
         lambda a, b: Apply(a, b, raw=True),
         NOT:
         Drop,
         KARGS:
         KApply,
         RAISE:
         lambda a, b: KApply(a, raise_error(b)),
         REPEAT:
         RepeatWrapper,
         FIRST:
         First,
         MAP:
         Map,
         REDUCE:
         None,
     })