Be able to differentiate tuple/list/dict.

This commit is contained in:
Dave Halter
2014-10-22 01:42:21 +02:00
parent 14113a1bff
commit 6a8b840b29
+4 -1
View File
@@ -209,7 +209,10 @@ class Evaluator(object):
elif isinstance(atom, pr.Literal): elif isinstance(atom, pr.Literal):
return [compiled.create(self, atom.eval())] return [compiled.create(self, atom.eval())]
else: else:
return [iterable.Array(self, atom.children[1], pr.Array.LIST)] mapping = {'(': pr.Array.TUPLE,
'[': pr.Array.LIST,
'{': pr.Array.DICT}
return [iterable.Array(self, atom.children[1], mapping[atom.children[0]])]
def _eval_trailer(self, types, trailer): def _eval_trailer(self, types, trailer):
trailer_op, node = trailer.children[:2] trailer_op, node = trailer.children[:2]