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.lua46
1 files changed, 44 insertions, 2 deletions
diff --git a/server/src/parser/ast.lua b/server/src/parser/ast.lua
index 3e8bc22a..508252ae 100644
--- a/server/src/parser/ast.lua
+++ b/server/src/parser/ast.lua
@@ -366,24 +366,66 @@ local Defs = {
Number = function (start, number, finish)
local n = tonumber(number)
if n then
- return {
+ State.LastNumber = {
type = 'number',
start = start,
finish = finish - 1,
[1] = n,
}
+ return State.LastNumber
else
pushError {
type = 'MALFORMED_NUMBER',
start = start,
finish = finish - 1,
}
- return {
+ State.LastNumber = {
type = 'number',
start = start,
finish = finish - 1,
[1] = 0,
}
+ return State.LastNumber
+ end
+ end,
+ FFINumber = function (start, symbol)
+ if math.type(State.LastNumber[1]) == 'float' then
+ pushError {
+ type = 'UNKNOWN_SYMBOL',
+ start = start,
+ finish = start + #symbol - 1,
+ info = {
+ symbol = symbol,
+ }
+ }
+ State.LastNumber[1] = 0
+ return
+ end
+ if State.Version ~= 'LuaJIT' then
+ pushError {
+ type = 'UNSUPPORT_SYMBOL',
+ start = start,
+ finish = start + #symbol - 1,
+ version = 'LuaJIT',
+ info = {
+ version = State.Version,
+ }
+ }
+ State.LastNumber[1] = 0
+ end
+ end,
+ ImaginaryNumber = function (start, symbol)
+ if State.Version ~= 'LuaJIT' then
+ pushError {
+ type = 'UNSUPPORT_SYMBOL',
+ start = start,
+ finish = start + #symbol - 1,
+ version = 'LuaJIT',
+ info = {
+ version = State.Version,
+ }
+ }
+ State.LastNumber[1] = 0
end
end,
Name = function (start, str, finish)