Skip to content
Snippets Groups Projects
Commit 1511ec03 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Added OR macro

parent 725ee185
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,13 @@ class PlutoVariables: ...@@ -24,6 +24,13 @@ class PlutoVariables:
rh = [ m.group(3).format(v, pluto=self.by_name[v][0]) rh = [ m.group(3).format(v, pluto=self.by_name[v][0])
for v in self.by_name if re.match(regexp, v)] for v in self.by_name if re.match(regexp, v)]
return("%s=%s" % (lh, '*'.join(rh))) return("%s=%s" % (lh, '*'.join(rh)))
m = re.match('([^=]+)=OR\{(.*),(.*)\}', expr)
if m:
lh = m.group(1)
regexp = m.group(2).replace('*', '.*')
rh = [ m.group(3).format(v, pluto=self.by_name[v][0])
for v in self.by_name if re.match(regexp, v)]
return("%s=%s" % (lh, '+'.join(rh)))
raise Exception('Invalid expression', expr) raise Exception('Invalid expression', expr)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment