diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py index 480dcaf3cf5..2112854570d 100644 --- a/src/compiler/nir/nir_algebraic.py +++ b/src/compiler/nir/nir_algebraic.py @@ -283,17 +283,21 @@ class Constant(Value): return self.value == other.value +# The $ at the end forces there to be an error if any part of the string +# doesn't match one of the field patterns. _var_name_re = re.compile(r"(?P#)?(?P\w+)" r"(?:@(?Pint|uint|bool|float)?(?P\d+)?)?" r"(?P\([^\)]+\))?" - r"(?P\.[xyzw]+)?") + r"(?P\.[xyzw]+)?" + r"$") class Variable(Value): def __init__(self, val, name, varset): Value.__init__(self, val, name, "variable") m = _var_name_re.match(val) - assert m and m.group('name') is not None + assert m and m.group('name') is not None, \ + "Malformed variable name \"{}\".".format(val) self.var_name = m.group('name')