summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-05 17:56:43 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-05 17:56:43 +0800
commit671c7089a1697ee8f6fc108a9568b0509e1aa933 (patch)
tree809901984a607c12d2f023011d53ab54d9845f51 /script
parent3853d4d8a9a2478c3afa4126a97bcbc65208a8cc (diff)
downloadlua-language-server-671c7089a1697ee8f6fc108a9568b0509e1aa933.zip
#1254 more non-standard symbols
Diffstat (limited to 'script')
-rw-r--r--script/config/template.lua3
-rw-r--r--script/parser/compile.lua9
-rw-r--r--script/parser/tokens.lua12
3 files changed, 21 insertions, 3 deletions
diff --git a/script/config/template.lua b/script/config/template.lua
index 3d5bad3d..2f5ff005 100644
--- a/script/config/template.lua
+++ b/script/config/template.lua
@@ -209,7 +209,8 @@ local template = {
['Lua.runtime.nonstandardSymbol'] = Type.Array(Type.String << {
'//', '/**/',
'`',
- '+=', '-=', '*=', '/=',
+ '+=', '-=', '*=', '/=', '%=', '^=', '//=',
+ '|=', '&=', '<<=', '>>=',
'||', '&&', '!', '!=',
'continue',
}),
diff --git a/script/parser/compile.lua b/script/parser/compile.lua
index ee35a924..1e4165ff 100644
--- a/script/parser/compile.lua
+++ b/script/parser/compile.lua
@@ -612,7 +612,14 @@ local function expectAssign(isAction)
if token == '+='
or token == '-='
or token == '*='
- or token == '/=' then
+ or token == '/='
+ or token == '%='
+ or token == '^='
+ or token == '//='
+ or token == '|='
+ or token == '&='
+ or token == '>>='
+ or token == '<<=' then
if not State.options.nonstandardSymbol[token] then
unknownSymbol()
end
diff --git a/script/parser/tokens.lua b/script/parser/tokens.lua
index 958f292e..a4de7f88 100644
--- a/script/parser/tokens.lua
+++ b/script/parser/tokens.lua
@@ -7,6 +7,11 @@ local Word = m.R('AZ', 'az', '__', '\x80\xff') * m.R('AZ', 'az', '09', '__', '
local Symbol = m.P'=='
+ m.P'~='
+ m.P'--'
+ -- non-standard:
+ + m.P'<<='
+ + m.P'>>='
+ + m.P'//='
+ -- end non-standard
+ m.P'<<'
+ m.P'>>'
+ m.P'<='
@@ -15,7 +20,7 @@ local Symbol = m.P'=='
+ m.P'...'
+ m.P'..'
+ m.P'::'
- -- incorrect
+ -- non-standard:
+ m.P'!='
+ m.P'&&'
+ m.P'||'
@@ -24,7 +29,12 @@ local Symbol = m.P'=='
+ m.P'+='
+ m.P'-='
+ m.P'*='
+ + m.P'%='
+ + m.P'&='
+ + m.P'|='
+ + m.P'^='
+ m.P'/='
+ -- end non-standard
-- singles
+ m.S'+-*/!#%^&()={}[]|\\\'":;<>,.?~`'
local Unknown = (1 - Number - Word - Symbol - Sp - Nl)^1