summaryrefslogtreecommitdiff
path: root/server/src/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-19 11:36:46 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-19 11:36:46 +0800
commit40fb8cf09860cafe5734a449045ea8b6cd18cbf9 (patch)
tree5f2f7a0e3f319e0d82de38b8bbbcd3ba49786d04 /server/src/parser
parent7a365249a48a9c947e3269c9e34c0a7ae9230377 (diff)
downloadlua-language-server-40fb8cf09860cafe5734a449045ea8b6cd18cbf9.zip
更新语法解析
Diffstat (limited to 'server/src/parser')
-rw-r--r--server/src/parser/ast.lua6
-rw-r--r--server/src/parser/grammar.lua3
2 files changed, 8 insertions, 1 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 6de13aa4..f8a16c54 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -303,6 +303,9 @@ local defs = {
}
end,
ElseBlock = function (...)
+ if ... == '' then
+ return {}
+ end
return {
...
}
@@ -375,6 +378,9 @@ local defs = {
return obj
end,
Lua = function (...)
+ if ... == '' then
+ return {}
+ end
return {...}
end,
}
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index c76fe1f1..0e7fa608 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -339,7 +339,7 @@ If <- Sp ({} IfBody {})
-> If
IfBody <- (IfPart -> IfBlock)
(ElseIfPart -> ElseIfBlock)*
- (ElsePart -> ElseBlock)?
+ ElsePart?
END
IfPart <- IF Exp THEN
Action*
@@ -347,6 +347,7 @@ ElseIfPart <- ELSEIF Exp THEN
Action*
ElsePart <- ELSE
Action*
+ -> ElseBlock
For <- Loop / In