Enable basic support for evaluating float types

This commit is contained in:
Bartłomiej Pluta
2019-07-25 13:37:31 +02:00
parent 6dc503ba86
commit b126f83824
8 changed files with 64 additions and 20 deletions

View File

@@ -11,6 +11,7 @@ class MinusEvaluator(Evaluator):
try:
return {
Type.INTEGER: cls.evaluateForInteger,
Type.FLOAT: cls.evaluateForFloat,
Type.STRING: cls.evaluateForString,
Type.LIST: cls.evaluateForList
}[value.type](value.value)
@@ -19,9 +20,12 @@ class MinusEvaluator(Evaluator):
@classmethod
def evaluateForInteger(cls, value):
return Type.integer(-value)
@classmethod
def evaluateForFloat(cls, value):
return Type.float(-value)
@classmethod
def evaluateForString(cls, value):
return Type.string(value[::-1])