aboutsummaryrefslogtreecommitdiff
path: root/spec/inputs/unicode/class.yue
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/inputs/unicode/class.yue
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/inputs/unicode/class.yue')
-rw-r--r--spec/inputs/unicode/class.yue245
1 files changed, 245 insertions, 0 deletions
diff --git a/spec/inputs/unicode/class.yue b/spec/inputs/unicode/class.yue
new file mode 100644
index 0000000..70bbb07
--- /dev/null
+++ b/spec/inputs/unicode/class.yue
@@ -0,0 +1,245 @@
1
2class 你好
3 new: (@测试, @世界) =>
4 打印 "创建对象.."
5 你好: =>
6 打印 @测试, @世界
7 __tostring: => "你好 世界"
8
9对象x = 你好 1,2
10对象x\你好()
11
12打印 对象x
13
14class 简单
15 酷: => 打印 "酷"
16
17class 伊克斯 extends 简单
18 new: => 打印 "你好已创建"
19
20x对象 = 伊克斯()
21x对象\酷()
22
23
24class 嗨
25 new: (参数) =>
26 打印 "初始化参数", 参数
27
28 酷: (数值) =>
29 打印 "数值", 数值
30
31
32class 简单 extends 嗨
33 new: => super "伙计"
34 酷: => super 120302
35
36x对象 = 简单()
37x对象\酷()
38
39打印 x对象.__class == 简单
40
41
42class 好吧
43 -- what is going on
44 一些东西: 20323
45 -- yeaha
46
47
48class 好哒 extends 好吧
49 一些东西: =>
50 super 1,2,3,4
51 super.一些东西 另一个自己, 1,2,3,4
52 断言 super == 好吧
53
54
55class 好
56 不错: =>
57 super\一些东西 1,2,3,4
58
59
60class 什么
61 一些东西: => 打印 "值:", @值
62
63class 你好 extends 什么
64 值: 2323
65 一些东西: => super\一些东西
66
67with 你好!
68 对象x = \一些对象!
69 打印 对象x
70 对象x!
71
72class 超级酷
73 👋: =>
74 super(1,2,3,4) 1,2,3,4
75 super.一些东西 1,2,3,4
76 _ = super.一些东西(1,2,3,4).世界
77 super\好吧"世界".不错 哈, 哈, 哈
78 _ = 一些东西.上级
79 _ = super.上级.上级.上级
80 _ = super\你好
81 nil
82
83
84-- selfing
85变量x = @你好
86变量x = @@你好
87
88@你好 "世界"
89@@你好 "世界"
90
91@@一 @@二(4,5) @三, @四
92
93变量xx = (@你好, @@世界, 酷) ->
94
95
96-- class properties
97class 一个类
98 @好: 343
99 蓝色: =>
100 @你好: 3434, @世界: 23423
101 绿色: =>
102 @红色: =>
103
104
105变量x = @
106变量y = @@
107
108@ 一些东西
109
110@@ 一些东西
111
112@ = @ + @ / @
113
114@ = 343
115@.你好 2,3,4
116
117_ = 你好[@].世界
118
119
120class 怪怪的
121 _ = @你好
122 if 一些东西
123 打印 "你好世界"
124
125 你好 = "世界"
126 @另一 = "天"
127
128 打印 "好" if 一些东西 -- this is briken
129
130
131打印 "你好"
132
133变量yyy = ->
134 class 酷
135 _ = nil
136
137
138--
139
140class 对象a.字段b.字段c.子类D
141 _ = nil
142
143
144class 对象a.字段b["你好"]
145 _ = nil
146
147class (-> require "moon")!.某个成员 extends 你好.世界
148 _ = nil
149
150--
151
152类a = class
153类b = class 一个类
154类c = class 一个类 extends 你好
155类d = class extends 世界
156
157打印 (class 啥事).__name
158
159--
160
161global ^
162class 一个类
163 _ = nil
164
165
166--
167
168-- hoisting
169class 一个类
170 值 = 23
171 {:插入} = 表
172 new: => 打印 插入, 值 -- prints nil 23
173
174--
175
176class X类
177 new: 嗨
178
179
180--
181
182class 酷 extends 东西
183 当: =>
184 {
185 你好: -> super!
186 世界: -> super.one
187 }
188
189--
190
191class 奇怪 extends 东西
192 当: 做点事 =>
193 super!
194
195---
196
197class 喔哈 extends 东西
198 @底部: ->
199 super!
200 _ = super.你好
201 super\你好!
202 super\你好
203
204
205 @空间: 酷 {
206 ->
207 super!
208 _ = super.你好
209 super\你好!
210 super\你好
211 }
212
213do
214 class 测试
215 new: => @@如果 = true
216 @做: => 1
217 测试: => @@如果 and @@做!
218 测试实例 = 测试!
219 测试实例\测试!
220
221do
222 class 测试
223 new: => @如果 = true
224 做: => 1
225 测试: => @如果 and @做!
226 测试实例 = 测试!
227 测试实例\测试!
228
229class extends 青.应用
230 "/": => json: { 状态: true }
231
232class 类A using 类B, 类C, 类D, {值: 123}
233
234class 示例
235 @字段1 = 1
236 @字段2 = @字段1 + 1
237
238class 随便
239 new: (参数) => @x字段 = 参数
240 <mul>: (参数y) => @x字段 * 参数y
241 <"任意名称">: 123
242 :相加
243 :<add>
244
245nil