aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-02-14 15:35:54 +0800
committerLi Jin <dragon-fly@qq.com>2022-02-14 15:35:54 +0800
commitddb0b9deb720368a425d00bce0c0352469b55911 (patch)
tree8924f0a6e4d851c2f8545efba2d42c43581fd090 /spec
parent2c2cad4b4d3680bb30474b38ebed0f938e82636e (diff)
downloadyuescript-ddb0b9deb720368a425d00bce0c0352469b55911.tar.gz
yuescript-ddb0b9deb720368a425d00bce0c0352469b55911.tar.bz2
yuescript-ddb0b9deb720368a425d00bce0c0352469b55911.zip
fixing issue #77. change table appending syntax to: tb[] = 1
Diffstat (limited to 'spec')
-rw-r--r--spec/inputs/syntax.yue17
-rw-r--r--spec/outputs/syntax.lua34
2 files changed, 37 insertions, 14 deletions
diff --git a/spec/inputs/syntax.yue b/spec/inputs/syntax.yue
index 67d3a27..e7f0a8d 100644
--- a/spec/inputs/syntax.yue
+++ b/spec/inputs/syntax.yue
@@ -188,16 +188,25 @@ a.b[1].c[2 + 3] += 1
188with tb 188with tb
189 .a.c += 1 189 .a.c += 1
190 190
191tb #= 10 191tb[] = 10
192a.b.c #= 1 192a.b.c[] = 1
193x #= if v 193x[] = if v
194 1 194 1
195else 195else
196 2 196 2
197with tb 197with tb
198 .b.c #= with vec 198 .b.c[] = with vec
199 .x = 1 199 .x = 1
200 .y = 2 200 .y = 2
201a
202 .b.c
203 .d\f!
204 .g[] = 1
205
206tb = {}
207tb[] = 1
208tb[] = 2
209tb[] = 3
201 210
202x = 0 211x = 0
203_ = (if ntype(v) == "fndef" then x += 1) for v in *values 212_ = (if ntype(v) == "fndef" then x += 1) for v in *values
diff --git a/spec/outputs/syntax.lua b/spec/outputs/syntax.lua
index 457f1e1..701361e 100644
--- a/spec/outputs/syntax.lua
+++ b/spec/outputs/syntax.lua
@@ -195,10 +195,14 @@ do
195 local _obj_2 = _with_0.a 195 local _obj_2 = _with_0.a
196 _obj_2.c = _obj_2.c + 1 196 _obj_2.c = _obj_2.c + 1
197end 197end
198local _obj_2 = tb 198do
199_obj_2[#_obj_2 + 1] = 10 199 local _obj_2 = tb
200local _obj_3 = a.b.c 200 _obj_2[#_obj_2 + 1] = 10
201_obj_3[#_obj_3 + 1] = 1 201end
202do
203 local _obj_2 = a.b.c
204 _obj_2[#_obj_2 + 1] = 1
205end
202if v then 206if v then
203 x[#x + 1] = 1 207 x[#x + 1] = 1
204else 208else
@@ -206,14 +210,24 @@ else
206end 210end
207do 211do
208 local _with_0 = tb 212 local _with_0 = tb
209 local _obj_4 = _with_0.b.c
210 do 213 do
211 local _with_1 = vec 214 local _obj_2 = _with_0.b.c
212 _with_1.x = 1 215 do
213 _with_1.y = 2 216 local _with_1 = vec
214 _obj_4[#_obj_4 + 1] = _with_1 217 _with_1.x = 1
218 _with_1.y = 2
219 _obj_2[#_obj_2 + 1] = _with_1
220 end
215 end 221 end
216end 222end
223do
224 local _obj_2 = a.b.c.d:f().g
225 _obj_2[#_obj_2 + 1] = 1
226end
227local tb = { }
228tb[#tb + 1] = 1
229tb[#tb + 1] = 2
230tb[#tb + 1] = 3
217x = 0 231x = 0
218local _list_0 = values 232local _list_0 = values
219for _index_0 = 1, #_list_0 do 233for _index_0 = 1, #_list_0 do
@@ -231,7 +245,7 @@ hello = {
231 ["function"] = "okay", 245 ["function"] = "okay",
232 good = 230203 246 good = 230203
233} 247}
234local tb = { 248tb = {
235 ["do"] = b, 249 ["do"] = b,
236 (function() 250 (function()
237 return { 251 return {