Skip to content

Commit

Permalink
increase verbosity of literals for guards
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamBanham committed Oct 21, 2024
1 parent 04548f4 commit ae61b07
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pmkoalas/models/guards.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Word,
nums,
alphas,
printables,
Combine,
oneOf,
opAssoc,
Expand Down Expand Up @@ -90,6 +91,7 @@ class EvalComparisonOp:
">" : lambda a, b: a > b,
">=" : lambda a,b: a >= b,
"==": lambda a, b: a == b,
"!=": lambda a, b: a != b,
'&&': lambda a,b: a and b,
"<" : lambda a, b: a < b,
"<=" : lambda a,b: a <= b,
Expand Down Expand Up @@ -157,8 +159,10 @@ def _create_operand(self) -> None:
values = booleans | pos_real | neg_real | integer
values.setParseAction(self._constant)

literal = Combine('&#34;' + Word(alphas+" ") + '&#34;')
literal = literal | Combine('"' + Word(alphas+" "+"/") + '"')
non_op_chars = "".join([c for c in printables if c not in "<>=!&|'\""])

literal = Combine('&#34;' + Word(alphas+nums+non_op_chars+" ") + '&#34;')
literal = literal | Combine('"' + Word(alphas+nums+non_op_chars+" "+"/") + '"')
literal.setParseAction(self._literal)

variable = Combine(Word(alphas,exact=1) + Word(alphas + nums + "_:$"))
Expand All @@ -167,7 +171,7 @@ def _create_operand(self) -> None:
self._operand = values | literal | variable

def _expr_form(self) -> None:
comparisonop = oneOf("&lt;= <= &gt;= >= &lt; < &gt; > ==")
comparisonop = oneOf("&lt;= <= &gt;= >= &lt; < &gt; > == !=")
self._expr = infixNotation(
self._operand,
[
Expand Down

0 comments on commit ae61b07

Please sign in to comment.