summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-07 17:48:51 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-07 17:48:51 +0800
commit08ad622130ad703a7fcb4120559ebcf9cc163185 (patch)
tree4a18689811d1696ad37f1a2788ef61f6e9f386df /server
parent8bca250c629afe7cf99ade2042288b9f2cdde722 (diff)
downloadlua-language-server-08ad622130ad703a7fcb4120559ebcf9cc163185.zip
更新语法解析
Diffstat (limited to 'server')
-rw-r--r--server/src/parser/ast.lua10
-rw-r--r--server/src/parser/grammar.lua6
2 files changed, 11 insertions, 5 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 77edeb5e..6de13aa4 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -85,18 +85,24 @@ local defs = {
exp.index = true
return exp
end,
- Call = function (arg)
+ Call = function (start, arg, finish)
if arg == nil then
return {
- type = 'call'
+ type = 'call',
+ start = start,
+ finish = finish - 1,
}
end
if arg.type == 'list' then
arg.type = 'call'
+ arg.start = start
+ arg.finish = finish - 1
return arg
end
local obj = {
type = 'call',
+ start = start,
+ finish = finish - 1,
[1] = arg,
}
return obj
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index 0f533862..4c087024 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -261,10 +261,10 @@ Prefix <- PL Exp PR
/ Name
Suffix <- DOT Name
/ COLON Name
- / Table -> Call
- / String -> Call
+ / Sp ({} Table {}) -> Call
+ / Sp ({} String {}) -> Call
/ BL Exp -> Index BR
- / PL (ExpList -> Call) PR
+ / Sp ({} PL ExpList PR {}) -> Call
ExpList <- (Exp (COMMA Exp)*)?
-> List