Skip to content

Commit b656f88

Browse files
committed
parser: fix 'end' terminates statement.
1 parent 795734d commit b656f88

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

example_env.lua

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ elseif z then
2828
for i = 1,(function() return i end) do i() end -- lambda control
2929
-- repeat until
3030
repeat local z = 1 until z == w
31+
do local z repeat until z end z()
32+
do repeat repeat local z until z until z end z()
3133
-- while loop
3234
do do local z while z do local zz zz() end z(zz) end z() end
3335
-- function
@@ -89,6 +91,8 @@ elseif _ENV.z then
8991
for i = 1,(function() return _ENV.i end) do i() end -- lambda control
9092
-- repeat until
9193
repeat local z = 1 until z == _ENV.w
94+
do local z repeat until z end _ENV.z()
95+
do repeat repeat local z until z until _ENV.z end _ENV.z()
9296
-- while loop
9397
do do local z while z do local zz zz() end z(_ENV.zz) end _ENV.z() end
9498
-- function

lua_parser_loose.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function PARSE.parse_scope(lx, f)
7878
if c.tag == 'Keyword' and (
7979
c[1] == 'break' or c[1] == 'goto' or c[1] == 'do' or c[1] == 'while' or
8080
c[1] == 'repeat' or c[1] == 'if' or c[1] == 'for' or c[1] == 'function' and lx:peek().tag == 'Id' or
81-
c[1] == 'local' or c[1] == ';' or c[1] == 'until' or c[1] == 'return') or
81+
c[1] == 'local' or c[1] == ';' or c[1] == 'until' or c[1] == 'return' or c[1] == 'end') or
8282
c.tag == 'Id' and
8383
(cprev.tag == 'Id' or
8484
cprev.tag == 'Keyword' and

0 commit comments

Comments
 (0)