diff options
author | Li Jin <dragon-fly@qq.com> | 2022-05-16 01:03:05 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-05-16 01:03:05 +0800 |
commit | c4935826eea8df7a161b2b4ba9262dce66d9d366 (patch) | |
tree | 12f7fe952a777b98244253c5ecd3e0d0a73e8de8 /spec | |
parent | e9926f70a53639c09a5605f71a34ec370395f5a9 (diff) | |
download | yuescript-c4935826eea8df7a161b2b4ba9262dce66d9d366.tar.gz yuescript-c4935826eea8df7a161b2b4ba9262dce66d9d366.tar.bz2 yuescript-c4935826eea8df7a161b2b4ba9262dce66d9d366.zip |
fix issue #102. fix `continue` statement locating issue.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/inputs/loops.yue | 8 | ||||
-rw-r--r-- | spec/outputs/loops.lua | 23 |
2 files changed, 30 insertions, 1 deletions
diff --git a/spec/inputs/loops.yue b/spec/inputs/loops.yue index 3191000..d03e661 100644 --- a/spec/inputs/loops.yue +++ b/spec/inputs/loops.yue | |||
@@ -109,6 +109,14 @@ repeat | |||
109 | print a | 109 | print a |
110 | until a == 10 | 110 | until a == 10 |
111 | 111 | ||
112 | x = 0 | ||
113 | repeat | ||
114 | x += 1 | ||
115 | y = x | ||
116 | continue if x < 5 | ||
117 | print y | ||
118 | until y == 10 | ||
119 | |||
112 | a = 3 | 120 | a = 3 |
113 | until a == 0 | 121 | until a == 0 |
114 | a -= 1 | 122 | a -= 1 |
diff --git a/spec/outputs/loops.lua b/spec/outputs/loops.lua index aa69840..bcd559c 100644 --- a/spec/outputs/loops.lua +++ b/spec/outputs/loops.lua | |||
@@ -187,6 +187,7 @@ for i = 1, 10 do | |||
187 | end | 187 | end |
188 | local a = 1 | 188 | local a = 1 |
189 | repeat | 189 | repeat |
190 | local _cond_0 | ||
190 | local _continue_0 = false | 191 | local _continue_0 = false |
191 | repeat | 192 | repeat |
192 | a = a + 1 | 193 | a = a + 1 |
@@ -198,12 +199,32 @@ repeat | |||
198 | break | 199 | break |
199 | end | 200 | end |
200 | print(a) | 201 | print(a) |
202 | _cond_0 = a == 10 | ||
201 | _continue_0 = true | 203 | _continue_0 = true |
202 | until true | 204 | until true |
203 | if not _continue_0 then | 205 | if not _continue_0 then |
204 | break | 206 | break |
205 | end | 207 | end |
206 | until a == 10 | 208 | until _cond_0 |
209 | x = 0 | ||
210 | repeat | ||
211 | local _cond_0 | ||
212 | local _continue_0 = false | ||
213 | repeat | ||
214 | x = x + 1 | ||
215 | y = x | ||
216 | if x < 5 then | ||
217 | _continue_0 = true | ||
218 | break | ||
219 | end | ||
220 | print(y) | ||
221 | _cond_0 = y == 10 | ||
222 | _continue_0 = true | ||
223 | until true | ||
224 | if not _continue_0 then | ||
225 | break | ||
226 | end | ||
227 | until _cond_0 | ||
207 | a = 3 | 228 | a = 3 |
208 | while not (a == 0) do | 229 | while not (a == 0) do |
209 | a = a - 1 | 230 | a = a - 1 |