Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tatype.py
diff options
context:
space:
mode:
authorMarion <marion.zepf@gmail.com>2013-09-16 14:21:25 (GMT)
committer Marion <marion.zepf@gmail.com>2013-09-16 14:21:25 (GMT)
commitb18ef44fecc184e3a0c7744f04ff3fc7e4640cf8 (patch)
treeb20dbfca7e4cbf3da97648c932b73c0abb79a4da /TurtleArt/tatype.py
parenta9d49ab15760c75f54c4735162a189ce390c60a2 (diff)
show the NAN logoerror if a block wants a number but gets a non-number
Diffstat (limited to 'TurtleArt/tatype.py')
-rw-r--r--TurtleArt/tatype.py5
1 files changed, 5 insertions, 0 deletions
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