From 6f5aa8ca04f97fe3e1d3059b9d7868552fda0158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 7 Dec 2021 14:45:53 +0800 Subject: fix #848 --- changelog.md | 3 +++ script/parser/newparser.lua | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 9a729ca9..015c70e5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # changelog +## 2.5.4 +* `FIX` [#848](https://github.com/sumneko/lua-language-server/issues/848) + ## 2.5.3 `2021-12-6` * `FIX` [#842](https://github.com/sumneko/lua-language-server/issues/844) diff --git a/script/parser/newparser.lua b/script/parser/newparser.lua index 187de9b3..048e1f69 100644 --- a/script/parser/newparser.lua +++ b/script/parser/newparser.lua @@ -1649,11 +1649,13 @@ local function parseTable() wantSep = true local tindex = parseIndex() skipSpace() + tindex.type = 'tableindex' + tindex.parent = tbl + index = index + 1 + tbl[index] = tindex if expectAssign() then skipSpace() local ivalue = parseExp() - tindex.type = 'tableindex' - tindex.parent = tbl if ivalue then ivalue.parent = tindex tindex.finish = ivalue.finish @@ -1661,8 +1663,6 @@ local function parseTable() else missExp() end - index = index + 1 - tbl[index] = tindex else missSymbol '=' end -- cgit v1.2.3