summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-22 17:30:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-22 17:30:18 +0800
commiteb3d39eaedce44c8e4e25cf03494b32e874f3ca9 (patch)
treef299fe01c4eb988d46b79eb63d8c4339bd91a8dd
parenta22f5fd46af72f505040cc1422faeb20fce8632d (diff)
downloadlua-language-server-eb3d39eaedce44c8e4e25cf03494b32e874f3ca9.zip
close #317 #282
-rw-r--r--script/config.lua18
-rw-r--r--script/files.lua6
-rw-r--r--script/parser/ast.lua66
3 files changed, 48 insertions, 42 deletions
diff --git a/script/config.lua b/script/config.lua
index f5e0f391..eecd8ffa 100644
--- a/script/config.lua
+++ b/script/config.lua
@@ -95,15 +95,15 @@ end
local ConfigTemplate = {
runtime = {
- version = {'Lua 5.4', String},
- path = {{
- "?.lua",
- "?/init.lua",
- "?/?.lua"
- }, Array(String)},
- special = {{}, Hash(String, String)},
- meta = {'${version} ${language}', String},
- unicodeName = {false, Boolean},
+ version = {'Lua 5.4', String},
+ path = {{
+ "?.lua",
+ "?/init.lua",
+ "?/?.lua"
+ }, Array(String)},
+ special = {{}, Hash(String, String)},
+ meta = {'${version} ${language}', String},
+ unicodeName = {false, Boolean},
nonstandardSymbol = {{}, Str2Hash ';'},
},
diagnostics = {
diff --git a/script/files.lua b/script/files.lua
index 3a8f93ad..9ffcd2a1 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -246,9 +246,9 @@ function m.compileAst(uri, text)
, 'lua'
, config.config.runtime.version
, {
- special = config.config.runtime.special,
- unicodeName = config.config.runtime.unicodeName,
- alias = config.config.runtime.alias,
+ special = config.config.runtime.special,
+ unicodeName = config.config.runtime.unicodeName,
+ nonstandardSymbol = config.config.runtime.nonstandardSymbol,
}
)
local passed = os.clock() - clock
diff --git a/script/parser/ast.lua b/script/parser/ast.lua
index 75cc779a..127bb08c 100644
--- a/script/parser/ast.lua
+++ b/script/parser/ast.lua
@@ -693,23 +693,26 @@ local Defs = {
end,
BinaryOp = function (start, op)
if SymbolAlias[op] then
- PushError {
- type = 'ERR_NONSTANDARD_SYMBOL',
- start = start,
- finish = start + #op - 1,
- info = {
- symbol = SymbolAlias[op],
- },
- fix = {
- title = 'FIX_NONSTANDARD_SYMBOL',
- symbol = SymbolAlias[op],
- {
- start = start,
- finish = start + #op - 1,
- text = SymbolAlias[op],
+ if State.options.nonstandardSymbol and State.options.nonstandardSymbol[op] then
+ else
+ PushError {
+ type = 'ERR_NONSTANDARD_SYMBOL',
+ start = start,
+ finish = start + #op - 1,
+ info = {
+ symbol = SymbolAlias[op],
},
+ fix = {
+ title = 'FIX_NONSTANDARD_SYMBOL',
+ symbol = SymbolAlias[op],
+ {
+ start = start,
+ finish = start + #op - 1,
+ text = SymbolAlias[op],
+ },
+ }
}
- }
+ end
op = SymbolAlias[op]
end
return {
@@ -720,23 +723,26 @@ local Defs = {
end,
UnaryOp = function (start, op)
if SymbolAlias[op] then
- PushError {
- type = 'ERR_NONSTANDARD_SYMBOL',
- start = start,
- finish = start + #op - 1,
- info = {
- symbol = SymbolAlias[op],
- },
- fix = {
- title = 'FIX_NONSTANDARD_SYMBOL',
- symbol = SymbolAlias[op],
- {
- start = start,
- finish = start + #op - 1,
- text = SymbolAlias[op],
+ if State.options.nonstandardSymbol and State.options.nonstandardSymbol[op] then
+ else
+ PushError {
+ type = 'ERR_NONSTANDARD_SYMBOL',
+ start = start,
+ finish = start + #op - 1,
+ info = {
+ symbol = SymbolAlias[op],
},
+ fix = {
+ title = 'FIX_NONSTANDARD_SYMBOL',
+ symbol = SymbolAlias[op],
+ {
+ start = start,
+ finish = start + #op - 1,
+ text = SymbolAlias[op],
+ },
+ }
}
- }
+ end
op = SymbolAlias[op]
end
return {