summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-29 14:43:40 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-29 14:43:40 +0800
commit94d49cbd755932e74463c852ff100a6755d28546 (patch)
tree586a2f5c7a1ac38cb240f9f6771a951aaf1294b7 /server/src
parentca3898fd7e8fa97d8b609b9a5578ef7d8af5e54d (diff)
downloadlua-language-server-94d49cbd755932e74463c852ff100a6755d28546.zip
可以显示语法错误了
Diffstat (limited to 'server/src')
-rw-r--r--server/src/parser/ast.lua8
-rw-r--r--server/src/parser/grammar.lua4
2 files changed, 10 insertions, 2 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 2096fd28..c419e50a 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -75,6 +75,12 @@ local defs = {
}
end,
DirtyName = function (pos)
+ pushError {
+ type = 'MISS_NAME',
+ start = pos,
+ finish = pos,
+ level = 'error',
+ }
return {
type = 'name',
start = pos,
@@ -429,5 +435,5 @@ return function (self, lua, mode)
pushError(err)
return nil, Errs
end
- return res
+ return res, Errs
end
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index 5ec5b826..7afea5e7 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -269,7 +269,9 @@ ExpList <- (COMMA DirtyExp)+
-> List
NameList <- (COMMA MustName)+
-> List
- / (Name (COMMA MustName)*)?
+ / (Name (COMMA MustName)*)
+ -> List
+ / DirtyName
-> List
ArgList <- (COMMA AfterArg)+