summaryrefslogtreecommitdiff
path: root/server/src/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-07 14:53:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-07 14:53:47 +0800
commitb7a45a477c7f3e5c20e14a649847147340e96abc (patch)
treede69cc3c08dfe75e1a48b0449d73a3e8781d7faf /server/src/parser
parentb5dec09b49117ddbd22479b1d8a2603761392027 (diff)
downloadlua-language-server-b7a45a477c7f3e5c20e14a649847147340e96abc.zip
更新语法解析
Diffstat (limited to 'server/src/parser')
-rw-r--r--server/src/parser/grammar.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/server/src/parser/grammar.lua b/server/src/parser/grammar.lua
index 5308c6fb..d7dd54f8 100644
--- a/server/src/parser/grammar.lua
+++ b/server/src/parser/grammar.lua
@@ -61,6 +61,12 @@ defs.NotReserved = function (_, _, str)
end
return true, str
end
+defs.Reserved = function (_, _, str)
+ if RESERVED[str] then
+ return true
+ end
+ return false
+end
defs.np = m.Cp() / function (n) return n+1 end
local eof = re.compile '!. / %{SYNTAX_ERROR}'
@@ -250,8 +256,9 @@ Float16Exp <- [pP] [+-]? [0-9]+
grammar 'Name' [[
Name <- Sp ({} NameBody {})
-> Name
-NameBody <- ([a-zA-Z_] [a-zA-Z0-9_]*)
- => NotReserved
+NameBody <- {[a-zA-Z_] [a-zA-Z0-9_]*}
+FreeName <- Sp ({} NameBody=>NotReserved {})
+ -> Name
MustName <- Name / DirtyName
DirtyName <- {} -> DirtyName
]]
@@ -284,7 +291,7 @@ ExpUnit <- Nil
Simple <- (Prefix (Suffix)*)
-> Simple
Prefix <- PL Exp PR
- / Name
+ / FreeName
Suffix <- DOT Name?
/ COLON Name?
/ Sp ({} Table {}) -> Call