-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtt_types.py
81 lines (72 loc) · 2.58 KB
/
tt_types.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#==================================================
# tt_types.py - 2009-01-15
# Several type definitions for Turbo Turtle
# Copyright (c) 2009 by Richard Goedeken ([email protected])
#--------------------------------------------------
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
class ElemType:
# static definitions for element types
UNKNOWN = 0
OPEN_PAREN = 1
CLOSE_PAREN = 2
OPEN_BRACKET = 3
CLOSE_BRACKET = 4
NUMBER = 5
BOOLEAN = 6
INFIX_NUM = 7
INFIX_BOOL = 8
QUOTED_WORD = 9
VAR_VALUE = 10
UNQUOT_WORD = 11
FUNC_CALL = 11 # that's right, a function call and an unquoted word are the same
CODE_LIST = 12
Names = { UNKNOWN : "Unknown",
OPEN_PAREN : "Open Parenthesis",
CLOSE_PAREN : "Close Parenthesis",
OPEN_BRACKET : "Open Bracket",
CLOSE_BRACKET : "Close Bracket",
NUMBER : "Number",
BOOLEAN : "Boolean",
INFIX_NUM : "Numeric operator",
INFIX_BOOL : "Comparison operator",
QUOTED_WORD : "Quoted word",
VAR_VALUE : "Variable reference",
FUNC_CALL : "Function call",
CODE_LIST : "Code list" }
class ParamType:
# procedure input/output parameter types
UNKNOWN = 0
NOTHING = 1
ANYTHING = 2
BOOLEAN = 3
NUMBER = 4
LISTCODE = 5
LISTNUM = 6
ARRAY = 7
QUOTEDWORD = 8
Names = { UNKNOWN : "Unknown",
NOTHING : "Nothing",
ANYTHING : "Anything",
BOOLEAN : "Boolean",
NUMBER : "Number",
LISTCODE : "List of code",
LISTNUM : "List of numbers",
ARRAY : "Array",
QUOTEDWORD : "Quoted word" }
class Struct(dict):
def __getattr__(self,name):
try:
val = self[name]
except KeyError:
val = None
return val
def __setattr__(self,name,val):
self[name] = val