@@ -200,6 +200,21 @@ local ChunkFinishMap = {
200
200
[' }' ] = true ,
201
201
}
202
202
203
+ local ChunkStartMap = {
204
+ [' do' ] = true ,
205
+ [' else' ] = true ,
206
+ [' elseif' ] = true ,
207
+ [' for' ] = true ,
208
+ [' function' ] = true ,
209
+ [' if' ] = true ,
210
+ [' local' ] = true ,
211
+ [' repeat' ] = true ,
212
+ [' return' ] = true ,
213
+ [' then' ] = true ,
214
+ [' until' ] = true ,
215
+ [' while' ] = true ,
216
+ }
217
+
203
218
local ListFinishMap = {
204
219
[' end' ] = true ,
205
220
[' else' ] = true ,
@@ -1354,14 +1369,17 @@ local function isKeyWord(word)
1354
1369
return false
1355
1370
end
1356
1371
1357
- local function parseName ()
1372
+ local function parseName (asAction )
1358
1373
local word = peekWord ()
1359
1374
if not word then
1360
1375
return nil
1361
1376
end
1362
1377
if ChunkFinishMap [word ] then
1363
1378
return nil
1364
1379
end
1380
+ if asAction and ChunkStartMap [word ] then
1381
+ return nil
1382
+ end
1365
1383
local startPos = getPosition (Tokens [Index ], ' left' )
1366
1384
local finishPos = getPosition (Tokens [Index ] + # word - 1 , ' right' )
1367
1385
Index = Index + 2
@@ -1400,7 +1418,7 @@ local function parseNameOrList()
1400
1418
end
1401
1419
Index = Index + 2
1402
1420
skipSpace ()
1403
- local name = parseName ()
1421
+ local name = parseName (true )
1404
1422
if not name then
1405
1423
missName ()
1406
1424
break
@@ -1760,7 +1778,7 @@ local function parseSimple(node, funcName)
1760
1778
}
1761
1779
Index = Index + 2
1762
1780
skipSpace ()
1763
- local field = parseName ()
1781
+ local field = parseName (true )
1764
1782
local getfield = {
1765
1783
type = ' getfield' ,
1766
1784
start = node .start ,
@@ -1790,7 +1808,7 @@ local function parseSimple(node, funcName)
1790
1808
}
1791
1809
Index = Index + 2
1792
1810
skipSpace ()
1793
- local method = parseName ()
1811
+ local method = parseName (true )
1794
1812
local getmethod = {
1795
1813
type = ' getmethod' ,
1796
1814
start = node .start ,
@@ -2864,7 +2882,7 @@ local function parseLocal()
2864
2882
end
2865
2883
end
2866
2884
2867
- local name = parseName ()
2885
+ local name = parseName (true )
2868
2886
if not name then
2869
2887
missName ()
2870
2888
return nil
0 commit comments