summaryrefslogtreecommitdiff
path: root/script/parser
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-23 20:22:26 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-23 20:22:26 +0800
commit7fc2e8d182800a48e99744fc88fef24ca578b18f (patch)
treecd88b92bbc0bc50a55f0857db52b63dabdeb7e9a /script/parser
parentd2667b5943f41ec16b5e54a4d64c497bef149b59 (diff)
downloadlua-language-server-7fc2e8d182800a48e99744fc88fef24ca578b18f.zip
add integer
Diffstat (limited to 'script/parser')
-rw-r--r--script/parser/ast.lua2
-rw-r--r--script/parser/guide.lua10
2 files changed, 11 insertions, 1 deletions
diff --git a/script/parser/ast.lua b/script/parser/ast.lua
index 40b5788e..bd8a66cf 100644
--- a/script/parser/ast.lua
+++ b/script/parser/ast.lua
@@ -547,7 +547,7 @@ local Defs = {
local n = tonumber(number)
if n then
State.LastNumber = {
- type = 'number',
+ type = mathType(n) == 'integer' and 'integer' or 'number',
start = start,
finish = finish - 1,
[1] = n,
diff --git a/script/parser/guide.lua b/script/parser/guide.lua
index 1c6b9e81..e6501f12 100644
--- a/script/parser/guide.lua
+++ b/script/parser/guide.lua
@@ -183,6 +183,7 @@ function m.isLiteral(obj)
or tp == 'boolean'
or tp == 'string'
or tp == 'number'
+ or tp == 'integer'
or tp == 'table'
or tp == 'function'
end
@@ -198,6 +199,8 @@ function m.getLiteral(obj)
return obj[1]
elseif tp == 'number' then
return obj[1]
+ elseif tp == 'integer' then
+ return obj[1]
end
return nil
end
@@ -818,6 +821,11 @@ function m.getKeyNameOfLiteral(obj)
if n then
return ('%s'):format(formatNumber(obj[1]))
end
+ elseif tp == 'integer' then
+ local n = obj[1]
+ if n then
+ return ('%s'):format(formatNumber(obj[1]))
+ end
elseif tp == 'boolean' then
local b = obj[1]
if b then
@@ -883,6 +891,8 @@ function m.getKeyTypeOfLiteral(obj)
return 'string'
elseif tp == 'number' then
return 'number'
+ elseif tp == 'integer' then
+ return 'integer'
elseif tp == 'boolean' then
return 'boolean'
end