From 2bc8fe5303bbdef220d38761656fdaa397499f76 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 17 Jan 2012 21:16:37 +1000 Subject: Fix up negate, and bool_not integer. --- LuaSL/src/LuaSL_compile.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index e1875c6..11860ad 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -131,8 +131,8 @@ allowedTypes allowed[] = {OT_nothing, "nothing", (ST_NONE)}, // {OT_bool, "boolean", (ST_BOOL_NOT)}, // bool ! - {OT_integer, "integer", (ST_BIT_NOT | ST_NEGATE)}, // int - ~ - {OT_float, "float", (ST_NONE)}, // float - + {OT_integer, "integer", (ST_BOOL_NOT | ST_BIT_NOT | ST_NEGATE)}, // int ! - ~ + {OT_float, "float", (ST_BOOL_NOT)}, // float ! - {OT_key, "key", (ST_NONE)}, // {OT_list, "list", (ST_NONE)}, // {OT_rotation, "rotation", (ST_NONE)}, // @@ -260,6 +260,10 @@ LSL_Leaf *addOperation(LuaSL_compiler *compiler, LSL_Leaf *left, LSL_Leaf *lval, lval->left = left; lval->right = right; + // Convert subtract to negate if needed. + if ((NULL == left) && (LSL_SUBTRACT == lval->token->type)) + lval->token = tokens[LSL_NEGATION - lowestToken]; + // Try to figure out what type of operation this is. if (NULL == left) lType = OT_nothing; -- cgit v1.1