aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/unicode/syntax.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/syntax.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/syntax.lua')
-rw-r--r--spec/outputs/unicode/syntax.lua431
1 files changed, 431 insertions, 0 deletions
diff --git a/spec/outputs/unicode/syntax.lua b/spec/outputs/unicode/syntax.lua
new file mode 100644
index 0000000..664fa46
--- /dev/null
+++ b/spec/outputs/unicode/syntax.lua
@@ -0,0 +1,431 @@
1local _u53d8_u91cfa = 1 + 2 * 3 / 6
2local _u4e00_u5806, _u53bb, _u8fd9_u91cc
3_u53d8_u91cfa, _u4e00_u5806, _u53bb, _u8fd9_u91cc = _u53e6_u5916, _u4e16_u754c, nil, nil
4_u51fd_u6570(_u53c2_u65701, _u53c2_u65702, _u53e6_u5916, _u53c2_u65703)
5local _u6211_u4eec
6_u8fd9_u91cc, _u6211_u4eec = function() end, _u662f_u7684
7local _u8fd9_u4e2a, _u4e0d_u540c
8_u8fd9_u4e2a, _u4e0d_u540c = function()
9 return _u65b9_u6cd5
10end, _u662f_u7684
11_u7238_u7238()
12_u7238_u7238(_u4e3b)
13_u4f60_u597d(_u4e00, _u4e8c)();
14(5 + 5)(_u4e16_u754c)
15_u4e50_u8da3(_u53d8_u91cfa)(_u53d8_u91cfb)
16_u4e50_u8da3(_u53d8_u91cfa)(_u53d8_u91cfb)
17_u4e50_u8da3(_u53d8_u91cfa)(_u53d8_u91cfb, _u574f(_u4f60_u597d))
18_u4f60_u597d(_u4e16_u754c(_u4f60_u5728_u8fd9_u91cc_u505a_u4ec0_u4e48))
19_u4ec0_u4e48(_u8fd9_u4e2a)[3243](_u4e16_u754c, _u54ce_u5440)
20_u6bdb_u8338_u8338[_u624b][_u662f](_u6076_u5fc3)(_u597d_u7684(_u597d_u7684[_u4e16_u754c]))
21local _ = (_u5f97_u5230[_u67d0_u4e8b] + 5)[_u5e74]
22local _u53d8_u91cfi, _u53d8_u91cfx = 200, 300
23local _u662f_u7684 = (1 + 5) * 3
24_u662f_u7684 = ((1 + 5) * 3) / 2
25_u662f_u7684 = ((1 + 5) * 3) / 2 + _u53d8_u91cfi % 100
26local _u54c7 = (1 + 2) * (3 + 4) * (4 + 5)
27_ = function()
28 if _u67d0_u4e8b then
29 return 1, 2, 4
30 end
31 return _u6253_u5370("你好")
32end
33_ = function()
34 if _u4f60_u597d then
35 return "你好", "世界"
36 else
37 return _u4e0d, _u65b9_u6cd5
38 end
39end
40_ = function()
41 return 1, 2, 34
42end
43return 5 + function()
44 return 4 + 2
45end
46return 5 + (function()
47 return 4
48end) + 2
49_u6253_u5370(5 + function()
50 _ = 34
51 return _u597d(_u7403)
52end)
53_u67d0_u4e8b('其他', "是")
54_u67d0_u4e8b('其他')
55_u67d0_u4e8b("其他")
56_ = _u67d0_u4e8b([[嘿]]) * 2
57_ = _u67d0_u4e8b([======[嘿]======]) * 2
58_ = _u67d0_u4e8b[ [======[嘿]======]] * 2
59_, _ = _u67d0_u4e8b('其他'), 2
60_, _ = _u67d0_u4e8b("其他"), 2
61_, _ = _u67d0_u4e8b([[其他]]), 2
62_, _ = _u67d0_u4e8b[ [[其他]]], 2
63_u67d0_u4e8b('其他', 2)
64_u67d0_u4e8b("其他", 2)
65_u67d0_u4e8b([[其他]], 2)
66_ = _u8fd9_u91cc(_u6211_u4eec)("去")[12123]
67local _call_0 = _u5206_u88c2("abc xyz 123")
68local _call_1 = _call_0["映射"](_call_0, "#")
69_call_1["打印全部"](_call_1)
70_ = f("")[_u53d8_u91cfa]
71local _call_2 = f("")
72_ = _call_2["变量b"](_call_2)
73_ = f("")["变量c"]()
74f(("")[_u53d8_u91cfa])
75f((function()
76 local _call_3 = ("")
77 return _call_3["变量b"](_call_3)
78end)())
79f(("")["变量c"]())
80local _call_3 = _u5217_u8868({
81 "abc",
82 "xyz",
83 "123"
84})
85local _call_4 = _call_3["映射"](_call_3, "#")
86_call_4["打印全部"](_call_4)
87_ = f({ })[_u53d8_u91cfa]
88local _call_5 = f({ })
89_ = _call_5["变量b"](_call_5)
90_ = f({ })["变量c"]()
91local _u67d0_u4e8b = {
92 ["测试"] = 12323,
93 ["什么"] = function()
94 return _u6253_u5370("你好 世界")
95 end
96}
97_u6253_u5370(_u67d0_u4e8b["测试"])
98local _u5929_u54ea = {
99 ["你好"] = "世界"
100}
101local _u6c29 = {
102 ["数字"] = 100,
103 ["世界"] = function(_u81ea_u5df1)
104 _u6253_u5370(_u81ea_u5df1["数字"])
105 return {
106 ["某事"] = function()
107 return _u6253_u5370("嗨 从某事")
108 end
109 }
110 end,
111 ["某事"] = function(_u81ea_u5df1, _u5b57_u7b26_u4e32)
112 _u6253_u5370("字符串是", _u5b57_u7b26_u4e32)
113 return {
114 ["世界"] = function(_u53d8_u91cfa, _u53d8_u91cfb)
115 return _u6253_u5370("总和", _u53d8_u91cfa + _u53d8_u91cfb)
116 end
117 }
118 end
119}
120_u67d0_u4e8b["什么"]()
121_u6c29["世界"](_u6c29)["某事"]()
122_u6c29["某事"](_u6c29, "200")["世界"](1, 2)
123_u53d8_u91cfx = -434
124_u53d8_u91cfx = -_u4f60_u597d(_u4e16_u754c(_u4e00(_u4e8c)))
125local _u55e8 = -"herfef"
126_u53d8_u91cfx = -(function()
127 local _accum_0 = { }
128 local _len_0 = 1
129 for _u53d8_u91cfx in _u53d8_u91cfx do
130 _accum_0[_len_0] = _u53d8_u91cfx
131 _len_0 = _len_0 + 1
132 end
133 return _accum_0
134end)()
135if _u9177 then
136 _u6253_u5370("你好")
137end
138if not _u9177 then
139 _u6253_u5370("你好")
140end
141if not (1212 and 3434) then
142 _u6253_u5370("你好")
143end
144for i = 1, 10 do
145 _u6253_u5370("你好")
146end
147_u6253_u5370("疯子")
148if _u4f60_u597d then
149 _ = 343
150end
151if _u9177 then
152 _u6253_u5370("什么")
153end
154while not (function()
155 local _call_6 = _u9605_u8bfb_u8005
156 return _call_6["结束"](_call_6)
157 end)() do
158 local _call_6 = _u9605_u8bfb_u8005
159 _call_6["解析_行"](_call_6)
160end
161while not (function()
162 local _call_6 = _u9605_u8bfb_u8005
163 return _call_6["结束"](_call_6)
164 end)() do
165 local _call_6 = _u9605_u8bfb_u8005
166 _call_6["解析_行"](_call_6)
167end
168(function(...)
169 local _u53c2_u6570 = {
170 ...
171 }
172end)()
173_u53d8_u91cfx = function(...)
174 return dump({
175 ...
176 })
177end
178_u53d8_u91cfx = not true
179local _u53d8_u91cfy = not (5 + 5)
180_u53d8_u91cfy = #"你好"
181_u53d8_u91cfx = #{
182 #{ },
183 #{
184 1
185 },
186 #{
187 1,
188 2
189 }
190}
191_, _ = _u4f60_u597d, _u4e16_u754c
192_u67d0_u4e8b["你好"](_u67d0_u4e8b, _u4ec0_u4e48)(_u53d8_u91cfa, _u53d8_u91cfb)
193_u67d0_u4e8b["你好"](_u67d0_u4e8b, _u4ec0_u4e48)
194local _call_6 = _u67d0_u4e8b["你好"]
195_call_6["世界"](_call_6, _u53d8_u91cfa, _u53d8_u91cfb)
196local _call_7 = _u67d0_u4e8b["你好"]
197_call_7["世界"](_call_7, 1, 2, 3)(_u53d8_u91cfa, _u53d8_u91cfb)
198_u53d8_u91cfx = 1232
199_u53d8_u91cfx = _u53d8_u91cfx + (10 + 3)
200local _u53d8_u91cfj = _u53d8_u91cfj - "你好"
201_u53d8_u91cfy = _u53d8_u91cfy * 2
202_u53d8_u91cfy = _u53d8_u91cfy / 100
203_u53d8_u91cfy = _u53d8_u91cfy // 100
204local _u53d8_u91cfm = _u53d8_u91cfm % 2
205local _u4f60_u597d = _u4f60_u597d .. "世界"
206self.__class["某事"] = self.__class["某事"] + 10
207self["某事"] = self["某事"] + 10
208local _update_0 = "你好"
209_u53d8_u91cfa[_update_0] = _u53d8_u91cfa[_update_0] + 10
210local _update_1 = "你好" .. tostring(tostring(ff))
211_u53d8_u91cfa[_update_1] = _u53d8_u91cfa[_update_1] + 10
212local _obj_0 = _u53d8_u91cfa[_u56db]
213_obj_0["字段x"] = _obj_0["字段x"] + 10
214_u53d8_u91cfa["变量b"] = _u53d8_u91cfa["变量b"] + 1
215local _obj_1 = _u53d8_u91cfa["变量b"][1]["变量c"]
216local _update_2 = 2 + 3
217_obj_1[_update_2] = _obj_1[_update_2] + 1
218do
219 local _with_0 = _u8868
220 local _obj_2 = _with_0["字段a"]
221 _obj_2["变量c"] = _obj_2["变量c"] + 1
222end
223do
224 local _obj_2 = _u8868
225 _obj_2[#_obj_2 + 1] = 10
226end
227do
228 local _obj_2 = _u53d8_u91cfa["变量b"]["变量c"]
229 _obj_2[#_obj_2 + 1] = 1
230end
231if _u6761_u4ef6v then
232 _u53d8_u91cfx[#_u53d8_u91cfx + 1] = 1
233else
234 _u53d8_u91cfx[#_u53d8_u91cfx + 1] = 2
235end
236do
237 local _with_0 = _u8868
238 do
239 local _obj_2 = _with_0["变量b"]["变量c"]
240 do
241 local _with_1 = _u5411_u91cf
242 _with_1["字段x"] = 1
243 _with_1["字段y"] = 2
244 _obj_2[#_obj_2 + 1] = _with_1
245 end
246 end
247end
248do
249 local _call_8 = _u5bf9_u8c61a["变量b"]["变量c"]["变量d"]
250 local _obj_2 = _call_8["函数"](_call_8)["变量g"]
251 _obj_2[#_obj_2 + 1] = 1
252end
253local _u8868 = { }
254_u8868[#_u8868 + 1] = 1
255_u8868[#_u8868 + 1] = 2
256_u8868[#_u8868 + 1] = 3
257_u53d8_u91cfx = 0
258local _list_0 = _u503c
259for _index_0 = 1, #_list_0 do
260 local _u53d8_u91cfv = _list_0[_index_0]
261 if ntype(_u53d8_u91cfv) == "函数定义" then
262 _ = _u53d8_u91cfx + 1
263 end
264end
265_u4f60_u597d = {
266 ["某物"] = _u4e16_u754c,
267 ["如果"] = "你好",
268 ["否则"] = 3434,
269 ["函数"] = "好的",
270 ["好的"] = 230203
271}
272_u8868 = {
273 ["执行"] = _u53d8_u91cfb,
274 _u6267_u884c({
275 ["变量b"] = _u53d8_u91cfb
276 })
277}
278div({
279 ["类"] = "酷"
280})
281_ = 5 + _u4ec0_u4e48(_u65e0_u804a)
282_u4ec0_u4e48(_u65e0_u804a + 5)
283_ = 5 - _u4ec0_u4e48(_u65e0_u804a)
284_u4ec0_u4e48(_u65e0_u804a - 5)
285_u53d8_u91cfx = _u4f60_u597d - _u4e16_u754c - _u67d0_u7269;
286(function(_u67d0_u7269)
287 if _u67d0_u7269 == nil then
288 _u67d0_u7269 = _u4e0e((function()
289 local _call_8 = _u4ec0_u4e48
290 return _call_8["酷"](_call_8, 100)
291 end)())
292 end
293 return _u6253_u5370(_u67d0_u7269)
294end)()
295if _u67d0_u7269 then
296 _ = 03589
297else
298 _ = 3434
299end
300if _u67d0_u7269 then
301 _ = _u662f_u7684
302elseif "嗯嗯嗯" then
303 _u6253_u5370("酷")
304else
305 _ = _u597d_u7684
306end
307_u53d8_u91cfx = _u4e0d_u662f_u67d0_u7269
308_u53d8_u91cfy = _u5982_u679c_u67d0_u7269
309local _u53d8_u91cfz = _u53d8_u91cfx(_u4e0e(_u53d8_u91cfb))
310_u53d8_u91cfz = _u53d8_u91cfx(_u4e0eb)
311while 10 > _u67d0_u7269({
312 ["某物"] = "世界"
313 }) do
314 _u6253_u5370("是的")
315end
316_u53d8_u91cfx = {
317 ["好的"] = _u786e_u5b9a
318}
319_u662f_u7684({
320 ["好的"] = _u7537_u4eba,
321 ["确定"] = _u5148_u751f
322})
323_u4f60_u597d("无逗号", {
324 ["是的"] = _u7238_u7238,
325 ["另一个"] = _u4e16_u754c
326})
327_u4f60_u597d("逗号", {
328 ["某物"] = _u4f60_u597d__u4e16_u754c,
329 ["骂人"] = _u4f60
330})
331_u53e6_u4e00_u4e2a(_u4f60_u597d, _u4e00_u4e2a, _u4e8c, _u4e09, _u56db, {
332 ["是的"] = _u7537_u4eba,
333 ["好的"] = _u662f_u7684,
334 ["好"] = _u597d_u7684
335})
336_u53e6_u4e00_u4e2a(_u4f60_u597d, _u4e00_u4e2a, _u4e8c, _u4e09, _u56db, {
337 ["是的"] = _u7537_u4eba,
338 ["好的"] = _u662f_u7684,
339 {
340 ["好"] = _u597d_u7684,
341 ["好的"] = 1
342 },
343 {
344 ["好"] = _u597d_u7684,
345 ["好的"] = 2
346 }
347})
348_u53e6_u4e00_u4e2a(_u4f60_u597d, _u4e00_u4e2a, _u4e8c, _u4e09, _u56db, {
349 ["是的"] = _u7537_u4eba,
350 ["好的"] = _u662f_u7684
351})
352_u53e6_u4e00_u4e2a(_u4f60_u597d, _u4e00_u4e2a, _u4e8c, _u4e09, _u56db, {
353 ["是的"] = _u7537_u4eba({
354 ["好的"] = _u662f_u7684
355 })
356})
357_u963f_u8d3e_u514b_u65af(_u5730_u5740, function(_u6570_u636e)
358 return _u5904_u7406(_u6570_u636e)
359end, function(_u9519_u8bef)
360 return _u6253_u5370(_u9519_u8bef)
361end)
362_u53d8_u91cfa = _u53d8_u91cfa + (3 - 5)
363_u53d8_u91cfa = _u53d8_u91cfa * (3 + 5)
364_u53d8_u91cfa = _u53d8_u91cfa * 3
365_u53d8_u91cfa = _u53d8_u91cfa >> 3
366_u53d8_u91cfa = _u53d8_u91cfa << 3
367_u53d8_u91cfa = _u53d8_u91cfa / _u51fd_u6570("酷")
368_u53d8_u91cfx["然后"] = "你好"
369_u53d8_u91cfx["当"]["真"] = "你好"
370_u53d8_u91cfx["当"]["真"] = "你好"
371_u53d8_u91cfx = _u53d8_u91cfx or "你好"
372_u53d8_u91cfx = _u53d8_u91cfx and "你好"
373_u53d8_u91cfz = _u53d8_u91cfa - _u53d8_u91cfb
374_u53d8_u91cfz = _u53d8_u91cfa(-_u53d8_u91cfb)
375_u53d8_u91cfz = _u53d8_u91cfa - _u53d8_u91cfb
376_u53d8_u91cfz = _u53d8_u91cfa - _u53d8_u91cfb
377local _u5b57_u7b26_u4e32 = _u5b57_u7b26_u4e32A .. _u5b57_u7b26_u4e32B .. _u5b57_u7b26_u4e32C
378_u51fd_u6570(3000, "192.168.1.1")
379local f
380f = function()
381 return _u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc, _u53d8_u91cfd, _u53d8_u91cfe, _u53d8_u91cff
382end
383f = function()
384 return _u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc, _u53d8_u91cfd, _u53d8_u91cfe, _u53d8_u91cff
385end
386do
387 local _with_0 = _u5bf9_u8c61
388 _u8c03_u7528(_with_0["函数"](_with_0), 123, "abc")
389end
390_u8c03_u7528A(_u8c03_u7528B(_u8c03_u7528C(123)))
391_u8c03_u7528A(_u8c03_u7528B(_u8c03_u7528C(123)))
392local _u53d8_u91cfv = {
393 _u53d8_u91cfa(-1),
394 _u53d8_u91cfa(-1),
395 _u53d8_u91cfa - 1,
396 _u53d8_u91cfa - 1,
397 _u53d8_u91cfa - 1,
398 _u53d8_u91cfa - 1,
399 _u53d8_u91cfa - 1,
400 _u53d8_u91cfa - 1,
401 _u53d8_u91cfa(~1),
402 _u53d8_u91cfa(~1),
403 _u53d8_u91cfa ~ 1,
404 _u53d8_u91cfa ~ 1,
405 _u53d8_u91cfa ~ 1,
406 _u53d8_u91cfa ~ 1,
407 _u53d8_u91cfa ~ 1,
408 _u53d8_u91cfa ~ 1
409}
410do
411 _u53d8_u91cfa = 1 + 2 * 3 / 4
412 local _u53d8_u91cf_1 = f1(-1 + 2 + 3)
413 local _u53d8_u91cf_2 = f1 - 1 + 2 + 3
414 local f2
415 f2 = function(_u53d8_u91cfx)
416 return _u6253_u5370(_u53d8_u91cfx + 1)
417 end
418 _u53d8_u91cfa = f2()
419 f2(-1)
420 _u53d8_u91cfa = f2() - f2(1)
421 local _u53d8_u91cf_3, _u53d8_u91cf_4
422 _u53d8_u91cf_1, _u53d8_u91cf_2, _u53d8_u91cf_3, _u53d8_u91cf_4 = 1, f(2, 3, f(4, 4))
423end
424do
425 f = function(_u53d8_u91cfa, _u53d8_u91cfb)
426 return _u53d8_u91cfa + _u53d8_u91cfb
427 end
428 f(_u53d8_u91cfa, _u53d8_u91cfb)
429 f()
430end
431return nil