diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-28 11:31:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-28 11:31:13 +0800 |
commit | 0007a89a9c9bb153c2475b85b11664761264566f (patch) | |
tree | 10f4eec41c202d446fc7663b636a3f2dab3ae06c /server/src/parser | |
parent | 8d63f26209a4e241bb30551d81ceb4ca246b228a (diff) | |
download | lua-language-server-0007a89a9c9bb153c2475b85b11664761264566f.zip |
实例化index
Diffstat (limited to 'server/src/parser')
-rw-r--r-- | server/src/parser/ast.lua | 10 | ||||
-rw-r--r-- | server/src/parser/grammar.lua | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua index 4521ffd5..8c4e1a1c 100644 --- a/server/src/parser/ast.lua +++ b/server/src/parser/ast.lua @@ -93,9 +93,13 @@ local defs = { return first end end, - Index = function (exp) - exp.index = true - return exp + Index = function (start, exp, finish) + return { + type = 'index', + start = start, + finish = finish - 1, + [1] = exp, + } end, Call = function (start, arg, finish) if arg == nil then diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua index d21f07b9..ce7e4794 100644 --- a/server/src/parser/grammar.lua +++ b/server/src/parser/grammar.lua @@ -264,7 +264,7 @@ Suffix <- DOT MustName / COLON MustName / Sp ({} Table {}) -> Call / Sp ({} String {}) -> Call - / BL DirtyExp -> Index BR? + / Sp ({} BL DirtyExp (BR / Sp) {}) -> Index / Sp ({} PL ExpList (PR / Sp) {}) -> Call DirtyExp <- Exp / DirtyName |