summaryrefslogtreecommitdiff
path: root/server/src/parser/ast.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/parser/ast.lua')
-rw-r--r--server/src/parser/ast.lua53
1 files changed, 41 insertions, 12 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 645d10e9..74f69d3c 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -283,19 +283,36 @@ local Defs = {
end
return ''
end
- if v < 0 or v > 0x10ffff then
- pushError {
- type = 'UTF8_MAX',
- start = pos-3,
- finish = pos+#char,
- info = {
- min = '000000',
- max = '10ffff',
+ if State.Version == 'Lua 5.4' then
+ if v < 0 or v > 0x7FFFFFFF then
+ pushError {
+ type = 'UTF8_MAX',
+ start = pos-3,
+ finish = pos+#char,
+ info = {
+ min = '00000000',
+ max = '7FFFFFFF',
+ }
}
- }
- return ''
+ return ''
+ end
+ else
+ if v < 0 or v > 0x10FFFF then
+ pushError {
+ type = 'UTF8_MAX',
+ start = pos-3,
+ finish = pos+#char,
+ version = v <= 0x7FFFFFFF and 'Lua 5.4' or nil,
+ info = {
+ min = '000000',
+ max = '10FFFF',
+ }
+ }
+ return ''
+ end
+ return utf8_char(v)
end
- return utf8_char(v)
+ return ''
end,
Number = function (start, number, finish)
local n = tonumber(number)
@@ -1188,13 +1205,25 @@ local Defs = {
}
return rtn, action
end,
+ ToClose = function (start)
+ if State.Version == 'Lua 5.4' then
+ return
+ end
+ pushError {
+ type = 'TOCLOSE',
+ start = start,
+ finish = start + #'*toclose' - 1,
+ version = 'Lua 5.4',
+ }
+ end
}
-return function (self, lua, mode)
+return function (self, lua, mode, version)
Errs = {}
State= {
Break = 0,
Label = {{}},
+ Version = version,
}
local suc, res, err = pcall(self.grammar, lua, mode, Defs)
if not suc then