Initial commit - fix problems & refactor code
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
from core.tokens import BinaryPredicate
|
||||
from core.exceptions import runtimeError
|
||||
|
||||
def evalBinaryPredicate(op: BinaryPredicate, a, b):
|
||||
try:
|
||||
match op:
|
||||
case BinaryPredicate.LT:
|
||||
return a < b
|
||||
case BinaryPredicate.GT:
|
||||
return a > b
|
||||
case BinaryPredicate.EQ:
|
||||
return a == b
|
||||
except Exception as e:
|
||||
raise runtimeError(f'cannot apply {repr(op)} to {repr(a)} and {repr(b)}') from e
|
||||
Reference in New Issue
Block a user