summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-03-05 12:03:07 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-03-05 12:03:07 +0800
commit45cd0bfd3f5bad6aba13297e6558783356486ec4 (patch)
tree208d57899fe7fab9158df8281337c082567cfcd7 /script
parent4afa5143c629ae37cb64742b4c55e88feaadafb9 (diff)
downloadlua-language-server-45cd0bfd3f5bad6aba13297e6558783356486ec4.zip
missed syntax error `local a <const>= 1`
Diffstat (limited to 'script')
-rw-r--r--script/parser/ast.lua15
-rw-r--r--script/parser/grammar.lua4
2 files changed, 18 insertions, 1 deletions
diff --git a/script/parser/ast.lua b/script/parser/ast.lua
index 13e95606..07169a9a 100644
--- a/script/parser/ast.lua
+++ b/script/parser/ast.lua
@@ -1889,6 +1889,21 @@ local Defs = {
}
return start, finish
end,
+ MissSpaceBetween = function (start)
+ PushError {
+ type = 'MISS_SPACE_BETWEEN',
+ start = start,
+ finish = start + 1,
+ fix = {
+ title = 'FIX_INSERT_SPACE',
+ {
+ start = start + 1,
+ finish = start,
+ text = ' ',
+ }
+ }
+ }
+ end
}
local function init(state)
diff --git a/script/parser/grammar.lua b/script/parser/grammar.lua
index 48a28ac0..c7ae13c0 100644
--- a/script/parser/grammar.lua
+++ b/script/parser/grammar.lua
@@ -505,7 +505,9 @@ RepeatBody <- REPEAT
LocalAttr <- {| (Sp '<' Sp MustName Sp LocalAttrEnd)+ |}
-> LocalAttr
-LocalAttrEnd<- '>' / {} -> MissGT
+LocalAttrEnd<- ({} '>' &'=') -> MissSpaceBetween
+ / '>'
+ / {} -> MissGT
Local <- Sp ({} LOCAL LocalNameList ((AssignOrEQ ExpList) / %nil) {})
-> Local
Set <- Sp ({} SimpleList AssignOrEQ {} ExpList {})