Skip to content

Commit 671c708

Browse files
committed
#1254 more non-standard symbols
1 parent 3853d4d commit 671c708

File tree

7 files changed

+49
-3
lines changed

7 files changed

+49
-3
lines changed

doc/en-us/config.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,13 @@ Array<string>
12161216
* ``"-="``
12171217
* ``"*="``
12181218
* ``"/="``
1219+
* ``"%="``
1220+
* ``"^="``
1221+
* ``"//="``
1222+
* ``"|="``
1223+
* ``"&="``
1224+
* ``"<<="``
1225+
* ``">>="``
12191226
* ``"||"``
12201227
* ``"&&"``
12211228
* ``"!"``

doc/pt-br/config.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,13 @@ Array<string>
12161216
* ``"-="``
12171217
* ``"*="``
12181218
* ``"/="``
1219+
* ``"%="``
1220+
* ``"^="``
1221+
* ``"//="``
1222+
* ``"|="``
1223+
* ``"&="``
1224+
* ``"<<="``
1225+
* ``">>="``
12191226
* ``"||"``
12201227
* ``"&&"``
12211228
* ``"!"``

doc/zh-cn/config.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,13 @@ Array<string>
12151215
* ``"-="``
12161216
* ``"*="``
12171217
* ``"/="``
1218+
* ``"%="``
1219+
* ``"^="``
1220+
* ``"//="``
1221+
* ``"|="``
1222+
* ``"&="``
1223+
* ``"<<="``
1224+
* ``">>="``
12181225
* ``"||"``
12191226
* ``"&&"``
12201227
* ``"!"``

doc/zh-tw/config.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,13 @@ Array<string>
12151215
* ``"-="``
12161216
* ``"*="``
12171217
* ``"/="``
1218+
* ``"%="``
1219+
* ``"^="``
1220+
* ``"//="``
1221+
* ``"|="``
1222+
* ``"&="``
1223+
* ``"<<="``
1224+
* ``">>="``
12181225
* ``"||"``
12191226
* ``"&&"``
12201227
* ``"!"``

script/config/template.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ local template = {
209209
['Lua.runtime.nonstandardSymbol'] = Type.Array(Type.String << {
210210
'//', '/**/',
211211
'`',
212-
'+=', '-=', '*=', '/=',
212+
'+=', '-=', '*=', '/=', '%=', '^=', '//=',
213+
'|=', '&=', '<<=', '>>=',
213214
'||', '&&', '!', '!=',
214215
'continue',
215216
}),

script/parser/compile.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,14 @@ local function expectAssign(isAction)
612612
if token == '+='
613613
or token == '-='
614614
or token == '*='
615-
or token == '/=' then
615+
or token == '/='
616+
or token == '%='
617+
or token == '^='
618+
or token == '//='
619+
or token == '|='
620+
or token == '&='
621+
or token == '>>='
622+
or token == '<<=' then
616623
if not State.options.nonstandardSymbol[token] then
617624
unknownSymbol()
618625
end

script/parser/tokens.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ local Word = m.R('AZ', 'az', '__', '\x80\xff') * m.R('AZ', 'az', '09', '__', '
77
local Symbol = m.P'=='
88
+ m.P'~='
99
+ m.P'--'
10+
-- non-standard:
11+
+ m.P'<<='
12+
+ m.P'>>='
13+
+ m.P'//='
14+
-- end non-standard
1015
+ m.P'<<'
1116
+ m.P'>>'
1217
+ m.P'<='
@@ -15,7 +20,7 @@ local Symbol = m.P'=='
1520
+ m.P'...'
1621
+ m.P'..'
1722
+ m.P'::'
18-
-- incorrect
23+
-- non-standard:
1924
+ m.P'!='
2025
+ m.P'&&'
2126
+ m.P'||'
@@ -24,7 +29,12 @@ local Symbol = m.P'=='
2429
+ m.P'+='
2530
+ m.P'-='
2631
+ m.P'*='
32+
+ m.P'%='
33+
+ m.P'&='
34+
+ m.P'|='
35+
+ m.P'^='
2736
+ m.P'/='
37+
-- end non-standard
2838
-- singles
2939
+ m.S'+-*/!#%^&()={}[]|\\\'":;<>,.?~`'
3040
local Unknown = (1 - Number - Word - Symbol - Sp - Nl)^1

0 commit comments

Comments
 (0)