summaryrefslogtreecommitdiff
path: root/script/vm/operator.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-06 23:34:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-06 23:34:54 +0800
commit79cc877095745be377b9dd189ee5e38cf35a3c5e (patch)
tree9e5f0e07741c8c5022d08672fef2ba137e352703 /script/vm/operator.lua
parent27dcfa8d1463936d0b2514cd82eebe1910ab3bb7 (diff)
downloadlua-language-server-79cc877095745be377b9dd189ee5e38cf35a3c5e.zip
semantic and completion description
Diffstat (limited to 'script/vm/operator.lua')
-rw-r--r--script/vm/operator.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/script/vm/operator.lua b/script/vm/operator.lua
index 9a8e255d..35910f94 100644
--- a/script/vm/operator.lua
+++ b/script/vm/operator.lua
@@ -25,6 +25,12 @@ vm.BINARY_OP = {
'concat',
}
+local unaryMap = {
+ ['-'] = 'unm',
+ ['~'] = 'bnot',
+ ['#'] = 'len',
+}
+
local binaryMap = {
['+'] = 'add',
['-'] = 'sub',
@@ -41,6 +47,9 @@ local binaryMap = {
['..'] = 'concat',
}
+vm.UNARY_MAP = util.revertMap(unaryMap)
+vm.BINARY_MAP = util.revertMap(binaryMap)
+
---@param operators parser.object[]
---@param op string
---@param value? parser.object