diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-09-24 10:16:04 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-09-24 10:16:04 +0800 |
commit | 9f73d326ccea763762cefd2866e477796221b10f (patch) | |
tree | b9de8c245b4b2fa8c3c12a8b5a994c1b323578e0 /script | |
parent | c95e9c91236bccb4593a0d9d218dca78bcb06ae0 (diff) | |
download | lua-language-server-9f73d326ccea763762cefd2866e477796221b10f.zip |
fix
Diffstat (limited to 'script')
-rw-r--r-- | script/core/noder.lua | 2 | ||||
-rw-r--r-- | script/parser/newparser.lua | 62 |
2 files changed, 33 insertions, 31 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index 177a151c..927f3c6d 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -1271,7 +1271,7 @@ compileNodeMap = util.switch() type = 'call', dummy = true, start = source.keyword[3], - finish = source.keyword[6], + finish = exps[#exps].finish, node = node, args = { param1, param2 }, parent = source, diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua index 96b1fb64..ee2c5e62 100644 --- a/script/parser/newparser.lua +++ b/script/parser/newparser.lua @@ -1496,36 +1496,6 @@ local function parseTable() goto CONTINUE end local lastRight = lastRightPosition() - if token == '[' then - if wantSep then - pushError { - type = 'MISS_SEP_IN_TABLE', - start = lastRight, - finish = getPosition(Tokens[Index], 'left'), - } - end - wantSep = true - index = index + 1 - local tindex = parseIndex() - skipSpace() - if expectAssign() then - skipSpace() - local ivalue = parseExp() - tindex.type = 'tableindex' - tindex.parent = tbl - if ivalue then - ivalue.parent = tindex - tindex.finish = ivalue.finish - tindex.value = ivalue - else - missExp() - end - tbl[index] = tindex - else - missSymbol '=' - end - goto CONTINUE - end local exp = parseExp(true) if exp then @@ -1581,6 +1551,38 @@ local function parseTable() tbl[index] = texp goto CONTINUE end + + if token == '[' then + if wantSep then + pushError { + type = 'MISS_SEP_IN_TABLE', + start = lastRight, + finish = getPosition(Tokens[Index], 'left'), + } + end + wantSep = true + index = index + 1 + local tindex = parseIndex() + skipSpace() + if expectAssign() then + skipSpace() + local ivalue = parseExp() + tindex.type = 'tableindex' + tindex.parent = tbl + if ivalue then + ivalue.parent = tindex + tindex.finish = ivalue.finish + tindex.value = ivalue + else + missExp() + end + tbl[index] = tindex + else + missSymbol '=' + end + goto CONTINUE + end + missSymbol '}' break ::CONTINUE:: |