@@ -133,10 +133,61 @@ export class Resolver implements StmtNS.Visitor<void>, ExprNS.Visitor<void> {
133
133
this . ast = ast ;
134
134
// The global environment
135
135
this . environment = new Environment ( source , null , new Map ( [
136
- [ "range" , new Token ( TokenType . NAME , "range" , 0 , 0 , 0 ) ] ,
136
+ // misc library
137
+ [ "get_time" , new Token ( TokenType . NAME , "get_time" , 0 , 0 , 0 ) ] ,
137
138
[ "print" , new Token ( TokenType . NAME , "print" , 0 , 0 , 0 ) ] ,
138
- [ "stringify" , new Token ( TokenType . NAME , "stringify" , 0 , 0 , 0 ) ] ,
139
- // @TODO add all the source pre-declared names here
139
+ [ "raw_print" , new Token ( TokenType . NAME , "raw_print" , 0 , 0 , 0 ) ] ,
140
+ [ "str" , new Token ( TokenType . NAME , "str" , 0 , 0 , 0 ) ] ,
141
+ [ "error" , new Token ( TokenType . NAME , "error" , 0 , 0 , 0 ) ] ,
142
+ [ "prompt" , new Token ( TokenType . NAME , "prompt" , 0 , 0 , 0 ) ] ,
143
+ //TODO: add is_integer and is_float to pylib, update resolver and createContext
144
+ [ "is_number" , new Token ( TokenType . NAME , "is_number" , 0 , 0 , 0 ) ] ,
145
+ [ "is_string" , new Token ( TokenType . NAME , "is_string" , 0 , 0 , 0 ) ] ,
146
+ [ "is_function" , new Token ( TokenType . NAME , "is_function" , 0 , 0 , 0 ) ] ,
147
+ [ "is_boolean" , new Token ( TokenType . NAME , "is_boolean" , 0 , 0 , 0 ) ] ,
148
+ [ "parse_int" , new Token ( TokenType . NAME , "parse_int" , 0 , 0 , 0 ) ] ,
149
+ [ "char_at" , new Token ( TokenType . NAME , "char_at" , 0 , 0 , 0 ) ] ,
150
+ [ "arity" , new Token ( TokenType . NAME , "arity" , 0 , 0 , 0 ) ] ,
151
+ [ "None" , new Token ( TokenType . NAME , "None" , 0 , 0 , 0 ) ] ,
152
+ [ "NaN" , new Token ( TokenType . NAME , "NaN" , 0 , 0 , 0 ) ] ,
153
+ [ "Infinity" , new Token ( TokenType . NAME , "Infinity" , 0 , 0 , 0 ) ] ,
154
+
155
+ // math library
156
+ [ "math_abs" , new Token ( TokenType . NAME , "math_abs" , 0 , 0 , 0 ) ] ,
157
+ [ "math_acos" , new Token ( TokenType . NAME , "math_acos" , 0 , 0 , 0 ) ] ,
158
+ [ "math_acosh" , new Token ( TokenType . NAME , "math_acosh" , 0 , 0 , 0 ) ] ,
159
+ [ "math_asin" , new Token ( TokenType . NAME , "math_asin" , 0 , 0 , 0 ) ] ,
160
+ [ "math_asinh" , new Token ( TokenType . NAME , "math_asinh" , 0 , 0 , 0 ) ] ,
161
+ [ "math_atan" , new Token ( TokenType . NAME , "math_atan" , 0 , 0 , 0 ) ] ,
162
+ [ "math_atan2" , new Token ( TokenType . NAME , "math_atan2" , 0 , 0 , 0 ) ] ,
163
+ [ "math_atanh" , new Token ( TokenType . NAME , "math_atanh" , 0 , 0 , 0 ) ] ,
164
+ [ "math_cbrt" , new Token ( TokenType . NAME , "math_cbrt" , 0 , 0 , 0 ) ] ,
165
+ [ "math_ceil" , new Token ( TokenType . NAME , "math_ceil" , 0 , 0 , 0 ) ] ,
166
+ [ "math_clz32" , new Token ( TokenType . NAME , "math_clz32" , 0 , 0 , 0 ) ] ,
167
+ [ "math_cos" , new Token ( TokenType . NAME , "math_cos" , 0 , 0 , 0 ) ] ,
168
+ [ "math_cosh" , new Token ( TokenType . NAME , "math_cosh" , 0 , 0 , 0 ) ] ,
169
+ [ "math_exp" , new Token ( TokenType . NAME , "math_exp" , 0 , 0 , 0 ) ] ,
170
+ [ "math_expm1" , new Token ( TokenType . NAME , "math_expm1" , 0 , 0 , 0 ) ] ,
171
+ [ "math_floor" , new Token ( TokenType . NAME , "math_floor" , 0 , 0 , 0 ) ] ,
172
+ [ "math_fround" , new Token ( TokenType . NAME , "math_fround" , 0 , 0 , 0 ) ] ,
173
+ [ "math_hypot" , new Token ( TokenType . NAME , "math_hypot" , 0 , 0 , 0 ) ] ,
174
+ [ "math_imul" , new Token ( TokenType . NAME , "math_imul" , 0 , 0 , 0 ) ] ,
175
+ [ "math_log" , new Token ( TokenType . NAME , "math_log" , 0 , 0 , 0 ) ] ,
176
+ [ "math_log1p" , new Token ( TokenType . NAME , "math_log1p" , 0 , 0 , 0 ) ] ,
177
+ [ "math_log2" , new Token ( TokenType . NAME , "math_log2" , 0 , 0 , 0 ) ] ,
178
+ [ "math_log10" , new Token ( TokenType . NAME , "math_log10" , 0 , 0 , 0 ) ] ,
179
+ [ "math_max" , new Token ( TokenType . NAME , "math_max" , 0 , 0 , 0 ) ] ,
180
+ [ "math_min" , new Token ( TokenType . NAME , "math_min" , 0 , 0 , 0 ) ] ,
181
+ [ "math_pow" , new Token ( TokenType . NAME , "math_pow" , 0 , 0 , 0 ) ] ,
182
+ [ "math_random" , new Token ( TokenType . NAME , "math_random" , 0 , 0 , 0 ) ] ,
183
+ [ "math_round" , new Token ( TokenType . NAME , "math_round" , 0 , 0 , 0 ) ] ,
184
+ [ "math_sign" , new Token ( TokenType . NAME , "math_sign" , 0 , 0 , 0 ) ] ,
185
+ [ "math_sin" , new Token ( TokenType . NAME , "math_sin" , 0 , 0 , 0 ) ] ,
186
+ [ "math_sinh" , new Token ( TokenType . NAME , "math_sinh" , 0 , 0 , 0 ) ] ,
187
+ [ "math_sqrt" , new Token ( TokenType . NAME , "math_sqrt" , 0 , 0 , 0 ) ] ,
188
+ [ "math_tan" , new Token ( TokenType . NAME , "math_tan" , 0 , 0 , 0 ) ] ,
189
+ [ "math_tanh" , new Token ( TokenType . NAME , "math_tanh" , 0 , 0 , 0 ) ] ,
190
+ [ "math_trunc" , new Token ( TokenType . NAME , "math_trunc" , 0 , 0 , 0 ) ] ,
140
191
] ) ) ;
141
192
this . functionScope = null ;
142
193
}
0 commit comments