Create new type: map (dictionary) with all support for it
This commit is contained in:
11
smnp/runtime/evaluators/map.py
Normal file
11
smnp/runtime/evaluators/map.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from smnp.runtime.evaluator import Evaluator, evaluate
|
||||
from smnp.type.model import Type
|
||||
|
||||
|
||||
class MapEvaluator(Evaluator):
|
||||
|
||||
@classmethod
|
||||
def evaluator(cls, node, environment):
|
||||
keys = [ evaluate(entry.key, environment).value for entry in node.children ]
|
||||
values = [ evaluate(entry.value, environment).value for entry in node.children ]
|
||||
return Type.map(dict(zip(keys, values)))
|
||||
Reference in New Issue
Block a user