From b18ef44fecc184e3a0c7744f04ff3fc7e4640cf8 Mon Sep 17 00:00:00 2001 From: Marion Date: Mon, 16 Sep 2013 14:21:25 +0000 Subject: show the NAN logoerror if a block wants a number but gets a non-number --- (limited to 'TurtleArt/tatype.py') diff --git a/TurtleArt/tatype.py b/TurtleArt/tatype.py index 1402014..46c5921 100644 --- a/TurtleArt/tatype.py +++ b/TurtleArt/tatype.py @@ -68,6 +68,7 @@ class TypeDisjunction(tuple,Type): return "".join(s) +# individual types TYPE_OBJECT = Type('TYPE_OBJECT', 0) TYPE_BOOL = Type('TYPE_BOOL', 5) TYPE_BOX = Type('TYPE_BOX', 8) # special type for the unknown content of a box @@ -81,10 +82,14 @@ TYPE_NUMBER = Type('TYPE_NUMBER', 6) # shortcut to avoid a TypeDisjunction TYPE_NUMERIC_STRING = Type('TYPE_NUMERIC_STRING', 7) TYPE_STRING = Type('TYPE_STRING', 9) +# groups/ classes of types +TYPES_NUMERIC = (TYPE_FLOAT, TYPE_INT, TYPE_NUMBER) + BOX_AST = ast.Name(id='BOX', ctx=ast.Load) ACTION_AST = ast.Name(id='ACTION', ctx=ast.Load) + def get_type(x): """ Return the most specific type in the type hierarchy that applies to x and a boolean indicating whether x is an AST. If the type cannot be -- cgit v0.9.1