diff --git a/pymbolic/parser.py b/pymbolic/parser.py index 9a067df1d9072ed35ac87c0c0ffe9f5e6cfc9d49..bfc4f553fd7590feaf19d2b583454d2a4fe2c935 100644 --- a/pymbolic/parser.py +++ b/pymbolic/parser.py @@ -66,7 +66,10 @@ def parse(expr_str): def parse_expression(pstate, min_precedence=0): pstate.expect_not_end() - if pstate.is_next(_minus): + if pstate.is_next(_times): + pstate.advance() + left_exp = primitives.Wildcard() + elif pstate.is_next(_minus): pstate.advance() left_exp = -parse_expression(pstate, _PREC_UNARY_MINUS) elif pstate.is_next(_openpar): diff --git a/pymbolic/primitives.py b/pymbolic/primitives.py index 825ebd1008f1531a1ad2b8fc7a5054d513cddb77..a04a0c5f8dd91821f0c8a0081443ba82d05a7720 100644 --- a/pymbolic/primitives.py +++ b/pymbolic/primitives.py @@ -259,6 +259,17 @@ class Variable(Leaf): +class Wildcard(Leaf): + def is_equal(self, other): + return (other.__class__ == self.__class__ + and self.name == other.name) + + def get_hash(self): + return hash((self.__class__, self.name)) + + mapper_method = intern("map_wildcard") + + class FunctionSymbol(AlgebraicLeaf): """Represents the name of a function.