summaryrefslogtreecommitdiff
path: root/server/src/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-07-30 11:13:03 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-07-30 11:13:03 +0800
commit459717cd81450acddd863bcabce9e77a3a1efec3 (patch)
tree707d2f9b91e08e8e604f72b892ff51d76e7bd15c /server/src/parser
parent5f17d7f521273a1d085ba025071f6687056e3660 (diff)
downloadlua-language-server-459717cd81450acddd863bcabce9e77a3a1efec3.zip
更新LuaParser
Diffstat (limited to 'server/src/parser')
-rw-r--r--server/src/parser/ast.lua8
-rw-r--r--server/src/parser/grammar.lua7
2 files changed, 12 insertions, 3 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index a83f5abf..0be0027d 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -996,10 +996,14 @@ local Defs = {
end
return tags
end,
- Local = function (tags, keys, values)
+ LocalName = function (tags, name)
+ name.tags = tags
+ return name
+ end,
+ Local = function (keys, values)
return {
type = 'local',
- keys, values, tags
+ keys, values,
}
end,
DoBody = function (...)
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index a923e5eb..aa44a3ce 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -493,10 +493,15 @@ RepeatBody <- REPEAT
LocalTag <- (Sp '<' Sp MustName Sp LocalTagEnd)*
-> LocalTag
LocalTagEnd <- '>' / {} -> MissGT
-Local <- (LOCAL LocalTag NameList (AssignOrEQ ExpList)?)
+Local <- (LOCAL LocalNameList (AssignOrEQ ExpList)?)
-> Local
Set <- (SimpleList AssignOrEQ ExpList?)
-> Set
+LocalNameList
+ <- (LocalName (COMMA LocalName)*)
+ -> List
+LocalName <- (LocalTag MustName)
+ -> LocalName
Call <- Simple
-> SimpleCall