Skip to content

Commit 34a7ded

Browse files
committed
first step for Lua 5.5
1 parent cc9b302 commit 34a7ded

File tree

7 files changed

+32
-24
lines changed

7 files changed

+32
-24
lines changed

script/config/template.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ local template = {
189189
'Lua 5.2',
190190
'Lua 5.3',
191191
'Lua 5.4',
192+
'Lua 5.5',
192193
'LuaJIT',
193194
},
194195
['Lua.runtime.path'] = Type.Array(Type.String) >> {

script/library.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ local function getDocFormater(uri)
3131
return 'HOVER_NATIVE_DOCUMENT_LUA53'
3232
elseif version == 'Lua 5.4' then
3333
return 'HOVER_NATIVE_DOCUMENT_LUA54'
34+
elseif version == 'Lua 5.5' then
35+
return 'HOVER_NATIVE_DOCUMENT_LUA55'
3436
elseif version == 'LuaJIT' then
3537
return 'HOVER_NATIVE_DOCUMENT_LUAJIT'
3638
end
@@ -43,6 +45,8 @@ local function getDocFormater(uri)
4345
return 'HOVER_DOCUMENT_LUA53'
4446
elseif version == 'Lua 5.4' then
4547
return 'HOVER_DOCUMENT_LUA54'
48+
elseif version == 'Lua 5.5' then
49+
return 'HOVER_DOCUMENT_LUA55'
4650
elseif version == 'LuaJIT' then
4751
return 'HOVER_DOCUMENT_LUAJIT'
4852
end

script/parser/compile.lua

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -706,12 +706,13 @@ local function parseLocalAttrs()
706706
else
707707
missSymbol '>'
708708
end
709-
if State.version ~= 'Lua 5.4' then
709+
if State.version ~= 'Lua 5.4'
710+
and State.version ~= 'Lua 5.5' then
710711
pushError {
711712
type = 'UNSUPPORT_SYMBOL',
712713
start = attr.start,
713714
finish = attr.finish,
714-
version = 'Lua 5.4',
715+
version = {'Lua 5.4', 'Lua 5.5'},
715716
info = {
716717
version = State.version
717718
}
@@ -906,13 +907,14 @@ local function parseStringUnicode()
906907
end
907908
if State.version ~= 'Lua 5.3'
908909
and State.version ~= 'Lua 5.4'
910+
and State.version ~= 'Lua 5.5'
909911
and State.version ~= 'LuaJIT'
910912
then
911913
pushError {
912914
type = 'ERR_ESC',
913915
start = leftPos - 2,
914916
finish = rightPos,
915-
version = {'Lua 5.3', 'Lua 5.4', 'LuaJIT'},
917+
version = {'Lua 5.3', 'Lua 5.4', 'Lua 5.5', 'LuaJIT'},
916918
info = {
917919
version = State.version,
918920
}
@@ -932,7 +934,7 @@ local function parseStringUnicode()
932934
end
933935
return nil, offset
934936
end
935-
if State.version == 'Lua 5.4' then
937+
if State.version == 'Lua 5.4' or State.version == 'Lua 5.5' then
936938
if byte < 0 or byte > 0x7FFFFFFF then
937939
pushError {
938940
type = 'UTF8_MAX',
@@ -951,7 +953,7 @@ local function parseStringUnicode()
951953
type = 'UTF8_MAX',
952954
start = leftPos,
953955
finish = rightPos,
954-
version = byte <= 0x7FFFFFFF and 'Lua 5.4' or nil,
956+
version = byte <= 0x7FFFFFFF and {'Lua 5.4', 'Lua 5.5'} or nil,
955957
info = {
956958
min = '000000',
957959
max = '10FFFF',
@@ -1095,7 +1097,7 @@ local function parseShortString()
10951097
type = 'ERR_ESC',
10961098
start = left,
10971099
finish = left + 4,
1098-
version = {'Lua 5.2', 'Lua 5.3', 'Lua 5.4', 'LuaJIT'},
1100+
version = {'Lua 5.2', 'Lua 5.3', 'Lua 5.4', 'Lua 5.5', 'LuaJIT'},
10991101
info = {
11001102
version = State.version,
11011103
}
@@ -1274,7 +1276,7 @@ local function parseNumber2(start)
12741276
finish = getPosition(offset - 1, 'right'),
12751277
version = 'LuaJIT',
12761278
info = {
1277-
version = 'Lua 5.4',
1279+
version = State.version,
12781280
}
12791281
}
12801282
end
@@ -2672,18 +2674,15 @@ local function parseBinaryOP(asAction, level)
26722674
if token == '//'
26732675
or token == '<<'
26742676
or token == '>>' then
2675-
if State.version ~= 'Lua 5.3'
2676-
and State.version ~= 'Lua 5.4' then
2677-
pushError {
2678-
type = 'UNSUPPORT_SYMBOL',
2679-
version = {'Lua 5.3', 'Lua 5.4'},
2680-
start = op.start,
2681-
finish = op.finish,
2682-
info = {
2683-
version = State.version,
2684-
}
2677+
pushError {
2678+
type = 'UNSUPPORT_SYMBOL',
2679+
version = {'Lua 5.3', 'Lua 5.4', 'Lua 5.5'},
2680+
start = op.start,
2681+
finish = op.finish,
2682+
info = {
2683+
version = State.version,
26852684
}
2686-
end
2685+
}
26872686
end
26882687
Index = Index + 2
26892688
return op, myLevel
@@ -3230,6 +3229,7 @@ local function parseLabel()
32303229
local olabel = guide.getLabel(block, name)
32313230
if olabel then
32323231
if State.version == 'Lua 5.4'
3232+
or State.version == 'Lua 5.5'
32333233
or block == guide.getBlock(olabel) then
32343234
pushError {
32353235
type = 'REDEFINED_LABEL',
@@ -3252,7 +3252,7 @@ local function parseLabel()
32523252
type = 'UNSUPPORT_SYMBOL',
32533253
start = left,
32543254
finish = lastRightPosition(),
3255-
version = {'Lua 5.2', 'Lua 5.3', 'Lua 5.4', 'LuaJIT'},
3255+
version = {'Lua 5.2', 'Lua 5.3', 'Lua 5.4', 'Lua 5.5', 'LuaJIT'},
32563256
info = {
32573257
version = State.version,
32583258
}
@@ -3634,7 +3634,8 @@ local function parseFor()
36343634
missExp()
36353635
end
36363636

3637-
if State.version == 'Lua 5.4' then
3637+
if State.version == 'Lua 5.4'
3638+
or State.version == 'Lua 5.5' then
36383639
forStateVars = 4
36393640
else
36403641
forStateVars = 3

script/vm/compiler.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1913,7 +1913,8 @@ local compilerSwitch = util.switch()
19131913
local uri = guide.getUri(source)
19141914
local version = config.get(uri, 'Lua.runtime.version')
19151915
if version == 'Lua 5.3'
1916-
or version == 'Lua 5.4' then
1916+
or version == 'Lua 5.4'
1917+
or version == 'Lua 5.5' then
19171918
vm.setNode(source, vm.declareGlobal('type', 'unknown'))
19181919
else
19191920
vm.setNode(source, vm.declareGlobal('type', 'nil'))

script/vm/doc.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ function vm.getValidVersions(doc)
9595
['Lua 5.2'] = false,
9696
['Lua 5.3'] = false,
9797
['Lua 5.4'] = false,
98+
['Lua 5.5'] = false,
9899
['LuaJIT'] = false,
99100
}
100101
for _, version in ipairs(doc.versions) do

script/vm/operator.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,14 @@ vm.binarySwitch = util.switch()
362362
local uri = guide.getUri(source)
363363
local version = config.get(uri, 'Lua.runtime.version')
364364
if math.tointeger(a) and math.type(a) == 'float' then
365-
if version == 'Lua 5.3' or version == 'Lua 5.4' then
365+
if version == 'Lua 5.3' or version == 'Lua 5.4' or version == 'Lua 5.5' then
366366
a = ('%.1f'):format(a)
367367
else
368368
a = ('%.0f'):format(a)
369369
end
370370
end
371371
if math.tointeger(b) and math.type(b) == 'float' then
372-
if version == 'Lua 5.3' or version == 'Lua 5.4' then
372+
if version == 'Lua 5.3' or version == 'Lua 5.4' or version == 'Lua 5.5' then
373373
b = ('%.1f'):format(b)
374374
else
375375
b = ('%.0f'):format(b)

script/without-check-nil.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ mt.__newindex = function () end
5757
mt.__call = function () end
5858
mt.__pairs = function () end
5959
mt.__ipairs = function () end
60-
if _VERSION == 'Lua 5.3' or _VERSION == 'Lua 5.4' then
60+
if _VERSION == 'Lua 5.3' or _VERSION == 'Lua 5.4' or _VERSION == 'Lua 5.5' then
6161
mt.__idiv = load[[
6262
local a, b = ...
6363
if a == nil then a = 0 end

0 commit comments

Comments
 (0)