aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/unicode/switch.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2023-08-17 10:36:15 +0800
committerLi Jin <dragon-fly@qq.com>2023-08-17 10:36:15 +0800
commite61cce21ef7def2c2e52dd6cb6a5b540ebcac29d (patch)
tree6e7c5e7e6f13157e9f8db26c38f6d8cba75683e5 /spec/outputs/unicode/switch.lua
parent289faf45ac26f7e0ac1a1e4305e5c42fc1e5b866 (diff)
downloadyuescript-e61cce21ef7def2c2e52dd6cb6a5b540ebcac29d.tar.gz
yuescript-e61cce21ef7def2c2e52dd6cb6a5b540ebcac29d.tar.bz2
yuescript-e61cce21ef7def2c2e52dd6cb6a5b540ebcac29d.zip
add unicode identifier support, fix more issue from #144
Diffstat (limited to 'spec/outputs/unicode/switch.lua')
-rw-r--r--spec/outputs/unicode/switch.lua401
1 files changed, 401 insertions, 0 deletions
diff --git a/spec/outputs/unicode/switch.lua b/spec/outputs/unicode/switch.lua
new file mode 100644
index 0000000..6b8bbdc
--- /dev/null
+++ b/spec/outputs/unicode/switch.lua
@@ -0,0 +1,401 @@
1do
2 local _exp_0 = _u503c
3 if "酷" == _exp_0 then
4 _u6253_u5370("你好,世界")
5 end
6end
7do
8 local _exp_0 = _u503c
9 if "酷" == _exp_0 then
10 _u6253_u5370("你好,世界")
11 else
12 _u6253_u5370("好的,很棒")
13 end
14end
15do
16 local _exp_0 = _u503c
17 if "酷" == _exp_0 then
18 _u6253_u5370("你好,世界")
19 elseif "是的" == _exp_0 then
20 local _u53d8_u91cf_ = [[FFFF]] + [[MMMM]]
21 elseif (2323 + 32434) == _exp_0 then
22 _u6253_u5370("好的")
23 else
24 _u6253_u5370("好的,很棒")
25 end
26end
27local _u8f93_u51fa
28do
29 local _exp_0 = _u503c
30 if "酷" == _exp_0 then
31 _u8f93_u51fa = _u6253_u5370("你好,世界")
32 else
33 _u8f93_u51fa = _u6253_u5370("好的,很棒")
34 end
35end
36do
37 local _exp_0 = _u503c
38 if "酷" == _exp_0 then
39 _u8f93_u51fa = _u53d8_u91cfx
40 elseif "哦" == _exp_0 then
41 _u8f93_u51fa = 34340
42 else
43 _u8f93_u51fa = error("这大大地失败了")
44 end
45end
46do
47 local _with_0 = _u4e1c_u897f
48 do
49 local _exp_0 = _with_0["值"](_with_0)
50 if _with_0["确定"] == _exp_0 then
51 local _u53d8_u91cf_ = "世界"
52 else
53 local _u53d8_u91cf_ = "是的"
54 end
55 end
56end
57_u4fee_u590d(_u8fd9_u4e2a)
58call_func((function()
59 local _exp_0 = _u67d0_u7269
60 if 1 == _exp_0 then
61 return "是"
62 else
63 return "否"
64 end
65end)())
66do
67 local _exp_0 = _u55e8
68 if (_u4f60_u597d or _u4e16_u754c) == _exp_0 then
69 local _u53d8_u91cf_ = _u7eff_u8272
70 end
71end
72do
73 local _exp_0 = _u55e8
74 if "一个" == _exp_0 or "两个" == _exp_0 then
75 _u6253_u5370("酷")
76 elseif "爸爸" == _exp_0 then
77 local _u53d8_u91cf_ = _u5426
78 end
79end
80do
81 local _exp_0 = _u55e8
82 if (3 + 1) == _exp_0 or _u4f60_u597d() == _exp_0 or (function()
83 return 4
84 end)() == _exp_0 then
85 local _u53d8_u91cf_ = _u9ec4_u8272
86 else
87 _u6253_u5370("酷")
88 end
89end
90do
91 local _u5b57_u5178 = {
92 { },
93 {
94 1,
95 2,
96 3
97 },
98 ["变量a"] = {
99 ["变量b"] = {
100 ["变量c"] = 1
101 }
102 },
103 ["变量x"] = {
104 ["变量y"] = {
105 ["变量z"] = 1
106 }
107 }
108 }
109 do
110 local _type_0 = type(_u5b57_u5178)
111 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
112 if _tab_0 then
113 local _u7b2c_u4e00 = _u5b57_u5178[1]
114 local _u4e00_u4e2a
115 do
116 local _obj_0 = _u5b57_u5178[2]
117 local _type_1 = type(_obj_0)
118 if "table" == _type_1 or "userdata" == _type_1 then
119 _u4e00_u4e2a = _obj_0[1]
120 end
121 end
122 local _u4e24_u4e2a
123 do
124 local _obj_0 = _u5b57_u5178[2]
125 local _type_1 = type(_obj_0)
126 if "table" == _type_1 or "userdata" == _type_1 then
127 _u4e24_u4e2a = _obj_0[2]
128 end
129 end
130 local _u4e09_u4e2a
131 do
132 local _obj_0 = _u5b57_u5178[2]
133 local _type_1 = type(_obj_0)
134 if "table" == _type_1 or "userdata" == _type_1 then
135 _u4e09_u4e2a = _obj_0[3]
136 end
137 end
138 local _u53d8_u91cfc
139 do
140 local _obj_0 = _u5b57_u5178["变量a"]
141 local _type_1 = type(_obj_0)
142 if "table" == _type_1 or "userdata" == _type_1 then
143 do
144 local _obj_1 = _obj_0["变量b"]
145 local _type_2 = type(_obj_1)
146 if "table" == _type_2 or "userdata" == _type_2 then
147 _u53d8_u91cfc = _obj_1["变量c"]
148 end
149 end
150 end
151 end
152 local _u53d8_u91cfz
153 do
154 local _obj_0 = _u5b57_u5178["变量x"]
155 local _type_1 = type(_obj_0)
156 if "table" == _type_1 or "userdata" == _type_1 then
157 do
158 local _obj_1 = _obj_0["变量y"]
159 local _type_2 = type(_obj_1)
160 if "table" == _type_2 or "userdata" == _type_2 then
161 _u53d8_u91cfz = _obj_1["变量z"]
162 end
163 end
164 end
165 end
166 if _u7b2c_u4e00 ~= nil and _u4e00_u4e2a ~= nil and _u4e24_u4e2a ~= nil and _u4e09_u4e2a ~= nil and _u53d8_u91cfc ~= nil and _u53d8_u91cfz ~= nil then
167 _u6253_u5370(_u7b2c_u4e00, _u4e00_u4e2a, _u4e24_u4e2a, _u4e09_u4e2a, _u53d8_u91cfc, _u53d8_u91cfz)
168 end
169 end
170 end
171end
172do
173 local _u7269_u54c1 = {
174 {
175 ["变量x"] = 100,
176 ["变量y"] = 200
177 },
178 {
179 ["宽度"] = 300,
180 ["高度"] = 400
181 },
182 false
183 }
184 for _index_0 = 1, #_u7269_u54c1 do
185 local _u7269 = _u7269_u54c1[_index_0]
186 do
187 local _type_0 = type(_u7269)
188 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
189 local _match_0 = false
190 if _tab_0 then
191 local _u53d8_u91cfx = _u7269["变量x"]
192 local _u53d8_u91cfy = _u7269["变量y"]
193 if _u53d8_u91cfx ~= nil and _u53d8_u91cfy ~= nil then
194 _match_0 = true
195 _u6253_u5370("Vec2 " .. tostring(_u53d8_u91cfx) .. ", " .. tostring(_u53d8_u91cfy))
196 end
197 end
198 if not _match_0 then
199 local _match_1 = false
200 if _tab_0 then
201 local _u5bbd_u5ea6 = _u7269["宽度"]
202 local _u9ad8_u5ea6 = _u7269["高度"]
203 if _u5bbd_u5ea6 ~= nil and _u9ad8_u5ea6 ~= nil then
204 _match_1 = true
205 _u6253_u5370("Size " .. tostring(_u5bbd_u5ea6) .. ", " .. tostring(_u9ad8_u5ea6))
206 end
207 end
208 if not _match_1 then
209 if false == _u7269 then
210 _u6253_u5370("没有")
211 else
212 local _match_2 = false
213 if _tab_0 then
214 local _u7c7b = _u7269["__类"]
215 if _u7c7b ~= nil then
216 _match_2 = true
217 if _u7c7b_u522bA == _u7c7b then
218 _u6253_u5370("对象 A")
219 elseif _u7c7b_u522bB == _u7c7b then
220 _u6253_u5370("对象 B")
221 end
222 end
223 end
224 if not _match_2 then
225 local _match_3 = false
226 if _tab_0 then
227 local _u8868 = getmetatable(_u7269)
228 if _u8868 ~= nil then
229 _match_3 = true
230 _u6253_u5370("带有元表的表")
231 end
232 end
233 if not _match_3 then
234 _u6253_u5370("物品不被接受!")
235 end
236 end
237 end
238 end
239 end
240 end
241 end
242end
243do
244 local _u8868_u683c = { }
245 do
246 local _type_0 = type(_u8868_u683c)
247 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
248 if _tab_0 then
249 local _u53d8_u91cfa = _u8868_u683c["变量a"]
250 local _u53d8_u91cfb = _u8868_u683c["变量b"]
251 if _u53d8_u91cfa == nil then
252 _u53d8_u91cfa = 1
253 end
254 if _u53d8_u91cfb == nil then
255 _u53d8_u91cfb = 2
256 end
257 _u6253_u5370(_u53d8_u91cfa, _u53d8_u91cfb)
258 end
259 end
260 do
261 local _type_0 = type(_u8868_u683c)
262 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
263 if _tab_0 then
264 local _u53d8_u91cfa = _u8868_u683c["变量a"]
265 local _u53d8_u91cfb = _u8868_u683c["变量b"]
266 if _u53d8_u91cfb == nil then
267 _u53d8_u91cfb = 2
268 end
269 if _u53d8_u91cfa ~= nil then
270 _u6253_u5370("部分匹配", _u53d8_u91cfa, _u53d8_u91cfb)
271 end
272 end
273 end
274 do
275 local _type_0 = type(_u8868_u683c)
276 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
277 local _match_0 = false
278 if _tab_0 then
279 local _u53d8_u91cfa = _u8868_u683c["变量a"]
280 local _u53d8_u91cfb = _u8868_u683c["变量b"]
281 if _u53d8_u91cfa ~= nil and _u53d8_u91cfb ~= nil then
282 _match_0 = true
283 _u6253_u5370(_u53d8_u91cfa, _u53d8_u91cfb)
284 end
285 end
286 if not _match_0 then
287 _u6253_u5370("没有匹配")
288 end
289 end
290end
291do
292 local _u8868_u683c = {
293 ["变量x"] = "abc"
294 }
295 do
296 local _type_0 = type(_u8868_u683c)
297 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
298 local _match_0 = false
299 if _tab_0 then
300 local _u53d8_u91cfx = _u8868_u683c["变量x"]
301 local _u53d8_u91cfy = _u8868_u683c["变量y"]
302 if _u53d8_u91cfx ~= nil and _u53d8_u91cfy ~= nil then
303 _match_0 = true
304 _u6253_u5370("变量x: " .. tostring(_u53d8_u91cfx) .. " 和 变量y: " .. tostring(_u53d8_u91cfy))
305 end
306 end
307 if not _match_0 then
308 if _tab_0 then
309 local _u53d8_u91cfx = _u8868_u683c["变量x"]
310 if _u53d8_u91cfx ~= nil then
311 _u6253_u5370("只有 变量x: " .. tostring(_u53d8_u91cfx))
312 end
313 end
314 end
315 end
316end
317do
318 local _u5339_u914d
319 do
320 local _exp_0 = _u8868_u683c
321 if 1 == _exp_0 then
322 _u5339_u914d = "1"
323 else
324 local _type_0 = type(_exp_0)
325 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
326 local _match_0 = false
327 if _tab_0 then
328 local _u53d8_u91cfx = _exp_0["变量x"]
329 if _u53d8_u91cfx ~= nil then
330 _match_0 = true
331 _u5339_u914d = _u53d8_u91cfx
332 end
333 end
334 if not _match_0 then
335 if false == _exp_0 then
336 _u5339_u914d = "false"
337 else
338 _u5339_u914d = nil
339 end
340 end
341 end
342 end
343end
344do
345 local _exp_0 = _u8868_u683c
346 if nil == _exp_0 then
347 return "无效"
348 else
349 do
350 local _type_0 = type(_exp_0)
351 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
352 local _match_0 = false
353 if _tab_0 then
354 local _u53d8_u91cfa = _exp_0["变量a"]
355 local _u53d8_u91cfb = _exp_0["变量b"]
356 if _u53d8_u91cfa ~= nil and _u53d8_u91cfb ~= nil then
357 _match_0 = true
358 return tostring(_u53d8_u91cfa + _u53d8_u91cfb)
359 end
360 end
361 if not _match_0 then
362 if 1 == _exp_0 or 2 == _exp_0 or 3 == _exp_0 or 4 == _exp_0 or 5 == _exp_0 then
363 return "数字 1 - 5"
364 else
365 local _match_1 = false
366 if _tab_0 then
367 local _u5339_u914d_u4efb_u4f55_u8868_u683c = _exp_0["匹配任何表格"]
368 if _u5339_u914d_u4efb_u4f55_u8868_u683c == nil then
369 _u5339_u914d_u4efb_u4f55_u8868_u683c = "后备"
370 end
371 _match_1 = true
372 return _u5339_u914d_u4efb_u4f55_u8868_u683c
373 end
374 if not _match_1 then
375 return "除非它不是一个表格,否则不应到达这里"
376 end
377 end
378 end
379 end
380 end
381end
382do
383 do
384 local _exp_0 = _u53d8_u91cfy
385 local _type_0 = type(_exp_0)
386 local _tab_0 = "table" == _type_0 or "userdata" == _type_0
387 if _tab_0 then
388 local _u8868 = (function()
389 local _obj_0 = _exp_0["变量x"]
390 if _obj_0 ~= nil then
391 return getmetatable(_obj_0)
392 end
393 return nil
394 end)()
395 if _u8868 ~= nil then
396 _u6253_u5370(_u8868)
397 end
398 end
399 end
400end
401return nil