/src/moddable/xs/sources/xsCommon.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2016-2025 Moddable Tech, Inc. |
3 | | * |
4 | | * This file is part of the Moddable SDK Runtime. |
5 | | * |
6 | | * The Moddable SDK Runtime is free software: you can redistribute it and/or modify |
7 | | * it under the terms of the GNU Lesser General Public License as published by |
8 | | * the Free Software Foundation, either version 3 of the License, or |
9 | | * (at your option) any later version. |
10 | | * |
11 | | * The Moddable SDK Runtime is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU Lesser General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU Lesser General Public License |
17 | | * along with the Moddable SDK Runtime. If not, see <http://www.gnu.org/licenses/>. |
18 | | * |
19 | | * This file incorporates work covered by the following copyright and |
20 | | * permission notice: |
21 | | * |
22 | | * Copyright (C) 2010-2016 Marvell International Ltd. |
23 | | * Copyright (C) 2002-2010 Kinoma, Inc. |
24 | | * |
25 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
26 | | * you may not use this file except in compliance with the License. |
27 | | * You may obtain a copy of the License at |
28 | | * |
29 | | * http://www.apache.org/licenses/LICENSE-2.0 |
30 | | * |
31 | | * Unless required by applicable law or agreed to in writing, software |
32 | | * distributed under the License is distributed on an "AS IS" BASIS, |
33 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
34 | | * See the License for the specific language governing permissions and |
35 | | * limitations under the License. |
36 | | */ |
37 | | |
38 | | #define _GNU_SOURCE |
39 | | #include "xsCommon.h" |
40 | | #ifndef mxUseDefaultCStackLimit |
41 | | #define mxUseDefaultCStackLimit 1 |
42 | | #endif |
43 | | |
44 | | const txString gxCodeNames[XS_CODE_COUNT] = { |
45 | | "", |
46 | | /* XS_CODE_ADD */ "add", |
47 | | /* XS_CODE_ARGUMENT */ "argument", |
48 | | /* XS_CODE_ARGUMENTS */ "arguments", |
49 | | /* XS_CODE_ARGUMENTS_SLOPPY */ "arguments_sloppy", |
50 | | /* XS_CODE_ARGUMENTS_STRICT */ "arguments_strict", |
51 | | /* XS_CODE_ARRAY */ "array", |
52 | | /* XS_CODE_ASYNC_FUNCTION */ "async_function", |
53 | | /* XS_CODE_ASYNC_GENERATOR_FUNCTION */ "async_generator_function", |
54 | | /* XS_CODE_AT */ "at", |
55 | | /* XS_CODE_AWAIT */ "await", |
56 | | /* XS_CODE_BEGIN_SLOPPY */ "begin_sloppy", |
57 | | /* XS_CODE_BEGIN_STRICT */ "begin_strict", |
58 | | /* XS_CODE_BEGIN_STRICT_BASE */ "begin_strict_base", |
59 | | /* XS_CODE_BEGIN_STRICT_DERIVED */ "begin_strict_derived", |
60 | | /* XS_CODE_BEGIN_STRICT_FIELD */ "begin_strict_field", |
61 | | /* XS_CODE_BIGINT_1 */ "bigint", |
62 | | /* XS_CODE_BIGINT_2 */ "bigint_2", |
63 | | /* XS_CODE_BIT_AND */ "bit_and", |
64 | | /* XS_CODE_BIT_NOT */ "bit_not", |
65 | | /* XS_CODE_BIT_OR */ "bit_or", |
66 | | /* XS_CODE_BIT_XOR */ "bit_xor", |
67 | | /* XS_CODE_BRANCH_1 */ "branch", |
68 | | /* XS_CODE_BRANCH_2 */ "branch_2", |
69 | | /* XS_CODE_BRANCH_4 */ "branch_4", |
70 | | /* XS_CODE_BRANCH_CHAIN_1 */ "branch_chain", |
71 | | /* XS_CODE_BRANCH_CHAIN_2 */ "branch_chain_2", |
72 | | /* XS_CODE_BRANCH_CHAIN_4 */ "branch_chain_4", |
73 | | /* XS_CODE_BRANCH_COALESCE_1 */ "branch_coalesce", |
74 | | /* XS_CODE_BRANCH_COALESCE_2 */ "branch_coalesce_2", |
75 | | /* XS_CODE_BRANCH_COALESCE_4 */ "branch_coalesce_4", |
76 | | /* XS_CODE_BRANCH_ELSE_1 */ "branch_else", |
77 | | /* XS_CODE_BRANCH_ELSE_2 */ "branch_else_2", |
78 | | /* XS_CODE_BRANCH_ELSE_4 */ "branch_else_4", |
79 | | /* XS_CODE_BRANCH_IF_1 */ "branch_if", |
80 | | /* XS_CODE_BRANCH_IF_2 */ "branch_if_2", |
81 | | /* XS_CODE_BRANCH_IF_4 */ "branch_if_4", |
82 | | /* XS_CODE_BRANCH_STATUS_1 */ "branch_status", |
83 | | /* XS_CODE_BRANCH_STATUS_2 */ "branch_status_2", |
84 | | /* XS_CODE_BRANCH_STATUS_4 */ "branch_status_4", |
85 | | /* XS_CODE_CALL */ "call", |
86 | | /* XS_CODE_CATCH_1 */ "catch", |
87 | | /* XS_CODE_CATCH_2 */ "catch_2", |
88 | | /* XS_CODE_CATCH_4 */ "catch_4", |
89 | | /* XS_CODE_CHECK_INSTANCE */ "check_instance", |
90 | | /* XS_CODE_CLASS */ "class", |
91 | | /* XS_CODE_CODE_1 */ "code", |
92 | | /* XS_CODE_CODE_2 */ "code_2", |
93 | | /* XS_CODE_CODE_4 */ "code_4", |
94 | | /* XS_CODE_CODE_ARCHIVE_1 */ "code_archive", |
95 | | /* XS_CODE_CODE_ARCHIVE_2 */ "code_archive_2", |
96 | | /* XS_CODE_CODE_ARCHIVE_4 */ "code_archive_4", |
97 | | /* XS_CODE_CONST_CLOSURE_1 */ "const_closure", |
98 | | /* XS_CODE_CONST_CLOSURE_2 */ "const_closure_2", |
99 | | /* XS_CODE_CONST_LOCAL_1 */ "const_local", |
100 | | /* XS_CODE_CONST_LOCAL_2 */ "const_local_2", |
101 | | /* XS_CODE_CONSTRUCTOR_FUNCTION */ "constructor_function", |
102 | | /* XS_CODE_COPY_OBJECT */ "copy_object", |
103 | | /* XS_CODE_CURRENT */ "current", |
104 | | /* XS_CODE_DEBUGGER */ "debugger", |
105 | | /* XS_CODE_DECREMENT */ "decrement", |
106 | | /* XS_CODE_DELETE_PROPERTY */ "delete_property", |
107 | | /* XS_CODE_DELETE_PROPERTY_AT */ "delete_property_at", |
108 | | /* XS_CODE_DELETE_SUPER */ "delete_super", |
109 | | /* XS_CODE_DELETE_SUPER_AT */ "delete_super_at", |
110 | | /* XS_CODE_DIVIDE */ "divide", |
111 | | /* XS_CODE_DUB */ "dub", |
112 | | /* XS_CODE_DUB_AT */ "dub_at", |
113 | | /* XS_CODE_END */ "end", |
114 | | /* XS_CODE_END_ARROW */ "end_arrow", |
115 | | /* XS_CODE_END_BASE */ "end_base", |
116 | | /* XS_CODE_END_DERIVED */ "end_derived", |
117 | | /* XS_CODE_ENVIRONMENT */ "environment", |
118 | | /* XS_CODE_EQUAL */ "equal", |
119 | | /* XS_CODE_EVAL */ "eval", |
120 | | /* XS_CODE_EVAL_ENVIRONMENT */ "eval_environment", |
121 | | /* XS_CODE_EVAL_PRIVATE */ "eval_private", |
122 | | /* XS_CODE_EVAL_REFERENCE */ "eval_reference", |
123 | | /* XS_CODE_EVAL_TAIL */ "eval_tail", |
124 | | /* XS_CODE_EXCEPTION */ "exception", |
125 | | /* XS_CODE_EXPONENTIATION */ "exponentiation", |
126 | | /* XS_CODE_EXTEND */ "extend", |
127 | | /* XS_CODE_FALSE */ "false", |
128 | | /* XS_CODE_FILE */ "file", |
129 | | /* XS_CODE_FOR_AWAIT_OF */ "for_await_of", |
130 | | /* XS_CODE_FOR_IN */ "for_in", |
131 | | /* XS_CODE_FOR_OF */ "for_of", |
132 | | /* XS_CODE_FUNCTION */ "function", |
133 | | /* XS_CODE_FUNCTION_ENVIRONMENT */ "function_environment", |
134 | | /* XS_CODE_GENERATOR_FUNCTION */ "generator", |
135 | | /* XS_CODE_GET_CLOSURE_1 */ "get_closure", |
136 | | /* XS_CODE_GET_CLOSURE_2 */ "get_closure_2", |
137 | | /* XS_CODE_GET_LOCAL_1 */ "get_local", |
138 | | /* XS_CODE_GET_LOCAL_2 */ "get_local_2", |
139 | | /* XS_CODE_GET_PRIVATE_1 */ "get_private", |
140 | | /* XS_CODE_GET_PRIVATE_2 */ "get_private_2", |
141 | | /* XS_CODE_GET_PROPERTY */ "get_property", |
142 | | /* XS_CODE_GET_PROPERTY_AT */ "get_property_at", |
143 | | /* XS_CODE_GET_RESULT */ "get_result", |
144 | | /* XS_CODE_GET_SUPER */ "get_super", |
145 | | /* XS_CODE_GET_SUPER_AT */ "get_super_at", |
146 | | /* XS_CODE_GET_THIS */ "get_this", |
147 | | /* XS_CODE_GET_THIS_VARIABLE */ "get_this_variable", |
148 | | /* XS_CODE_GET_VARIABLE */ "get_variable", |
149 | | /* XS_CODE_GLOBAL */ "global", |
150 | | /* XS_CODE_HAS_PRIVATE_1 */ "has_private", |
151 | | /* XS_CODE_HAS_PRIVATE_2 */ "has_private_2", |
152 | | /* XS_CODE_HOST */ "host", |
153 | | /* XS_CODE_IMPORT */ "import", |
154 | | /* XS_CODE_IMPORT_META */ "import.meta", |
155 | | /* XS_CODE_IN */ "in", |
156 | | /* XS_CODE_INCREMENT */ "increment", |
157 | | /* XS_CODE_INSTANCEOF */ "instanceof", |
158 | | /* XS_CODE_INSTANTIATE */ "instantiate", |
159 | | /* XS_CODE_INTEGER_1 */ "integer", |
160 | | /* XS_CODE_INTEGER_2 */ "integer_2", |
161 | | /* XS_CODE_INTEGER_4 */ "integer_4", |
162 | | /* XS_CODE_LEFT_SHIFT */ "left_shift", |
163 | | /* XS_CODE_LESS */ "less", |
164 | | /* XS_CODE_LESS_EQUAL */ "less_equal", |
165 | | /* XS_CODE_LET_CLOSURE_1 */ "let_closure", |
166 | | /* XS_CODE_LET_CLOSURE_2 */ "let_closure_2", |
167 | | /* XS_CODE_LET_LOCAL_1 */ "let_local", |
168 | | /* XS_CODE_LET_LOCAL_2 */ "let_local_2", |
169 | | /* XS_CODE_LINE */ "line", |
170 | | /* XS_CODE_MINUS */ "minus", |
171 | | /* XS_CODE_MODULE */ "module", |
172 | | /* XS_CODE_MODULO */ "modulo", |
173 | | /* XS_CODE_MORE */ "more", |
174 | | /* XS_CODE_MORE_EQUAL */ "more_equal", |
175 | | /* XS_CODE_MULTIPLY */ "multiply", |
176 | | /* XS_CODE_NAME */ "name", |
177 | | /* XS_CODE_NEW */ "new", |
178 | | /* XS_CODE_NEW_CLOSURE */ "new_closure", |
179 | | /* XS_CODE_NEW_LOCAL */ "new_local", |
180 | | /* XS_CODE_NEW_PRIVATE_1 */ "new_private", |
181 | | /* XS_CODE_NEW_PRIVATE_2 */ "new_private_2", |
182 | | /* XS_CODE_NEW_PROPERTY */ "new_property", |
183 | | /* XS_CODE_NEW_PROPERTY_AT */ "new_property_at", |
184 | | /* XS_CODE_NEW_TEMPORARY */ "new_temporary", |
185 | | /* XS_CODE_NOT */ "not", |
186 | | /* XS_CODE_NOT_EQUAL */ "not_equal", |
187 | | /* XS_CODE_NULL */ "null", |
188 | | /* XS_CODE_NUMBER */ "number", |
189 | | /* XS_CODE_OBJECT */ "object", |
190 | | /* XS_CODE_PLUS */ "plus", |
191 | | /* XS_CODE_POP */ "pop", |
192 | | /* XS_CODE_PROGRAM_ENVIRONMENT */ "program_environment", |
193 | | /* XS_CODE_PROGRAM_REFERENCE */ "program_reference", |
194 | | /* XS_CODE_PULL_CLOSURE_1 */ "pull_closure", |
195 | | /* XS_CODE_PULL_CLOSURE_2 */ "pull_closure_2", |
196 | | /* XS_CODE_PULL_LOCAL_1 */ "pull_local", |
197 | | /* XS_CODE_PULL_LOCAL_2 */ "pull_local_2", |
198 | | /* XS_CODE_REFRESH_CLOSURE_1 */ "refresh_closure", |
199 | | /* XS_CODE_REFRESH_CLOSURE_2 */ "refresh_closure_2", |
200 | | /* XS_CODE_REFRESH_LOCAL_1 */ "refresh_local", |
201 | | /* XS_CODE_REFRESH_LOCAL_2 */ "refresh_local_2", |
202 | | /* XS_CODE_REGEXP */ "regexp", |
203 | | /* XS_CODE_RESERVE_1 */ "reserve", |
204 | | /* XS_CODE_RESERVE_2 */ "reserve_2", |
205 | | /* XS_CODE_RESET_CLOSURE_1 */ "reset_closure", |
206 | | /* XS_CODE_RESET_CLOSURE_2 */ "reset_closure_2", |
207 | | /* XS_CODE_RESET_LOCAL_1 */ "reset_local", |
208 | | /* XS_CODE_RESET_LOCAL_2 */ "reset_local_2", |
209 | | /* XS_CODE_RETHROW */ "rethrow", |
210 | | /* XS_CODE_RETRIEVE_1 */ "retrieve", |
211 | | /* XS_CODE_RETRIEVE_2 */ "retrieve_2", |
212 | | /* XS_CODE_RETRIEVE_TARGET */ "retrieve_target", |
213 | | /* XS_CODE_RETRIEVE_THIS */ "retrieve_this", |
214 | | /* XS_CODE_RETURN */ "return", |
215 | | /* XS_CODE_RUN */ "run", |
216 | | /* XS_CODE_RUN_1 */ "run_1", |
217 | | /* XS_CODE_RUN_2 */ "run_2", |
218 | | /* XS_CODE_RUN_4 */ "run_4", |
219 | | /* XS_CODE_RUN_TAIL */ "run_tail", |
220 | | /* XS_CODE_RUN_TAIL_1 */ "run_tail_1", |
221 | | /* XS_CODE_RUN_TAIL_2 */ "run_tail_2", |
222 | | /* XS_CODE_RUN_TAIL_4 */ "run_tail_4", |
223 | | /* XS_CODE_SET_CLOSURE_1 */ "set_closure", |
224 | | /* XS_CODE_SET_CLOSURE_2 */ "set_closure_2", |
225 | | /* XS_CODE_SET_HOME */ "set_home", |
226 | | /* XS_CODE_SET_LOCAL_1 */ "set_local", |
227 | | /* XS_CODE_SET_LOCAL_2 */ "set_local_2", |
228 | | /* XS_CODE_SET_PRIVATE_1 */ "set_private", |
229 | | /* XS_CODE_SET_PRIVATE_2 */ "set_private_2", |
230 | | /* XS_CODE_SET_PROPERTY */ "set_property", |
231 | | /* XS_CODE_SET_PROPERTY_AT */ "set_property_at", |
232 | | /* XS_CODE_SET_RESULT */ "set_result", |
233 | | /* XS_CODE_SET_SUPER */ "set_super", |
234 | | /* XS_CODE_SET_SUPER_AT */ "set_super_at", |
235 | | /* XS_CODE_SET_THIS */ "set_this", |
236 | | /* XS_CODE_SET_VARIABLE */ "set_variable", |
237 | | /* XS_CODE_SIGNED_RIGHT_SHIFT */ "signed_right_shift", |
238 | | /* XS_CODE_START_ASYNC */ "start_async", |
239 | | /* XS_CODE_START_ASYNC_GENERATOR */ "start_async_generator", |
240 | | /* XS_CODE_START_GENERATOR */ "start_generator", |
241 | | /* XS_CODE_STORE_1 */ "store_1", |
242 | | /* XS_CODE_STORE_2 */ "store_2", |
243 | | /* XS_CODE_STORE_ARROW */ "store_arrow", |
244 | | /* XS_CODE_STRICT_EQUAL */ "strict_equal", |
245 | | /* XS_CODE_STRICT_NOT_EQUAL */ "strict_not_equal", |
246 | | /* XS_CODE_STRING_1 */ "string", |
247 | | /* XS_CODE_STRING_2 */ "string_2", |
248 | | /* XS_CODE_STRING_4 */ "string_4", |
249 | | /* XS_CODE_STRING_ARCHIVE_1 */ "string_archive", |
250 | | /* XS_CODE_STRING_ARCHIVE_2 */ "string_archive_2", |
251 | | /* XS_CODE_STRING_ARCHIVE_4 */ "string_archive_4", |
252 | | /* XS_CODE_SUBTRACT */ "subtract", |
253 | | /* XS_CODE_SUPER */ "super", |
254 | | /* XS_CODE_SWAP */ "swap", |
255 | | /* XS_CODE_SYMBOL */ "symbol", |
256 | | /* XS_CODE_TARGET */ "target", |
257 | | /* XS_CODE_TEMPLATE */ "template", |
258 | | /* XS_CODE_TEMPLATE_CACHE */ "template_cache", |
259 | | /* XS_CODE_THIS */ "this", |
260 | | /* XS_CODE_THROW */ "throw", |
261 | | /* XS_CODE_THROW_STATUS */ "throw_status", |
262 | | /* XS_CODE_TO_INSTANCE */ "to_instance", |
263 | | /* XS_CODE_TO_NUMERIC */ "to_numeric", |
264 | | /* XS_CODE_TO_STRING */ "to_string", |
265 | | /* XS_CODE_TRANSFER */ "transfer", |
266 | | /* XS_CODE_TRUE */ "true", |
267 | | /* XS_CODE_TYPEOF */ "typeof", |
268 | | /* XS_CODE_UNCATCH */ "uncatch", |
269 | | /* XS_CODE_UNDEFINED */ "undefined", |
270 | | /* XS_CODE_UNSIGNED_RIGHT_SHIFT */ "unsigned_right_shift", |
271 | | /* XS_CODE_UNWIND_1 */ "unwind", |
272 | | /* XS_CODE_UNWIND_2 */ "unwind_2", |
273 | | /* XS_CODE_VAR_CLOSURE_1 */ "var_closure_1", |
274 | | /* XS_CODE_VAR_CLOSURE_2 */ "var_closure_2", |
275 | | /* XS_CODE_VAR_LOCAL_1 */ "var_local_1", |
276 | | /* XS_CODE_VAR_LOCAL_2 */ "var_local_2", |
277 | | /* XS_CODE_VOID */ "void", |
278 | | /* XS_CODE_WITH */ "with", |
279 | | /* XS_CODE_WITHOUT */ "without", |
280 | | /* XS_CODE_YIELD */ "yield", |
281 | | /* XS_CODE_PROFILE */ "profile", |
282 | | /* XS_CODE_YIELD_STAR */ "yield*", |
283 | | // mxExplicitResourceManagement |
284 | | /* XS_CODE_USED_1 */ "used_1", |
285 | | /* XS_CODE_USED_2 */ "used_2", |
286 | | /* XS_CODE_USING */ "using", |
287 | | /* XS_CODE_USING_ASYNC */ "await using", |
288 | | /* XS_CODE_AT_2 */ "at_2", |
289 | | /* XS_CODE_SUPER_AT */ "super_at", |
290 | | /* XS_CODE_SUPER_AT_2 */ "super_at_2", |
291 | | /* XS_CODE_TRANSFER_JSON */ "transfer_json", |
292 | | }; |
293 | | |
294 | | const txS1 gxCodeSizes[XS_CODE_COUNT] ICACHE_FLASH_ATTR = { |
295 | | 1 /* XS_NO_CODE */, |
296 | | 1 /* XS_CODE_ADD */, |
297 | | 2 /* XS_CODE_ARGUMENT */, |
298 | | 2 /* XS_CODE_ARGUMENTS */, |
299 | | 2 /* XS_CODE_ARGUMENTS_SLOPPY */, |
300 | | 2 /* XS_CODE_ARGUMENTS_STRICT */, |
301 | | 1 /* XS_CODE_ARRAY */, |
302 | | 0 /* XS_CODE_ASYNC_FUNCTION */, |
303 | | 0 /* XS_CODE_ASYNC_GENERATOR_FUNCTION */, |
304 | | 1 /* XS_CODE_AT */, |
305 | | 1 /* XS_CODE_AWAIT */, |
306 | | 2 /* XS_CODE_BEGIN_SLOPPY */, |
307 | | 2 /* XS_CODE_BEGIN_STRICT */, |
308 | | 2 /* XS_CODE_BEGIN_STRICT_BASE */, |
309 | | 2 /* XS_CODE_BEGIN_STRICT_DERIVED */, |
310 | | 2 /* XS_CODE_BEGIN_STRICT_FIELD */, |
311 | | -1 /* XS_CODE_BIGINT_1 */, |
312 | | -2 /* XS_CODE_BIGINT_2 */, |
313 | | 1 /* XS_CODE_BIT_AND */, |
314 | | 1 /* XS_CODE_BIT_NOT */, |
315 | | 1 /* XS_CODE_BIT_OR */, |
316 | | 1 /* XS_CODE_BIT_XOR */, |
317 | | 2 /* XS_CODE_BRANCH_1 */, |
318 | | 3 /* XS_CODE_BRANCH_2 */, |
319 | | 5 /* XS_CODE_BRANCH_4 */, |
320 | | 2 /* XS_CODE_BRANCH_CHAIN_1 */, |
321 | | 3 /* XS_CODE_BRANCH_CHAIN_2 */, |
322 | | 5 /* XS_CODE_BRANCH_CHAIN_4 */, |
323 | | 2 /* XS_CODE_BRANCH_COALESCE_1 */, |
324 | | 3 /* XS_CODE_BRANCH_COALESCE_2 */, |
325 | | 5 /* XS_CODE_BRANCH_COALESCE_4 */, |
326 | | 2 /* XS_CODE_BRANCH_ELSE_1 */, |
327 | | 3 /* XS_CODE_BRANCH_ELSE_2 */, |
328 | | 5 /* XS_CODE_BRANCH_ELSE_4 */, |
329 | | 2 /* XS_CODE_BRANCH_IF_1 */, |
330 | | 3 /* XS_CODE_BRANCH_IF_2 */, |
331 | | 5 /* XS_CODE_BRANCH_IF_4 */, |
332 | | 2 /* XS_CODE_BRANCH_STATUS_1 */, |
333 | | 3 /* XS_CODE_BRANCH_STATUS_2 */, |
334 | | 5 /* XS_CODE_BRANCH_STATUS_4 */, |
335 | | 1 /* XS_CODE_CALL */, |
336 | | 2 /* XS_CODE_CATCH_1 */, |
337 | | 3 /* XS_CODE_CATCH_2 */, |
338 | | 5 /* XS_CODE_CATCH_4 */, |
339 | | 1 /* XS_CODE_CLASS */, |
340 | | 1 /* XS_CODE_CHECK_INSTANCE */, |
341 | | 2 /* XS_CODE_CODE_1 */, |
342 | | 3 /* XS_CODE_CODE_2 */, |
343 | | 5 /* XS_CODE_CODE_4 */, |
344 | | 2 /* XS_CODE_CODE_ARCHIVE_1 */, |
345 | | 3 /* XS_CODE_CODE_ARCHIVE_2 */, |
346 | | 5 /* XS_CODE_CODE_ARCHIVE_4 */, |
347 | | 2 /* XS_CODE_CONST_CLOSURE_1 */, |
348 | | 3 /* XS_CODE_CONST_CLOSURE_2 */, |
349 | | 2 /* XS_CODE_CONST_LOCAL_1 */, |
350 | | 3 /* XS_CODE_CONST_LOCAL_2 */, |
351 | | 0 /* XS_CODE_CONSTRUCTOR_FUNCTION */, |
352 | | 1 /* XS_CODE_COPY_OBJECT */, |
353 | | 1 /* XS_CODE_CURRENT */, |
354 | | 1 /* XS_CODE_DEBUGGER */, |
355 | | 1 /* XS_CODE_DECREMENT */, |
356 | | 0 /* XS_CODE_DELETE_PROPERTY */, |
357 | | 1 /* XS_CODE_DELETE_PROPERTY_AT */, |
358 | | 0 /* XS_CODE_DELETE_SUPER */, |
359 | | 1 /* XS_CODE_DELETE_SUPER_AT */, |
360 | | 1 /* XS_CODE_DIVIDE */, |
361 | | 1 /* XS_CODE_DUB */, |
362 | | 1 /* XS_CODE_DUB_AT */, |
363 | | 1 /* XS_CODE_END */, |
364 | | 1 /* XS_CODE_END_ARROW */, |
365 | | 1 /* XS_CODE_END_BASE */, |
366 | | 1 /* XS_CODE_END_DERIVED */, |
367 | | 1 /* XS_CODE_ENVIRONMENT */, |
368 | | 1 /* XS_CODE_EQUAL */, |
369 | | 1 /* XS_CODE_EVAL */, |
370 | | 1 /* XS_CODE_EVAL_ENVIRONMENT */, |
371 | | 0 /* XS_CODE_EVAL_PRIVATE */, |
372 | | 0 /* XS_CODE_EVAL_REFERENCE */, |
373 | | 1 /* XS_CODE_EVAL_TAIL */, |
374 | | 1 /* XS_CODE_EXCEPTION */, |
375 | | 1 /* XS_CODE_EXPONENTIATION */, |
376 | | 1 /* XS_CODE_EXTEND */, |
377 | | 1 /* XS_CODE_FALSE */, |
378 | | 0 /* XS_CODE_FILE */, |
379 | | 1 /* XS_CODE_FOR_AWAIT_OF */, |
380 | | 1 /* XS_CODE_FOR_IN */, |
381 | | 1 /* XS_CODE_FOR_OF */, |
382 | | 0 /* XS_CODE_FUNCTION */, |
383 | | 1 /* XS_CODE_FUNCTION_ENVIRONMENT */, |
384 | | 0 /* XS_CODE_GENERATOR_FUNCTION */, |
385 | | 2 /* XS_CODE_GET_CLOSURE_1 */, |
386 | | 3 /* XS_CODE_GET_CLOSURE_2 */, |
387 | | 2 /* XS_CODE_GET_LOCAL_1 */, |
388 | | 3 /* XS_CODE_GET_LOCAL_2 */, |
389 | | 2 /* XS_CODE_GET_PRIVATE_1 */, |
390 | | 3 /* XS_CODE_GET_PRIVATE_2 */, |
391 | | 0 /* XS_CODE_GET_PROPERTY */, |
392 | | 1 /* XS_CODE_GET_PROPERTY_AT */, |
393 | | 1 /* XS_CODE_GET_RESULT */, |
394 | | 0 /* XS_CODE_GET_SUPER */, |
395 | | 1 /* XS_CODE_GET_SUPER_AT */, |
396 | | 1 /* XS_CODE_GET_THIS */, |
397 | | 0 /* XS_CODE_GET_THIS_VARIABLE */, |
398 | | 0 /* XS_CODE_GET_VARIABLE */, |
399 | | 1 /* XS_CODE_GLOBAL */, |
400 | | 2 /* XS_CODE_HAS_PRIVATE_1 */, |
401 | | 3 /* XS_CODE_HAS_PRIVATE_2 */, |
402 | | 3 /* XS_CODE_HOST */, |
403 | | 1 /* XS_CODE_IMPORT */, |
404 | | 1 /* XS_CODE_IMPORT_META */, |
405 | | 1 /* XS_CODE_IN */, |
406 | | 1 /* XS_CODE_INCREMENT */, |
407 | | 1 /* XS_CODE_INSTANCEOF */, |
408 | | 1 /* XS_CODE_INSTANTIATE */, |
409 | | 2 /* XS_CODE_INTEGER_1 */, |
410 | | 3 /* XS_CODE_INTEGER_2 */, |
411 | | 5 /* XS_CODE_INTEGER_4 */, |
412 | | 1 /* XS_CODE_LEFT_SHIFT */, |
413 | | 1 /* XS_CODE_LESS */, |
414 | | 1 /* XS_CODE_LESS_EQUAL */, |
415 | | 2 /* XS_CODE_LET_CLOSURE_1 */, |
416 | | 3 /* XS_CODE_LET_CLOSURE_2 */, |
417 | | 2 /* XS_CODE_LET_LOCAL_1 */, |
418 | | 3 /* XS_CODE_LET_LOCAL_2 */, |
419 | | 3 /* XS_CODE_LINE */, |
420 | | 1 /* XS_CODE_MINUS */, |
421 | | 2 /* XS_CODE_MODULE */, |
422 | | 1 /* XS_CODE_MODULO */, |
423 | | 1 /* XS_CODE_MORE */, |
424 | | 1 /* XS_CODE_MORE_EQUAL */, |
425 | | 1 /* XS_CODE_MULTIPLY */, |
426 | | 0 /* XS_CODE_NAME */, |
427 | | 1 /* XS_CODE_NEW */, |
428 | | 0 /* XS_CODE_NEW_CLOSURE */, |
429 | | 0 /* XS_CODE_NEW_LOCAL */, |
430 | | 2 /* XS_CODE_NEW_PRIVATE_1 */, |
431 | | 3 /* XS_CODE_NEW_PRIVATE_2 */, |
432 | | 0 /* XS_CODE_NEW_PROPERTY */, |
433 | | 1 /* XS_CODE_NEW_PROPERTY_AT */, |
434 | | 1 /* XS_CODE_NEW_TEMPORARY */, |
435 | | 1 /* XS_CODE_NOT */, |
436 | | 1 /* XS_CODE_NOT_EQUAL */, |
437 | | 1 /* XS_CODE_NULL */, |
438 | | 9 /* XS_CODE_NUMBER */, |
439 | | 1 /* XS_CODE_OBJECT */, |
440 | | 1 /* XS_CODE_PLUS */, |
441 | | 1 /* XS_CODE_POP */, |
442 | | 1 /* XS_CODE_PROGRAM_ENVIRONMENT */, |
443 | | 0 /* XS_CODE_PROGRAM_REFERENCE */, |
444 | | 2 /* XS_CODE_PULL_CLOSURE_1 */, |
445 | | 3 /* XS_CODE_PULL_CLOSURE_2 */, |
446 | | 2 /* XS_CODE_PULL_LOCAL_1 */, |
447 | | 3 /* XS_CODE_PULL_LOCAL_2 */, |
448 | | 2 /* XS_CODE_REFRESH_CLOSURE_1 */, |
449 | | 3 /* XS_CODE_REFRESH_CLOSURE_2 */, |
450 | | 2 /* XS_CODE_REFRESH_LOCAL_1 */, |
451 | | 3 /* XS_CODE_REFRESH_LOCAL_2 */, |
452 | | 1 /* XS_CODE_REGEXP */, |
453 | | 2 /* XS_CODE_RESERVE_1 */, |
454 | | 3 /* XS_CODE_RESERVE_2 */, |
455 | | 2 /* XS_CODE_RESET_CLOSURE_1 */, |
456 | | 3 /* XS_CODE_RESET_CLOSURE_2 */, |
457 | | 2 /* XS_CODE_RESET_LOCAL_1 */, |
458 | | 3 /* XS_CODE_RESET_LOCAL_2 */, |
459 | | 1 /* XS_CODE_RETHROW */, |
460 | | 2 /* XS_CODE_RETRIEVE_1 */, |
461 | | 3 /* XS_CODE_RETRIEVE_2 */, |
462 | | 1 /* XS_CODE_RETRIEVE_TARGET */, |
463 | | 1 /* XS_CODE_RETRIEVE_THIS */, |
464 | | 1 /* XS_CODE_RETURN */, |
465 | | 1 /* XS_CODE_RUN */, |
466 | | 2 /* XS_CODE_RUN_1 */, |
467 | | 3 /* XS_CODE_RUN_2 */, |
468 | | 5 /* XS_CODE_RUN_4 */, |
469 | | 1 /* XS_CODE_RUN_TAIL */, |
470 | | 2 /* XS_CODE_RUN_TAIL_1 */, |
471 | | 3 /* XS_CODE_RUN_TAIL_2 */, |
472 | | 5 /* XS_CODE_RUN_TAIL_4 */, |
473 | | 2 /* XS_CODE_SET_CLOSURE_1 */, |
474 | | 3 /* XS_CODE_SET_CLOSURE_2 */, |
475 | | 1 /* XS_CODE_SET_HOME */, |
476 | | 2 /* XS_CODE_SET_LOCAL_1 */, |
477 | | 3 /* XS_CODE_SET_LOCAL_2 */, |
478 | | 2 /* XS_CODE_SET_PRIVATE_1 */, |
479 | | 3 /* XS_CODE_SET_PRIVATE_2 */, |
480 | | 0 /* XS_CODE_SET_PROPERTY */, |
481 | | 1 /* XS_CODE_SET_PROPERTY_AT */, |
482 | | 1 /* XS_CODE_SET_RESULT */, |
483 | | 0 /* XS_CODE_SET_SUPER */, |
484 | | 1 /* XS_CODE_SET_SUPER_AT */, |
485 | | 1 /* XS_CODE_SET_THIS */, |
486 | | 0 /* XS_CODE_SET_VARIABLE */, |
487 | | 1 /* XS_CODE_SIGNED_RIGHT_SHIFT */, |
488 | | 1 /* XS_CODE_START_ASYNC */, |
489 | | 1 /* XS_CODE_START_ASYNC_GENERATOR */, |
490 | | 1 /* XS_CODE_START_GENERATOR */, |
491 | | 2 /* XS_CODE_STORE_1 */, |
492 | | 3 /* XS_CODE_STORE_2 */, |
493 | | 1 /* XS_CODE_STORE_ARROW */, |
494 | | 1 /* XS_CODE_STRICT_EQUAL */, |
495 | | 1 /* XS_CODE_STRICT_NOT_EQUAL */, |
496 | | -1 /* XS_CODE_STRING_1 */, |
497 | | -2 /* XS_CODE_STRING_2 */, |
498 | | -4 /* XS_CODE_STRING_4 */, |
499 | | -1 /* XS_CODE_STRING_ARCHIVE_1 */, |
500 | | -2 /* XS_CODE_STRING_ARCHIVE_2 */, |
501 | | -4 /* XS_CODE_STRING_ARCHIVE_4 */, |
502 | | 1 /* XS_CODE_SUBTRACT */, |
503 | | 1 /* XS_CODE_SUPER */, |
504 | | 1 /* XS_CODE_SWAP */, |
505 | | 0 /* XS_CODE_SYMBOL */, |
506 | | 1 /* XS_CODE_TARGET */, |
507 | | 1 /* XS_CODE_TEMPLATE */, |
508 | | 1 /* XS_CODE_TEMPLATE_CACHE */, |
509 | | 1 /* XS_CODE_THIS */, |
510 | | 1 /* XS_CODE_THROW */, |
511 | | 1 /* XS_CODE_THROW_STATUS */, |
512 | | 1 /* XS_CODE_TO_INSTANCE */, |
513 | | 1 /* XS_CODE_TO_NUMERIC */, |
514 | | 1 /* XS_CODE_TO_STRING */, |
515 | | 1 /* XS_CODE_TRANSFER */, |
516 | | 1 /* XS_CODE_TRUE */, |
517 | | 1 /* XS_CODE_TYPEOF */, |
518 | | 1 /* XS_CODE_UNCATCH */, |
519 | | 1 /* XS_CODE_UNDEFINED */, |
520 | | 1 /* XS_CODE_UNSIGNED_RIGHT_SHIFT */, |
521 | | 2 /* XS_CODE_UNWIND_1 */, |
522 | | 3 /* XS_CODE_UNWIND_2 */, |
523 | | 2 /* XS_CODE_VAR_CLOSURE_1 */, |
524 | | 3 /* XS_CODE_VAR_CLOSURE_2 */, |
525 | | 2 /* XS_CODE_VAR_LOCAL_1 */, |
526 | | 3 /* XS_CODE_VAR_LOCAL_2 */, |
527 | | 1 /* XS_CODE_VOID */, |
528 | | 1 /* XS_CODE_WITH */, |
529 | | 1 /* XS_CODE_WITHOUT */, |
530 | | 1 /* XS_CODE_YIELD */, |
531 | | #ifdef mx32bitID |
532 | | 5 /* XS_CODE_PROFILE */, |
533 | | #else |
534 | | 3 /* XS_CODE_PROFILE */, |
535 | | #endif |
536 | | 1 /* XS_CODE_YIELD_STAR */, |
537 | | // mxExplicitResourceManagement |
538 | | 2 /* XS_CODE_USED_1 */, |
539 | | 3 /* XS_CODE_USED_2 */, |
540 | | 1 /* XS_CODE_USING */, |
541 | | 1 /* XS_CODE_USING_ASYNC */, |
542 | | 1 /* XS_CODE_AT_2 */, |
543 | | 1 /* XS_CODE_SUPER_AT */, |
544 | | 1 /* XS_CODE_SUPER_AT_2 */, |
545 | | 1 /* XS_CODE_TRANSFER_JSON */, |
546 | | }; |
547 | | |
548 | | #if mxUseDefaultCStackLimit |
549 | | |
550 | | #ifdef __ets__ |
551 | | #if ESP32 |
552 | | #include "freertos/task.h" |
553 | | #else |
554 | | #include "cont.h" |
555 | | #endif |
556 | | #endif |
557 | | |
558 | | #ifndef mxASANStackMargin |
559 | | #define mxASANStackMargin 0 |
560 | | #endif |
561 | | |
562 | | #if mxWindows |
563 | | ULONG GetCurrentThreadStackLimits_Win7( _Out_ PULONG_PTR LowLimit, _Out_ PULONG_PTR HighLimit ) |
564 | | { |
565 | | static void (WINAPI* GetCurrentThreadStackLimits)(PULONG_PTR , PULONG_PTR); |
566 | | |
567 | | if (!GetCurrentThreadStackLimits) |
568 | | { |
569 | | *(void**)&GetCurrentThreadStackLimits = GetProcAddress(GetModuleHandle("kernel32"), "GetCurrentThreadStackLimits"); |
570 | | |
571 | | if (!GetCurrentThreadStackLimits) |
572 | | { |
573 | | NT_TIB* tib = (NT_TIB*)NtCurrentTeb(); |
574 | | *HighLimit = (ULONG_PTR)tib->StackBase; |
575 | | |
576 | | MEMORY_BASIC_INFORMATION mbi; |
577 | | if (VirtualQuery(tib->StackLimit, &mbi, sizeof(mbi))) |
578 | | { |
579 | | *LowLimit = (ULONG_PTR)mbi.AllocationBase; |
580 | | return 0; |
581 | | } |
582 | | |
583 | | return GetLastError(); |
584 | | } |
585 | | } |
586 | | |
587 | | GetCurrentThreadStackLimits(LowLimit, HighLimit); |
588 | | return 0; |
589 | | } |
590 | | #endif |
591 | | |
592 | | char* fxCStackLimit() |
593 | 2.44M | { |
594 | | #if mxWindows |
595 | | ULONG_PTR low, high; |
596 | | GetCurrentThreadStackLimits_Win7(&low, &high); |
597 | | return (char*)low + (32 * 1024); |
598 | | #elif mxMacOSX |
599 | | pthread_t self = pthread_self(); |
600 | | void* stackAddr = pthread_get_stackaddr_np(self); |
601 | | size_t stackSize = pthread_get_stacksize_np(self); |
602 | | return (char*)stackAddr - stackSize + (128 * 1024) + mxASANStackMargin; |
603 | | #elif mxLinux |
604 | 2.44M | char* result = C_NULL; |
605 | 2.44M | pthread_attr_t attrs; |
606 | 2.44M | pthread_attr_init(&attrs); |
607 | 2.44M | if (pthread_getattr_np(pthread_self(), &attrs) == 0) { |
608 | 2.44M | void* stackAddr; |
609 | 2.44M | size_t stackSize; |
610 | 2.44M | if (pthread_attr_getstack(&attrs, &stackAddr, &stackSize) == 0) { |
611 | 2.44M | result = (char*)stackAddr + (128 * 1024) + mxASANStackMargin; |
612 | 2.44M | } |
613 | 2.44M | } |
614 | 2.44M | pthread_attr_destroy(&attrs); |
615 | 2.44M | return result; |
616 | | #elif defined(__ets__) && !ESP32 |
617 | | extern cont_t g_cont; |
618 | | return 192 + (char *)g_cont.stack; |
619 | | #elif defined(__ets__) && ESP32 |
620 | | TaskStatus_t info; |
621 | | vTaskGetInfo(NULL, &info, pdFALSE, eReady); |
622 | | return 512 + (char *)info.pxStackBase; |
623 | | #else |
624 | | return C_NULL; |
625 | | #endif |
626 | 2.44M | } |
627 | | |
628 | | #endif |
629 | | |
630 | | void fxDeleteScript(txScript* script) |
631 | 973k | { |
632 | 973k | if (script) { |
633 | 939k | if (script->symbolsBuffer) |
634 | 939k | c_free(script->symbolsBuffer); |
635 | 939k | if (script->hostsBuffer) |
636 | 0 | c_free(script->hostsBuffer); |
637 | 939k | if (script->codeBuffer) |
638 | 939k | c_free(script->codeBuffer); |
639 | 939k | c_free(script); |
640 | 939k | } |
641 | 973k | } |
642 | | |
643 | | |
644 | | const txUTF8Sequence gxUTF8Sequences[] ICACHE_RODATA_ATTR = { |
645 | | {1, 0x80, 0x00, 0*6, 0x0000007F}, |
646 | | {2, 0xE0, 0xC0, 1*6, 0x000007FF}, |
647 | | {3, 0xF0, 0xE0, 2*6, 0x0000FFFF}, |
648 | | {4, 0xF8, 0xF0, 3*6, 0x001FFFFF}, |
649 | | {5, 0xFC, 0xF8, 4*6, 0x03FFFFFF}, |
650 | | {6, 0xFE, 0xFC, 5*6, 0x7FFFFFFF}, |
651 | | {0, 0, 0, 0, 0}, |
652 | | }; |
653 | | |
654 | | static const char gxHexLower[] ICACHE_FLASH_ATTR = "0123456789abcdef"; |
655 | | static const char gxHexUpper[] ICACHE_FLASH_ATTR = "0123456789ABCDEF"; |
656 | | |
657 | | txBoolean fxIsIdentifierFirst(txU4 c) |
658 | 5.72M | { |
659 | 5.72M | #define mxIdentifierFirstCount 1358 |
660 | 5.72M | static const txU2 gxIdentifierFirstTable[mxIdentifierFirstCount] ICACHE_RODATA_ATTR = { |
661 | 5.72M | 36,0,29,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,130,4,2,1, |
662 | 5.72M | 3,3,2,0,7,0,2,2,2,0,2,19,2,82,2,138,9,165,2,37,3,0,7,40,72,26,5,3,46,42,36,1, |
663 | 5.72M | 2,98,2,0,16,1,8,1,11,2,3,0,17,0,2,29,30,88,12,0,25,32,10,1,5,0,6,21,5,0,10,0, |
664 | 5.72M | 4,0,24,24,8,10,6,23,2,5,18,41,59,53,4,0,19,0,8,9,16,15,5,7,3,1,3,21,2,6,2,0, |
665 | 5.72M | 4,3,4,0,17,0,14,1,2,2,15,1,11,0,9,5,5,1,3,21,2,6,2,1,2,1,2,1,32,3,2,0, |
666 | 5.72M | 20,2,17,8,2,2,2,21,2,6,2,1,2,4,4,0,19,0,16,1,24,0,12,7,3,1,3,21,2,6,2,1, |
667 | 5.72M | 2,4,4,0,31,1,2,2,16,0,18,0,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,23,0, |
668 | 5.72M | 53,7,2,2,2,22,2,15,4,0,27,2,3,0,3,1,31,0,5,7,2,2,2,22,2,9,2,4,4,0,32,1, |
669 | 5.72M | 2,1,16,1,18,8,2,2,2,40,3,0,17,0,6,2,9,2,25,5,6,17,4,23,2,8,2,0,3,6,59,47, |
670 | 5.72M | 2,1,13,6,59,1,2,0,2,4,2,23,2,0,2,9,2,1,10,0,3,4,2,0,22,3,33,0,64,7,2,35, |
671 | 5.72M | 28,4,116,42,21,0,17,5,5,3,4,0,4,1,8,2,5,12,13,0,18,37,2,0,6,0,3,42,2,332,2,3, |
672 | 5.72M | 3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,38,15,17,85, |
673 | 5.72M | 3,5,4,619,3,16,2,25,6,74,4,10,8,17,14,18,15,17,15,12,2,2,16,51,36,0,5,0,68,88,8,40, |
674 | 5.72M | 2,0,6,69,11,30,50,29,3,4,12,43,5,25,55,22,10,52,83,0,94,46,18,7,55,29,14,1,11,43,27,35, |
675 | 5.72M | 42,2,11,35,3,10,6,42,3,2,42,3,2,5,2,1,4,0,6,191,65,277,3,5,3,37,3,5,3,7,2,0, |
676 | 5.72M | 2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,117,0,14,0,17,12, |
677 | 5.72M | 102,0,5,0,3,9,2,0,3,5,7,0,2,0,2,0,2,15,3,3,6,4,5,0,18,40,2680,228,7,3,4,1, |
678 | 5.72M | 13,37,2,0,6,0,3,55,8,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,551,2,26,8, |
679 | 5.72M | 8,4,3,4,5,85,5,4,2,89,2,3,6,42,2,93,18,31,49,15,513,6591,65,22156,68,45,3,268,4,15,11,1, |
680 | 5.72M | 21,46,17,30,3,79,40,8,3,102,3,66,3,1,2,0,2,7,22,15,2,2,2,3,2,22,30,51,15,49,63,5, |
681 | 5.72M | 4,0,2,1,12,27,11,22,26,28,8,46,29,0,17,4,2,9,11,4,2,40,24,2,2,7,21,22,4,0,4,49, |
682 | 5.72M | 2,0,4,1,3,4,3,0,2,0,25,2,3,10,8,2,13,5,3,5,3,5,10,6,2,6,2,42,2,13,7,114, |
683 | 5.72M | 30,11171,13,22,5,48,8453,365,3,105,39,6,13,4,6,0,2,9,2,12,2,4,2,0,2,1,2,1,2,107,34,362, |
684 | 5.72M | 19,63,3,53,41,11,117,4,2,134,37,25,7,25,12,88,4,5,3,5,3,5,3,2,36,11,2,25,2,18,2,1, |
685 | 5.72M | 2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35, |
686 | 5.72M | 5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41, |
687 | 5.72M | 2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0, |
688 | 5.72M | 16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27, |
689 | 5.72M | 10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35, |
690 | 5.72M | 30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9, |
691 | 5.72M | 8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0, |
692 | 5.72M | 2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43, |
693 | 5.72M | 117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0, |
694 | 5.72M | 12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0, |
695 | 5.72M | 328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30, |
696 | 5.72M | 18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9, |
697 | 5.72M | 8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1, |
698 | 5.72M | 3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339, |
699 | 5.72M | 3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6, |
700 | 5.72M | 17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1, |
701 | 5.72M | 2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0, |
702 | 5.72M | 2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153, |
703 | 5.72M | 7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191, |
704 | 5.72M | }; |
705 | 5.72M | const txU2* p = gxIdentifierFirstTable; |
706 | 5.72M | const txU2* q = p + mxIdentifierFirstCount; |
707 | 5.72M | txU4 s = 0; |
708 | 79.3M | while (p < q) { |
709 | 79.2M | s += c_read16(p++); |
710 | 79.2M | if (c < s) |
711 | 930k | return 0; |
712 | 78.3M | s += c_read16(p++); |
713 | 78.3M | if (c <= s) |
714 | 4.77M | return 1; |
715 | 78.3M | } |
716 | 13.5k | return 0; |
717 | 5.72M | } |
718 | | |
719 | | txBoolean fxIsIdentifierNext(txU4 c) |
720 | 23.1M | { |
721 | 23.1M | #define mxIdentifierNextCount 1586 |
722 | 23.1M | static const txU2 gxIdentifierNextTable[mxIdentifierNextCount] ICACHE_RODATA_ATTR = { |
723 | 23.1M | 36,0,12,9,8,25,5,0,2,25,48,0,11,0,2,0,3,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0, |
724 | 23.1M | 18,116,2,1,3,3,2,0,7,4,2,0,2,19,2,82,2,138,2,4,3,165,2,37,3,0,7,40,9,44,2,0, |
725 | 23.1M | 2,1,2,1,2,0,9,26,5,3,30,10,6,73,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0, |
726 | 23.1M | 3,0,3,45,19,27,5,10,6,23,2,5,9,74,2,128,3,9,2,18,2,7,3,1,3,21,2,6,2,0,4,3, |
727 | 23.1M | 3,8,3,1,3,3,9,0,5,1,2,4,3,11,11,0,2,0,3,2,2,5,5,1,3,21,2,6,2,1,2,1, |
728 | 23.1M | 2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4, |
729 | 23.1M | 3,9,2,2,2,2,3,0,16,3,3,9,10,6,2,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1, |
730 | 23.1M | 3,2,8,2,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11, |
731 | 23.1M | 5,4,4,2,2,3,3,0,7,0,15,9,17,12,2,2,2,22,2,15,3,8,2,2,2,3,8,1,2,2,3,0, |
732 | 23.1M | 3,3,3,9,17,3,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,7,1,2,3,3,9,2,2, |
733 | 23.1M | 13,12,2,2,2,50,2,2,2,4,6,3,8,4,3,9,11,5,2,2,2,17,4,23,2,8,2,0,3,6,4,0, |
734 | 23.1M | 5,5,2,0,2,7,7,9,3,1,14,57,6,14,2,9,40,1,2,0,2,4,2,23,2,0,2,22,3,4,2,0, |
735 | 23.1M | 2,6,2,9,3,3,33,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,17,2,35,10,0,58,73, |
736 | 23.1M | 7,77,3,37,2,0,6,0,3,42,2,332,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0, |
737 | 23.1M | 2,3,3,14,2,56,2,3,3,66,3,2,10,8,15,15,17,85,3,5,4,619,3,16,2,25,6,74,4,10,8,21, |
738 | 23.1M | 10,21,12,19,13,12,2,2,2,1,13,83,4,0,5,1,3,9,34,2,2,10,7,88,8,42,6,69,11,30,2,11, |
739 | 23.1M | 5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,9,13,2,15,50,76,4,9, |
740 | 23.1M | 18,8,13,115,13,55,9,9,4,48,3,10,6,42,3,2,17,2,2,38,6,533,3,5,3,37,3,5,3,7,2,0, |
741 | 23.1M | 2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,16,1,50,1,20,0, |
742 | 23.1M | 29,0,14,0,17,12,52,12,5,0,4,11,18,0,5,0,3,9,2,0,3,5,7,0,2,0,2,0,2,15,3,3, |
743 | 23.1M | 6,4,5,0,18,40,2680,228,7,8,13,37,2,0,6,0,3,55,8,0,16,23,10,6,2,6,2,6,2,6,2,6, |
744 | 23.1M | 2,6,2,6,2,6,2,31,518,2,26,14,2,4,3,4,5,85,3,6,2,94,6,42,2,93,18,31,49,15,513,6591, |
745 | 23.1M | 65,22156,68,45,3,268,4,27,21,47,5,9,2,114,38,8,3,102,3,66,3,1,2,0,2,7,22,53,5,0,20,51, |
746 | 23.1M | 13,69,11,9,7,23,4,0,2,48,3,35,13,28,4,64,15,10,7,30,2,54,10,13,3,9,7,22,4,72,25,2, |
747 | 23.1M | 3,15,3,4,11,5,3,5,3,5,10,6,2,6,2,42,2,13,7,122,2,1,3,9,7,11171,13,22,5,48,8453,365, |
748 | 23.1M | 3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,15, |
749 | 23.1M | 4,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,11,89,4,5,3,5,3,5,3,2,36,11,2,25,2,18, |
750 | 23.1M | 2,1,2,14,3,13,35,122,70,52,137,0,131,28,4,48,16,0,32,31,14,29,6,42,6,29,3,35,5,7,2,4, |
751 | 23.1M | 43,157,3,9,7,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310, |
752 | 23.1M | 10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21, |
753 | 23.1M | 11,25,71,55,7,1,65,3,2,1,6,7,2,2,2,28,3,2,5,0,33,28,4,28,36,7,2,29,26,53,11,21, |
754 | 23.1M | 11,18,14,17,111,72,56,50,14,50,14,39,9,9,7,37,4,4,2,22,251,41,2,1,4,1,17,2,56,32,11,0, |
755 | 23.1M | 9,32,32,21,43,20,28,22,10,70,32,15,10,59,8,0,14,24,8,9,7,52,2,9,5,3,9,35,3,0,10,68, |
756 | 23.1M | 5,3,2,12,2,0,36,17,2,36,7,3,63,6,2,0,2,3,2,14,2,9,8,58,6,9,7,3,2,7,3,1, |
757 | 23.1M | 3,21,2,6,2,1,2,4,2,9,3,1,3,2,3,0,7,0,6,6,3,6,4,4,12,9,2,0,3,0,2,37, |
758 | 23.1M | 2,9,2,0,3,0,2,3,2,7,14,1,30,74,6,9,5,3,31,69,2,0,9,9,167,53,3,8,24,5,35,64, |
759 | 23.1M | 4,0,12,9,39,56,8,9,7,19,29,26,3,14,5,9,7,6,186,58,102,73,22,7,3,0,3,7,2,1,2,29, |
760 | 23.1M | 2,1,3,8,13,9,71,7,3,45,3,7,2,1,28,62,9,0,9,73,4,0,19,72,200,32,16,9,7,8,2,44, |
761 | 23.1M | 2,8,16,9,25,29,3,21,2,13,74,6,2,1,2,43,4,0,2,1,2,8,9,9,7,5,2,1,2,36,2,1, |
762 | 23.1M | 2,5,8,9,311,22,10,16,2,40,4,4,14,10,86,0,80,921,103,110,18,195,2637,96,16,1071,17,21,11,3994,6,582, |
763 | 23.1M | 6842,57,1735,568,8,30,2,9,7,78,2,9,7,29,3,4,12,54,10,3,13,9,10,20,6,18,433,44,4,9,199,63, |
764 | 23.1M | 129,74,5,56,8,16,65,1,2,1,12,1,15,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0, |
765 | 23.1M | 15,3,9,395,2309,106,6,12,4,8,8,9,4,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2, |
766 | 23.1M | 444,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4, |
767 | 23.1M | 2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,3,49,513,54, |
768 | 23.1M | 5,49,9,0,15,0,23,4,2,14,1105,30,7,5,214,6,2,16,3,6,2,1,2,4,6,61,34,0,113,44,4,13, |
769 | 23.1M | 3,9,5,0,322,30,18,57,471,41,215,42,486,6,2,3,2,1,2,14,2,196,12,6,42,75,5,9,1191,3,2,26, |
770 | 23.1M | 2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0, |
771 | 23.1M | 2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,3381,9, |
772 | 23.1M | 1031,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191, |
773 | 23.1M | }; |
774 | 23.1M | const txU2* p = gxIdentifierNextTable; |
775 | 23.1M | const txU2* q = p + mxIdentifierNextCount; |
776 | 23.1M | txU4 s = 0; |
777 | 195M | while (p < q) { |
778 | 195M | s += c_read16(p++); |
779 | 195M | if (c < s) |
780 | 4.66M | return 0; |
781 | 190M | s += c_read16(p++); |
782 | 190M | if (c <= s) |
783 | 18.3M | return 1; |
784 | 190M | } |
785 | 98.7k | s += 712017; |
786 | 98.7k | if (c < s) |
787 | 1.23k | return 0; |
788 | 97.5k | s += 239; |
789 | 97.5k | if (c <= s) |
790 | 12 | return 1; |
791 | 97.4k | return 0; |
792 | 97.5k | } |
793 | | |
794 | | txBoolean fxIsSpace(txInteger character) |
795 | 43.5M | { |
796 | 43.5M | static const txU4 spaces[27] ICACHE_RODATA_ATTR = { |
797 | 43.5M | 0x00000009, |
798 | 43.5M | 0x0000000A, |
799 | 43.5M | 0x0000000B, |
800 | 43.5M | 0x0000000C, |
801 | 43.5M | 0x0000000D, |
802 | 43.5M | 0x00000020, |
803 | 43.5M | 0x000000A0, |
804 | 43.5M | 0x00001680, |
805 | 43.5M | 0x00002000, |
806 | 43.5M | 0x00002001, |
807 | 43.5M | 0x00002002, |
808 | 43.5M | 0x00002003, |
809 | 43.5M | 0x00002004, |
810 | 43.5M | 0x00002005, |
811 | 43.5M | 0x00002006, |
812 | 43.5M | 0x00002007, |
813 | 43.5M | 0x00002008, |
814 | 43.5M | 0x00002009, |
815 | 43.5M | 0x0000200A, |
816 | 43.5M | 0x00002028, |
817 | 43.5M | 0x00002029, |
818 | 43.5M | 0x0000202F, |
819 | 43.5M | 0x0000205F, |
820 | 43.5M | 0x00003000, |
821 | 43.5M | 0x0000FEFF, |
822 | 43.5M | 0xFFFFFFFF, |
823 | 43.5M | 0x00000000, |
824 | 43.5M | }; |
825 | 43.5M | const txU4 *p = spaces; |
826 | 43.5M | txU4 c = (txU4)character; |
827 | 43.5M | txU4 s; |
828 | 339M | while ((s = *p++)) { |
829 | 339M | if (c < s) |
830 | 43.0M | return 0; |
831 | 296M | if (c == s) |
832 | 489k | return 1; |
833 | 296M | } |
834 | 0 | return 0; |
835 | 43.5M | } |
836 | | |
837 | | txBoolean fxParseHex(txU1 c, txU4* value) |
838 | 4.92M | { |
839 | 4.92M | if (('0' <= c) && (c <= '9')) |
840 | 1.83M | *value = (*value * 16) + (c - '0'); |
841 | 3.08M | else if (('a' <= c) && (c <= 'f')) |
842 | 1.21M | *value = (*value * 16) + (10 + c - 'a'); |
843 | 1.87M | else if (('A' <= c) && (c <= 'F')) |
844 | 1.56M | *value = (*value * 16) + (10 + c - 'A'); |
845 | 312k | else |
846 | 312k | return 0; |
847 | 4.60M | return 1; |
848 | 4.92M | } |
849 | | |
850 | | txBoolean fxParseHexEscape(txString* string, txInteger* character) |
851 | 2.02M | { |
852 | 2.02M | txU1* p = *((txU1**)string); |
853 | 2.02M | txU4 value = 0; |
854 | 2.02M | txU1 i, c; |
855 | 5.66M | for (i = 0; i < 2; i++) { |
856 | 3.86M | c = c_read8(p); |
857 | 3.86M | if (!fxParseHex(c, &value)) |
858 | 221k | return 0; |
859 | 3.64M | p++; |
860 | 3.64M | } |
861 | 1.80M | *character = (txInteger)value; |
862 | 1.80M | *string = (txString)p; |
863 | 1.80M | return 1; |
864 | 2.02M | } |
865 | | |
866 | | txBoolean fxParseUnicodeEscape(txString* string, txInteger* character, txInteger braces, txInteger separator) |
867 | 282k | { |
868 | 282k | txU1* p = *((txU1**)string); |
869 | 282k | txU4 value = 0; |
870 | 282k | txU1 c; |
871 | 282k | txInteger i; |
872 | | |
873 | 282k | c = c_read8(p++); |
874 | 282k | if (braces && (c == '{')) { |
875 | 3.87k | c = c_read8(p++); |
876 | 17.0k | for (i = 0; value < 0x00110000; i++) { |
877 | 15.6k | if (fxParseHex(c, &value)) { |
878 | 13.1k | c = c_read8(p++); |
879 | 13.1k | } |
880 | 2.45k | else |
881 | 2.45k | break; |
882 | 15.6k | } |
883 | 3.87k | if ((c == '}') && (i > 0) && (value < 0x00110000)) { |
884 | 953 | *character = (txInteger)value; |
885 | 953 | *string = (txString)p; |
886 | 953 | return 1; |
887 | 953 | } |
888 | 2.92k | return 0; |
889 | 3.87k | } |
890 | 278k | if (!fxParseHex(c, &value)) return 0; |
891 | 252k | c = c_read8(p++); |
892 | 252k | if (!fxParseHex(c, &value)) return 0; |
893 | 227k | c = c_read8(p++); |
894 | 227k | if (!fxParseHex(c, &value)) return 0; |
895 | 199k | c = c_read8(p++); |
896 | 199k | if (!fxParseHex(c, &value)) return 0; |
897 | 192k | *character = (txInteger)value; |
898 | 192k | *string = (txString)p; |
899 | 192k | c = c_read8(p++); |
900 | 192k | if (c && (c == separator) && (0x0000D800 <= value) && (value <= 0x0000DBFF)) { |
901 | 23.2k | c = c_read8(p++); |
902 | 23.2k | if (c == 'u') { |
903 | 22.7k | txU4 other = 0; |
904 | 22.7k | c = c_read8(p++); |
905 | 22.7k | if (!fxParseHex(c, &other)) return 1; |
906 | 22.2k | c = c_read8(p++); |
907 | 22.2k | if (!fxParseHex(c, &other)) return 1; |
908 | 20.4k | c = c_read8(p++); |
909 | 20.4k | if (!fxParseHex(c, &other)) return 1; |
910 | 20.3k | c = c_read8(p++); |
911 | 20.3k | if (!fxParseHex(c, &other)) return 1; |
912 | 19.9k | if ((0x0000DC00 <= other) && (other <= 0x0000DFFF)) { |
913 | 16.8k | *character = (txInteger)(0x00010000 + ((value & 0x03FF) << 10) + (other & 0x03FF)); |
914 | 16.8k | *string = (txString)p; |
915 | 16.8k | } |
916 | 19.9k | } |
917 | 23.2k | } |
918 | 190k | return 1; |
919 | 192k | } |
920 | | |
921 | | txString fxSkipSpaces(txString string) |
922 | 54.5M | { |
923 | 54.5M | txString p = string; |
924 | 54.5M | txString q = p; |
925 | 54.5M | txInteger c; |
926 | 55.0M | while (((q = fxUTF8Decode(q, &c))) && (c != C_EOF)) { |
927 | 43.5M | if (fxIsSpace(c)) |
928 | 489k | p = q; |
929 | 43.0M | else |
930 | 43.0M | break; |
931 | 43.5M | } |
932 | 54.5M | return p; |
933 | 54.5M | } |
934 | | |
935 | | txString fxStringifyHexEscape(txString string, txInteger character) |
936 | 880k | { |
937 | 880k | const char* digits = gxHexUpper; |
938 | 880k | txU1* p = (txU1*)string; |
939 | 880k | *p++ = c_read8(digits + ((character & 0x000000F0) >> 4)); |
940 | 880k | *p++ = c_read8(digits + (character & 0x0000000F)); |
941 | 880k | return (txString)p; |
942 | 880k | } |
943 | | |
944 | | txString fxStringifyUnicodeEscape(txString string, txInteger character, txInteger separator) |
945 | 10.2M | { |
946 | 10.2M | const char* digits = (separator == '%') ? gxHexUpper : gxHexLower; |
947 | 10.2M | txU1* p = (txU1*)string; |
948 | 10.2M | txInteger surrogate; |
949 | 10.2M | if (character > 0xFFFF) { |
950 | 96 | character -= 0x10000; |
951 | 96 | surrogate = 0xDC00 | (character & 0x3FF); |
952 | 96 | character = 0xD800 | (character >> 10); |
953 | 96 | } |
954 | 10.2M | else |
955 | 10.2M | surrogate = 0; |
956 | 10.2M | *p++ = c_read8(digits + ((character & 0x0000F000) >> 12)); |
957 | 10.2M | *p++ = c_read8(digits + ((character & 0x00000F00) >> 8)); |
958 | 10.2M | *p++ = c_read8(digits + ((character & 0x000000F0) >> 4)); |
959 | 10.2M | *p++ = c_read8(digits + (character & 0x0000000F)); |
960 | 10.2M | if (surrogate) { |
961 | 96 | *p++ = separator; |
962 | 96 | *p++ = 'u'; |
963 | 96 | *p++ = c_read8(digits + ((surrogate & 0x0000F000) >> 12)); |
964 | 96 | *p++ = c_read8(digits + ((surrogate & 0x00000F00) >> 8)); |
965 | 96 | *p++ = c_read8(digits + ((surrogate & 0x000000F0) >> 4)); |
966 | 96 | *p++ = c_read8(digits + (surrogate & 0x0000000F)); |
967 | 96 | } |
968 | 10.2M | return (txString)p; |
969 | 10.2M | } |
970 | | |
971 | | int fxUTF8Compare(txString p1, txString p2) |
972 | 449k | { |
973 | 449k | register const unsigned char *s1 = (const unsigned char *) p1; |
974 | 449k | register const unsigned char *s2 = (const unsigned char *) p2; |
975 | 449k | unsigned char c1, c2; |
976 | 2.78M | do { |
977 | 2.78M | c1 = (unsigned char) *s1++; |
978 | 2.78M | c2 = (unsigned char) *s2++; |
979 | 2.78M | if (c1 == '\0') |
980 | 246k | return c1 - c2; |
981 | 2.78M | } |
982 | 2.54M | while (c1 == c2); |
983 | 203k | if (c2 == '\0') |
984 | 106k | return c1 - c2; |
985 | 96.5k | if ((c1 == 0xC0) && (*s1 == 0x80)) |
986 | 2.80k | return 0 - c2; |
987 | 93.7k | if ((c2 == 0xC0) && (*s2 == 0x80)) |
988 | 263 | return c1 - 0; |
989 | 93.4k | return c1 - c2; |
990 | 93.7k | } |
991 | | |
992 | | txString fxUTF8Decode(txString string, txInteger* character) |
993 | 898M | { |
994 | 898M | txU1* p = (txU1*)string; |
995 | 898M | txU4 c = c_read8(p++); |
996 | 898M | if (c) { |
997 | 806M | if (c & 0x80) { |
998 | 367M | const txUTF8Sequence *sequence; |
999 | 367M | txS4 size; |
1000 | 1.00G | for (sequence = gxUTF8Sequences; sequence->size; sequence++) { |
1001 | 1.00G | if ((c & sequence->cmask) == sequence->cval) |
1002 | 367M | break; |
1003 | 1.00G | } |
1004 | 367M | size = sequence->size - 1; |
1005 | 1.00G | while (size > 0) { |
1006 | 640M | size--; |
1007 | 640M | c = (c << 6) | (c_read8(p++) & 0x3F); |
1008 | 640M | } |
1009 | 367M | c &= sequence->lmask; |
1010 | 367M | } |
1011 | 806M | *character = (txInteger)c; |
1012 | 806M | return (txString)p; |
1013 | 806M | } |
1014 | 92.1M | *character = C_EOF; |
1015 | 92.1M | return (txString)p; |
1016 | 898M | } |
1017 | | |
1018 | | txString fxUTF8Encode(txString string, txInteger character) |
1019 | 11.6M | { |
1020 | 11.6M | txU1* p = (txU1*)string; |
1021 | 11.6M | if (character < 0) { |
1022 | 0 | } |
1023 | 11.6M | else if (character == 0) { |
1024 | 1.08M | *p++ = 0xC0; |
1025 | 1.08M | *p++ = 0x80; |
1026 | 1.08M | } |
1027 | 10.6M | else if (character < 0x80) { |
1028 | 6.42M | *p++ = (txU1)character; |
1029 | 6.42M | } |
1030 | 4.18M | else if (character < 0x800) { |
1031 | 36.8k | *p++ = (txU1)(0xC0 | (((txU4)character) >> 6)); |
1032 | 36.8k | *p++ = (txU1)(0x80 | (((txU4)character) & 0x3F)); |
1033 | 36.8k | } |
1034 | 4.14M | else if (character < 0x10000) { |
1035 | 4.12M | *p++ = (txU1)(0xE0 | (((txU4)character) >> 12)); |
1036 | 4.12M | *p++ = (txU1)(0x80 | ((((txU4)character) >> 6) & 0x3F)); |
1037 | 4.12M | *p++ = (txU1)(0x80 | (((txU4)character) & 0x3F)); |
1038 | 4.12M | } |
1039 | 23.3k | else if (character < 0x110000) { |
1040 | 23.3k | *p++ = (txU1)(0xF0 | (((txU4)character) >> 18)); |
1041 | 23.3k | *p++ = (txU1)(0x80 | ((((txU4)character) >> 12) & 0x3F)); |
1042 | 23.3k | *p++ = (txU1)(0x80 | ((((txU4)character) >> 6) & 0x3F)); |
1043 | 23.3k | *p++ = (txU1)(0x80 | (((txU4)character) & 0x3F)); |
1044 | 23.3k | } |
1045 | 11.6M | return (txString)p; |
1046 | 11.6M | } |
1047 | | |
1048 | | txSize fxUTF8Length(txInteger character) |
1049 | 23.1M | { |
1050 | 23.1M | txSize length; |
1051 | 23.1M | if (character < 0) |
1052 | 0 | length = 0; |
1053 | 23.1M | else if (character == 0) |
1054 | 2.16M | length = 2; |
1055 | 21.0M | else if (character < 0x80) |
1056 | 12.8M | length = 1; |
1057 | 8.16M | else if (character < 0x800) |
1058 | 73.7k | length = 2; |
1059 | 8.08M | else if (character < 0x10000) |
1060 | 8.06M | length = 3; |
1061 | 19.7k | else if (character < 0x110000) |
1062 | 19.7k | length = 4; |
1063 | 0 | else |
1064 | 0 | length = 0; |
1065 | 23.1M | return length; |
1066 | 23.1M | } |
1067 | | |
1068 | | #if mxCESU8 |
1069 | | |
1070 | | int fxCESU8Compare(txString p1, txString p2) |
1071 | 0 | { |
1072 | 0 | txInteger c1, c2; |
1073 | 0 | while (*p1 && *p2) { |
1074 | 0 | p1 = fxCESU8Decode(p1, &c1); |
1075 | 0 | p2 = fxCESU8Decode(p2, &c2); |
1076 | 0 | if (c1 < c2) return -1; |
1077 | 0 | if (c1 > c2) return 1; |
1078 | 0 | } |
1079 | 0 | if (*p1) return 1; |
1080 | 0 | if (*p2) return -1; |
1081 | 0 | return 0; |
1082 | 0 | } |
1083 | | |
1084 | | txString fxCESU8Decode(txString string, txInteger* character) |
1085 | 644M | { |
1086 | 644M | txInteger result; |
1087 | 644M | string = fxUTF8Decode(string, &result); |
1088 | 644M | if ((0x0000D800 <= result) && (result <= 0x0000DBFF)) { |
1089 | 1.78M | txString former = string; |
1090 | 1.78M | txInteger surrogate; |
1091 | 1.78M | string = fxUTF8Decode(former, &surrogate); |
1092 | 1.78M | if ((0x0000DC00 <= surrogate) && (surrogate <= 0x0000DFFF)) |
1093 | 758k | result = 0x00010000 + ((result & 0x000003FF) << 10) + (surrogate & 0x000003FF); |
1094 | 1.02M | else |
1095 | 1.02M | string = former; |
1096 | 1.78M | } |
1097 | 644M | *character = result; |
1098 | 644M | return string; |
1099 | 644M | } |
1100 | | |
1101 | | txString fxCESU8Encode(txString string, txInteger character) |
1102 | 207M | { |
1103 | 207M | txU1* p = (txU1*)string; |
1104 | 207M | if (character < 0) { |
1105 | 2.98k | } |
1106 | 207M | else if (character == 0) { |
1107 | 12.4M | *p++ = 0xC0; |
1108 | 12.4M | *p++ = 0x80; |
1109 | 12.4M | } |
1110 | 194M | else if (character < 0x80) { |
1111 | 130M | *p++ = (txU1)character; |
1112 | 130M | } |
1113 | 64.2M | else if (character < 0x800) { |
1114 | 1.25M | *p++ = (txU1)(0xC0 | (((txU4)character) >> 6)); |
1115 | 1.25M | *p++ = (txU1)(0x80 | (((txU4)character) & 0x3F)); |
1116 | 1.25M | } |
1117 | 62.9M | else if (character < 0x10000) { |
1118 | 62.8M | *p++ = (txU1)(0xE0 | (((txU4)character) >> 12)); |
1119 | 62.8M | *p++ = (txU1)(0x80 | ((((txU4)character) >> 6) & 0x3F)); |
1120 | 62.8M | *p++ = (txU1)(0x80 | (((txU4)character) & 0x3F)); |
1121 | 62.8M | } |
1122 | 116k | else if (character < 0x110000) { |
1123 | 116k | txInteger surrogate; |
1124 | 116k | character -= 0x00010000; |
1125 | 116k | surrogate = 0xDC00 | (character & 0x3FF); |
1126 | 116k | character = 0xD800 | ((character >> 10) & 0x3FF); |
1127 | 116k | *p++ = (txU1)(0xE0 | (((txU4)character) >> 12)); |
1128 | 116k | *p++ = (txU1)(0x80 | ((((txU4)character) >> 6) & 0x3F)); |
1129 | 116k | *p++ = (txU1)(0x80 | (((txU4)character) & 0x3F)); |
1130 | 116k | *p++ = (txU1)(0xE0 | (((txU4)surrogate) >> 12)); |
1131 | 116k | *p++ = (txU1)(0x80 | ((((txU4)surrogate) >> 6) & 0x3F)); |
1132 | 116k | *p++ = (txU1)(0x80 | (((txU4)surrogate) & 0x3F)); |
1133 | 116k | } |
1134 | 207M | return (txString)p; |
1135 | 207M | } |
1136 | | |
1137 | | txSize fxCESU8Length(txInteger character) |
1138 | 270M | { |
1139 | 270M | txSize length; |
1140 | 270M | if (character < 0) |
1141 | 2.98k | length = 0; |
1142 | 270M | else if (character == 0) |
1143 | 12.4M | length = 2; |
1144 | 258M | else if (character < 0x80) |
1145 | 189M | length = 1; |
1146 | 69.4M | else if (character < 0x800) |
1147 | 1.26M | length = 2; |
1148 | 68.1M | else if (character < 0x10000) |
1149 | 68.0M | length = 3; |
1150 | 127k | else if (character < 0x110000) |
1151 | 126k | length = 6; |
1152 | 473 | else |
1153 | 473 | length = 0; |
1154 | 270M | return length; |
1155 | 270M | } |
1156 | | #endif |
1157 | | |
1158 | | txSize fxUTF8ToUnicodeOffset(txString theString, txSize theOffset) |
1159 | 36.0k | { |
1160 | 36.0k | txU1* p = (txU1*)theString; |
1161 | 36.0k | txU1 c; |
1162 | 36.0k | txSize unicodeOffset = 0; |
1163 | 36.0k | txSize utf8Offset = 0; |
1164 | | |
1165 | 4.97M | while ((c = c_read8(p++))) { |
1166 | 4.97M | if ((c & 0xC0) != 0x80) { |
1167 | 3.33M | if (utf8Offset == theOffset) |
1168 | 30.2k | return unicodeOffset; |
1169 | 3.30M | unicodeOffset++; |
1170 | 3.30M | } |
1171 | 4.94M | utf8Offset++; |
1172 | 4.94M | } |
1173 | 5.76k | if (utf8Offset == theOffset) |
1174 | 15 | return unicodeOffset; |
1175 | 5.75k | else |
1176 | 5.75k | return -1; |
1177 | 5.76k | } |
1178 | | |
1179 | | #if 1 |
1180 | | txSize fxUnicodeLength(txString theString, txSize* byteLength) |
1181 | 9.47M | { |
1182 | 9.47M | txU1* p = (txU1*)theString; |
1183 | 9.47M | txU1 c; |
1184 | 9.47M | txSize unicodeLength = 0; |
1185 | 9.47M | txSize utf8Length = 0; |
1186 | | |
1187 | 2.22G | while ((c = c_read8(p++))) { |
1188 | 2.21G | if ((c & 0xC0) != 0x80) |
1189 | 1.27G | unicodeLength++; |
1190 | 2.21G | utf8Length++; |
1191 | 2.21G | } |
1192 | 9.47M | if (byteLength) |
1193 | 4.16M | *byteLength = utf8Length; |
1194 | 9.47M | return unicodeLength; |
1195 | 9.47M | } |
1196 | | #else |
1197 | | // http://www.daemonology.net/blog/2008-06-05-faster-utf8-strlen.html |
1198 | | |
1199 | | #define ONEMASK ((size_t)(-1) / 0xFF) |
1200 | | |
1201 | | #if defined(__has_feature) |
1202 | | #if __has_feature(address_sanitizer) |
1203 | | __attribute__((no_sanitize("address"))) |
1204 | | #endif |
1205 | | #endif |
1206 | | txSize fxUnicodeLength(txString _s, txSize* byteLength) |
1207 | | { |
1208 | | const char * s; |
1209 | | size_t count = 0; |
1210 | | size_t u; |
1211 | | unsigned char b; |
1212 | | |
1213 | | /* Handle any initial misaligned bytes. */ |
1214 | | for (s = _s; (uintptr_t)(s) & (sizeof(size_t) - 1); s++) { |
1215 | | b = c_read8(s); |
1216 | | |
1217 | | /* Exit if we hit a zero byte. */ |
1218 | | if (b == '\0') |
1219 | | goto done; |
1220 | | |
1221 | | /* Is this byte NOT the first byte of a character? */ |
1222 | | count += (b >> 7) & ((~b) >> 6); |
1223 | | } |
1224 | | |
1225 | | /* Handle complete blocks. */ |
1226 | | for (; ; s += sizeof(size_t)) { |
1227 | | /* Grab 4 or 8 bytes of UTF-8 data. */ |
1228 | | u = *(size_t *)(s); |
1229 | | |
1230 | | /* Exit the loop if there are any zero bytes. */ |
1231 | | if ((u - ONEMASK) & (~u) & (ONEMASK * 0x80)) |
1232 | | break; |
1233 | | |
1234 | | /* Count bytes which are NOT the first byte of a character. */ |
1235 | | u = ((u & (ONEMASK * 0x80)) >> 7) & ((~u) >> 6); |
1236 | | count += (u * ONEMASK) >> ((sizeof(size_t) - 1) * 8); |
1237 | | } |
1238 | | |
1239 | | /* Take care of any left-over bytes. */ |
1240 | | for (; ; s++) { |
1241 | | b = c_read8(s); |
1242 | | |
1243 | | /* Exit if we hit a zero byte. */ |
1244 | | if (b == '\0') |
1245 | | break; |
1246 | | |
1247 | | /* Is this byte NOT the first byte of a character? */ |
1248 | | count += (b >> 7) & ((~b) >> 6); |
1249 | | } |
1250 | | |
1251 | | done: |
1252 | | return (txSize)((s - _s) - count); |
1253 | | } |
1254 | | #endif |
1255 | | |
1256 | | txSize fxUnicodeToUTF8Offset(txString theString, txSize theOffset) |
1257 | 78.8M | { |
1258 | 78.8M | txU1* p = (txU1*)theString; |
1259 | 78.8M | txU1 c; |
1260 | 78.8M | txSize unicodeOffset = 0; |
1261 | 78.8M | txSize utf8Offset = 0; |
1262 | | |
1263 | 267M | while ((c = c_read8(p++))) { |
1264 | 266M | if ((c & 0xC0) != 0x80) { |
1265 | 185M | if (unicodeOffset == theOffset) |
1266 | 77.4M | return utf8Offset; |
1267 | 108M | unicodeOffset++; |
1268 | 108M | } |
1269 | 188M | utf8Offset++; |
1270 | 188M | } |
1271 | 1.44M | if (unicodeOffset == theOffset) |
1272 | 1.35M | return utf8Offset; |
1273 | 87.6k | else |
1274 | 87.6k | return -1; |
1275 | 1.44M | } |
1276 | | |
1277 | | txFlag fxIntegerToIndex(void* the, txInteger theInteger, txIndex* theIndex) |
1278 | 17.4M | { |
1279 | 17.4M | if (0 <= theInteger) { |
1280 | 17.4M | *theIndex = (txIndex)theInteger; |
1281 | 17.4M | return 1; |
1282 | 17.4M | } |
1283 | 7.14k | return 0; |
1284 | 17.4M | } |
1285 | | |
1286 | | txFlag fxNumberToIndex(void* the, txNumber number, txIndex* theIndex) |
1287 | 16.0M | { |
1288 | 16.0M | txIndex integer = (txIndex)number; |
1289 | 16.0M | txNumber check = integer; |
1290 | 16.0M | if ((number == check) && (integer < 4294967295u)) { |
1291 | 13.7M | *theIndex = integer; |
1292 | 13.7M | return 1; |
1293 | 13.7M | } |
1294 | 2.30M | return 0; |
1295 | 16.0M | } |
1296 | | |
1297 | | txFlag fxStringToIndex(void* the, txString theString, txIndex* theIndex) |
1298 | 5.92M | { |
1299 | 5.92M | char buffer[256], c; |
1300 | 5.92M | txNumber number; |
1301 | 5.92M | txIndex integer; |
1302 | 5.92M | txNumber check; |
1303 | | |
1304 | 5.92M | c = c_read8(theString); |
1305 | 5.92M | if (('+' != c) && ('-' != c) && ('.' != c) && !(('0' <= c) && ('9' >= c))) |
1306 | 1.35M | return 0; |
1307 | 4.56M | number = fxStringToNumber(the, theString, 1); |
1308 | 4.56M | integer = (txIndex)number; |
1309 | 4.56M | check = integer; |
1310 | 4.56M | if ((number == check) && (integer < 4294967295u)) { |
1311 | 2.43M | fxNumberToString(the, number, buffer, sizeof(buffer), 0, 0); |
1312 | 2.43M | if (!c_strcmp(theString, buffer)) { |
1313 | 2.39M | *theIndex = integer; |
1314 | 2.39M | return 1; |
1315 | 2.39M | } |
1316 | 2.43M | } |
1317 | 2.17M | return 0; |
1318 | 4.56M | } |
1319 | | |
1320 | | const txString gxIDStrings[XS_ID_COUNT] = { |
1321 | | "@", |
1322 | | "Symbol.asyncIterator", |
1323 | | "Symbol.hasInstance", |
1324 | | "Symbol.isConcatSpreadable", |
1325 | | "Symbol.iterator", |
1326 | | "Symbol.match", |
1327 | | "Symbol.matchAll", |
1328 | | "Symbol.replace", |
1329 | | "Symbol.search", |
1330 | | "Symbol.species", |
1331 | | "Symbol.split", |
1332 | | "Symbol.toPrimitive", |
1333 | | "Symbol.toStringTag", |
1334 | | "Symbol.unscopables", |
1335 | | #if mxExplicitResourceManagement |
1336 | | "Symbol.asyncDispose", |
1337 | | "Symbol.dispose", |
1338 | | #endif |
1339 | | "AggregateError", |
1340 | | "Array", |
1341 | | "ArrayBuffer", |
1342 | | "Atomics", |
1343 | | "BigInt", |
1344 | | "BigInt64Array", |
1345 | | "BigUint64Array", |
1346 | | "Boolean", |
1347 | | "DataView", |
1348 | | "Date", |
1349 | | "Error", |
1350 | | "EvalError", |
1351 | | "FinalizationRegistry", |
1352 | | "Float32Array", |
1353 | | "Float64Array", |
1354 | | "Int16Array", |
1355 | | "Int32Array", |
1356 | | "Int8Array", |
1357 | | "JSON", |
1358 | | "Map", |
1359 | | "Math", |
1360 | | "ModuleSource", |
1361 | | "Number", |
1362 | | "Object", |
1363 | | "Promise", |
1364 | | "Proxy", |
1365 | | "RangeError", |
1366 | | "ReferenceError", |
1367 | | "Reflect", |
1368 | | "RegExp", |
1369 | | "Set", |
1370 | | "SharedArrayBuffer", |
1371 | | "String", |
1372 | | "Symbol", |
1373 | | "SyntaxError", |
1374 | | "TypeError", |
1375 | | "TypedArray", |
1376 | | "URIError", |
1377 | | "Uint16Array", |
1378 | | "Uint32Array", |
1379 | | "Uint8Array", |
1380 | | "Uint8ClampedArray", |
1381 | | "WeakMap", |
1382 | | "WeakRef", |
1383 | | "WeakSet", |
1384 | | "decodeURI", |
1385 | | "decodeURIComponent", |
1386 | | "encodeURI", |
1387 | | "encodeURIComponent", |
1388 | | "escape", |
1389 | | "isFinite", |
1390 | | "isNaN", |
1391 | | "parseFloat", |
1392 | | "parseInt", |
1393 | | "trace", |
1394 | | "unescape", |
1395 | | #if mxECMAScript2025 |
1396 | | "Iterator", |
1397 | | #endif |
1398 | | #if mxExplicitResourceManagement |
1399 | | "AsyncDisposableStack", |
1400 | | "DisposableStack", |
1401 | | "SuppressedError", |
1402 | | #endif |
1403 | | #if mxFloat16 |
1404 | | "Float16Array", |
1405 | | #endif |
1406 | | "Infinity", |
1407 | | "NaN", |
1408 | | "undefined", |
1409 | | "Compartment", |
1410 | | "Function", |
1411 | | #if mxModuleStuff |
1412 | | "ModuleStuff", |
1413 | | #endif |
1414 | | "eval", |
1415 | | "AsyncFunction", |
1416 | | "AsyncGeneratorFunction", |
1417 | | "BYTES_PER_ELEMENT", |
1418 | | "E", |
1419 | | "EPSILON", |
1420 | | "Generator", |
1421 | | "GeneratorFunction", |
1422 | | "LN10", |
1423 | | "LN2", |
1424 | | "LOG10E", |
1425 | | "LOG2E", |
1426 | | "MAX_SAFE_INTEGER", |
1427 | | "MAX_VALUE", |
1428 | | "MIN_SAFE_INTEGER", |
1429 | | "MIN_VALUE", |
1430 | | "NEGATIVE_INFINITY", |
1431 | | "PI", |
1432 | | "POSITIVE_INFINITY", |
1433 | | "SQRT1_2", |
1434 | | "SQRT2", |
1435 | | "UTC", |
1436 | | "__defineGetter__", |
1437 | | "__defineSetter__", |
1438 | | "__lookupGetter__", |
1439 | | "__lookupSetter__", |
1440 | | "__proto__", |
1441 | | "abs", |
1442 | | "acos", |
1443 | | "acosh", |
1444 | | "add", |
1445 | | "aliases", |
1446 | | "all", |
1447 | | "allSettled", |
1448 | | "and", |
1449 | | "any", |
1450 | | "append", |
1451 | | "apply", |
1452 | | "arguments", |
1453 | | "as", |
1454 | | "asIntN", |
1455 | | "asUintN", |
1456 | | "asin", |
1457 | | "asinh", |
1458 | | "assign", |
1459 | | "asyncIterator", |
1460 | | "at", |
1461 | | "atan", |
1462 | | "atanh", |
1463 | | "atan2", |
1464 | | "bind", |
1465 | | "bindings", |
1466 | | "bitLength", |
1467 | | "boundArguments", |
1468 | | "boundFunction", |
1469 | | "boundThis", |
1470 | | "buffer", |
1471 | | "busy", |
1472 | | "byteLength", |
1473 | | "byteOffset", |
1474 | | "cache", |
1475 | | "call", |
1476 | | "callee", |
1477 | | "caller", |
1478 | | "catch", |
1479 | | "cause", |
1480 | | "cbrt", |
1481 | | "ceil", |
1482 | | "center", |
1483 | | "charAt", |
1484 | | "charCodeAt", |
1485 | | "chunk", |
1486 | | "chunkify", |
1487 | | "cleanupSome", |
1488 | | "clear", |
1489 | | "closure", |
1490 | | "clz32", |
1491 | | "codePointAt", |
1492 | | "compare", |
1493 | | "compareExchange", |
1494 | | "compile", |
1495 | | "concat", |
1496 | | "configurable", |
1497 | | "console", |
1498 | | "construct", |
1499 | | "constructor", |
1500 | | "copyWithin", |
1501 | | "cos", |
1502 | | "cosh", |
1503 | | "count", |
1504 | | "create", |
1505 | | "default", |
1506 | | "defineProperties", |
1507 | | "defineProperty", |
1508 | | "delete", |
1509 | | "deleteProperty", |
1510 | | "deref", |
1511 | | "description", |
1512 | | "done", |
1513 | | "dotAll", |
1514 | | "eachDown", |
1515 | | "eachUp", |
1516 | | "endsWith", |
1517 | | "entries", |
1518 | | "enumerable", |
1519 | | "enumerate", |
1520 | | "errors", |
1521 | | "evaluate", |
1522 | | "every", |
1523 | | "exchange", |
1524 | | "exec", |
1525 | | "exp", |
1526 | | "expm1", |
1527 | | "export", |
1528 | | "exports", |
1529 | | "fill", |
1530 | | "filter", |
1531 | | "finally", |
1532 | | "find", |
1533 | | "findIndex", |
1534 | | "findLast", |
1535 | | "findLastIndex", |
1536 | | "flags", |
1537 | | "flat", |
1538 | | "flatMap", |
1539 | | "floor", |
1540 | | "for", |
1541 | | "forEach", |
1542 | | "free", |
1543 | | "freeze", |
1544 | | "from", |
1545 | | "fromArrayBuffer", |
1546 | | "fromBigInt", |
1547 | | "fromCharCode", |
1548 | | "fromCodePoint", |
1549 | | "fromEntries", |
1550 | | "fromString", |
1551 | | "fround", |
1552 | | "function", |
1553 | | "get", |
1554 | | "getBigInt64", |
1555 | | "getBigUint64", |
1556 | | "getDate", |
1557 | | "getDay", |
1558 | | "getFloat32", |
1559 | | "getFloat64", |
1560 | | "getFullYear", |
1561 | | "getHours", |
1562 | | "getInt16", |
1563 | | "getInt32", |
1564 | | "getInt8", |
1565 | | "getMilliseconds", |
1566 | | "getMinutes", |
1567 | | "getMonth", |
1568 | | "getOwnPropertyDescriptor", |
1569 | | "getOwnPropertyDescriptors", |
1570 | | "getOwnPropertyNames", |
1571 | | "getOwnPropertySymbols", |
1572 | | "getPrototypeOf", |
1573 | | "getSeconds", |
1574 | | "getTime", |
1575 | | "getTimezoneOffset", |
1576 | | "getUTCDate", |
1577 | | "getUTCDay", |
1578 | | "getUTCFullYear", |
1579 | | "getUTCHours", |
1580 | | "getUTCMilliseconds", |
1581 | | "getUTCMinutes", |
1582 | | "getUTCMonth", |
1583 | | "getUTCSeconds", |
1584 | | "getUint16", |
1585 | | "getUint32", |
1586 | | "getUint8", |
1587 | | "getYear", |
1588 | | "global", |
1589 | | "globalThis", |
1590 | | "groups", |
1591 | | "grow", |
1592 | | "growable", |
1593 | | "has", |
1594 | | "hasIndices", |
1595 | | "hasInstance", |
1596 | | "hasOwn", |
1597 | | "hasOwnProperty", |
1598 | | "hypot", |
1599 | | "id", |
1600 | | "idiv", |
1601 | | "idivmod", |
1602 | | "ignoreCase", |
1603 | | "imod", |
1604 | | "import", |
1605 | | "importNow", |
1606 | | "imports", |
1607 | | "imul", |
1608 | | "imuldiv", |
1609 | | "includes", |
1610 | | "index", |
1611 | | "indexOf", |
1612 | | "indices", |
1613 | | "input", |
1614 | | "irem", |
1615 | | "is", |
1616 | | "isArray", |
1617 | | "isConcatSpreadable", |
1618 | | "isExtensible", |
1619 | | "isFrozen", |
1620 | | "isInteger", |
1621 | | "isLockFree", |
1622 | | "isPrototypeOf", |
1623 | | "isSafeInteger", |
1624 | | "isSealed", |
1625 | | "isView", |
1626 | | "iterable", |
1627 | | "iterator", |
1628 | | "join", |
1629 | | "keyFor", |
1630 | | "keys", |
1631 | | "lastIndex", |
1632 | | "lastIndexOf", |
1633 | | "left", |
1634 | | "length", |
1635 | | "line", |
1636 | | "load", |
1637 | | "local", |
1638 | | "localeCompare", |
1639 | | "log", |
1640 | | "log1p", |
1641 | | "log10", |
1642 | | "log2", |
1643 | | "map", |
1644 | | "match", |
1645 | | "matchAll", |
1646 | | "max", |
1647 | | "maxByteLength", |
1648 | | "message", |
1649 | | "min", |
1650 | | "mod", |
1651 | | "module", |
1652 | | "multiline", |
1653 | | "name", |
1654 | | "needsImport", |
1655 | | "needsImportMeta", |
1656 | | "new.target", |
1657 | | "next", |
1658 | | "normalize", |
1659 | | "notify", |
1660 | | "now", |
1661 | | "of", |
1662 | | "or", |
1663 | | "ownKeys", |
1664 | | "padEnd", |
1665 | | "padStart", |
1666 | | "parse", |
1667 | | "path", |
1668 | | "peek", |
1669 | | "poke", |
1670 | | "pop", |
1671 | | "pow", |
1672 | | "preventExtensions", |
1673 | | "propertyIsEnumerable", |
1674 | | "prototype", |
1675 | | "proxy", |
1676 | | "push", |
1677 | | "race", |
1678 | | "random", |
1679 | | "raw", |
1680 | | "reason", |
1681 | | "reduce", |
1682 | | "reduceRight", |
1683 | | "reexports", |
1684 | | "register", |
1685 | | "reject", |
1686 | | "repeat", |
1687 | | "replace", |
1688 | | "replaceAll", |
1689 | | "resizable", |
1690 | | "resize", |
1691 | | "resolve", |
1692 | | "result", |
1693 | | "return", |
1694 | | "reverse", |
1695 | | "revocable", |
1696 | | "revoke", |
1697 | | "right", |
1698 | | "round", |
1699 | | "seal", |
1700 | | "search", |
1701 | | "set", |
1702 | | "setBigInt64", |
1703 | | "setBigUint64", |
1704 | | "setDate", |
1705 | | "setFloat32", |
1706 | | "setFloat64", |
1707 | | "setFullYear", |
1708 | | "setHours", |
1709 | | "setInt16", |
1710 | | "setInt32", |
1711 | | "setInt8", |
1712 | | "setMilliseconds", |
1713 | | "setMinutes", |
1714 | | "setMonth", |
1715 | | "setPrototypeOf", |
1716 | | "setSeconds", |
1717 | | "setTime", |
1718 | | "setUTCDate", |
1719 | | "setUTCFullYear", |
1720 | | "setUTCHours", |
1721 | | "setUTCMilliseconds", |
1722 | | "setUTCMinutes", |
1723 | | "setUTCMonth", |
1724 | | "setUTCSeconds", |
1725 | | "setUint16", |
1726 | | "setUint32", |
1727 | | "setUint8", |
1728 | | "setYear", |
1729 | | "shift", |
1730 | | "sign", |
1731 | | "sin", |
1732 | | "sinh", |
1733 | | "size", |
1734 | | "slice", |
1735 | | "some", |
1736 | | "sort", |
1737 | | "source", |
1738 | | "species", |
1739 | | "splice", |
1740 | | "split", |
1741 | | "sqrt", |
1742 | | "stack", |
1743 | | "startsWith", |
1744 | | "status", |
1745 | | "sticky", |
1746 | | "store", |
1747 | | "stringify", |
1748 | | "sub", |
1749 | | "subarray", |
1750 | | "substr", |
1751 | | "substring", |
1752 | | "tan", |
1753 | | "tanh", |
1754 | | "test", |
1755 | | "then", |
1756 | | "this", |
1757 | | "throw", |
1758 | | "toDateString", |
1759 | | "toExponential", |
1760 | | "toFixed", |
1761 | | "toGMTString", |
1762 | | "toISOString", |
1763 | | "toJSON", |
1764 | | "toLocaleDateString", |
1765 | | "toLocaleLowerCase", |
1766 | | "toLocaleString", |
1767 | | "toLocaleTimeString", |
1768 | | "toLocaleUpperCase", |
1769 | | "toLowerCase", |
1770 | | "toPrecision", |
1771 | | "toPrimitive", |
1772 | | "toString", |
1773 | | "toStringTag", |
1774 | | "toTimeString", |
1775 | | "toUTCString", |
1776 | | "toUpperCase", |
1777 | | "transfer", |
1778 | | "transfers", |
1779 | | "trim", |
1780 | | "trimEnd", |
1781 | | "trimLeft", |
1782 | | "trimRight", |
1783 | | "trimStart", |
1784 | | "trunc", |
1785 | | "unicode", |
1786 | | "unregister", |
1787 | | "unscopables", |
1788 | | "unshift", |
1789 | | "uri", |
1790 | | "value", |
1791 | | "valueOf", |
1792 | | "values", |
1793 | | "wait", |
1794 | | "wake", |
1795 | | "weak", |
1796 | | "writable", |
1797 | | "xor", |
1798 | | "", |
1799 | | "<xsbug:script>", |
1800 | | #if mxECMAScript2023 |
1801 | | "detached", |
1802 | | "irandom", |
1803 | | "toReversed", |
1804 | | "toSorted", |
1805 | | "toSpliced", |
1806 | | "with", |
1807 | | #endif |
1808 | | #if mxExplicitResourceManagement |
1809 | | "adopt", |
1810 | | "asyncDispose", |
1811 | | "defer", |
1812 | | "dispose", |
1813 | | "disposeAsync", |
1814 | | "disposed", |
1815 | | "error", |
1816 | | "move", |
1817 | | "suppressed", |
1818 | | "use", |
1819 | | #endif |
1820 | | "(onFullfilled)", |
1821 | | "(onRejected)", |
1822 | | "(result)", |
1823 | | #if mxECMAScript2024 |
1824 | | "async", |
1825 | | "groupBy", |
1826 | | "isWellFormed", |
1827 | | "promise", |
1828 | | "toWellFormed", |
1829 | | "transferToFixedLength", |
1830 | | "unicodeSets", |
1831 | | "waitAsync", |
1832 | | "withResolvers", |
1833 | | #endif |
1834 | | #if mxUint8ArrayBase64 |
1835 | | "alphabet", |
1836 | | "fromBase64", |
1837 | | "fromHex", |
1838 | | "lastChunkHandling", |
1839 | | "omitPadding", |
1840 | | "read", |
1841 | | "setFromBase64", |
1842 | | "setFromHex", |
1843 | | "toBase64", |
1844 | | "toHex", |
1845 | | "written", |
1846 | | #endif |
1847 | | #if mxECMAScript2025 |
1848 | | "difference", |
1849 | | "drop", |
1850 | | "intersection", |
1851 | | "isDisjointFrom", |
1852 | | "isSubsetOf", |
1853 | | "isSupersetOf", |
1854 | | "options", |
1855 | | "symmetricDifference", |
1856 | | "take", |
1857 | | "toArray", |
1858 | | "try", |
1859 | | "type", |
1860 | | "union", |
1861 | | #endif |
1862 | | #if mxFloat16 |
1863 | | "f16round", |
1864 | | "getFloat16", |
1865 | | "setFloat16", |
1866 | | #endif |
1867 | | #if mxImmutableArrayBuffers |
1868 | | "immutable", |
1869 | | "transferToImmutable", |
1870 | | #endif |
1871 | | #if mxErrorIsError |
1872 | | "isError", |
1873 | | #endif |
1874 | | }; |