From aee5a20afb25260a8997d16f82cce0e71a41ebe1 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 8 Jan 2012 20:22:30 +1000 Subject: Bite the bullet and get rid of my dreams to use enums, yacc insists on #defines. --- LuaSL/src/LuaSL_LSL_tree.c | 54 ++++++++++++--------------- LuaSL/src/LuaSL_LSL_tree.h | 91 +--------------------------------------------- 2 files changed, 26 insertions(+), 119 deletions(-) (limited to 'LuaSL') diff --git a/LuaSL/src/LuaSL_LSL_tree.c b/LuaSL/src/LuaSL_LSL_tree.c index cc9007c..11a481d 100644 --- a/LuaSL/src/LuaSL_LSL_tree.c +++ b/LuaSL/src/LuaSL_LSL_tree.c @@ -272,44 +272,38 @@ static void evaluateOperationToken(LSL_Leaf *content, LSL_Value *left, LSL_Value switch (content->operationValue) { -#ifdef LUASL_USE_ENUM - case LSL_COMMA : - case LSL_INCREMENT_PRE : - case LSL_INCREMENT_POST : - case LSL_DECREMENT_PRE : - case LSL_DECREMENT_POST : - case LSL_DOT : - case LSL_ASSIGNMENT_PLAIN : - case LSL_ASSIGNMENT_DIVIDE : - case LSL_ASSIGNMENT_MODULO : - case LSL_ASSIGNMENT_MULTIPLY : - case LSL_ASSIGNMENT_SUBTRACT : - case LSL_ASSIGNMENT_ADD : - case LSL_ASSIGNMENT_CONCATENATE : - case LSL_PARENTHESIS_OPEN : - case LSL_PARENTHESIS_CLOSE : - case LSL_BRACKET_OPEN : - case LSL_BRACKET_CLOSE : - case LSL_ANGLE_OPEN : - case LSL_ANGLE_CLOSE : - case LSL_TYPECAST : - break; -#endif +// case LSL_COMMA : +// case LSL_INCREMENT_PRE : +// case LSL_INCREMENT_POST : +// case LSL_DECREMENT_PRE : +// case LSL_DECREMENT_POST : +// case LSL_DOT : +// case LSL_ASSIGNMENT_PLAIN : +// case LSL_ASSIGNMENT_DIVIDE : +// case LSL_ASSIGNMENT_MODULO : +// case LSL_ASSIGNMENT_MULTIPLY : +// case LSL_ASSIGNMENT_SUBTRACT : +// case LSL_ASSIGNMENT_ADD : +// case LSL_ASSIGNMENT_CONCATENATE : +// case LSL_PARENTHESIS_OPEN : +// case LSL_PARENTHESIS_CLOSE : +// case LSL_BRACKET_OPEN : +// case LSL_BRACKET_CLOSE : +// case LSL_ANGLE_OPEN : +// case LSL_ANGLE_CLOSE : +// case LSL_TYPECAST : +// break; case LSL_BIT_NOT : left->content.integerValue = ~ right->content.integerValue; break; case LSL_BOOL_NOT : left->content.integerValue = ! right->content.integerValue; break; case LSL_NEGATION : left->content.integerValue = 0 - right->content.integerValue; break; case LSL_DIVIDE : left->content.integerValue = left->content.integerValue / right->content.integerValue; break; case LSL_MODULO : left->content.integerValue = left->content.integerValue % right->content.integerValue; break; case LSL_MULTIPLY : left->content.integerValue = left->content.integerValue * right->content.integerValue; break; -#ifdef LUASL_USE_ENUM - case LSL_DOT_PRODUCT : break; - case LSL_CROSS_PRODUCT : break; -#endif +// case LSL_DOT_PRODUCT : break; +// case LSL_CROSS_PRODUCT : break; case LSL_SUBTRACT : left->content.integerValue = left->content.integerValue - right->content.integerValue; break; case LSL_ADD : left->content.integerValue = left->content.integerValue + right->content.integerValue; break; -#ifdef LUASL_USE_ENUM - case LSL_CONCATENATE : break; -#endif +// case LSL_CONCATENATE : break; case LSL_LEFT_SHIFT : left->content.integerValue = left->content.integerValue << right->content.integerValue; break; case LSL_RIGHT_SHIFT : left->content.integerValue = left->content.integerValue >> right->content.integerValue; break; case LSL_LESS_THAN : left->content.integerValue = left->content.integerValue < right->content.integerValue; break; diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 0b2f125..257f18b 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h @@ -2,17 +2,15 @@ #ifndef __EXPRESSION_H__ #define __EXPRESSION_H__ -//#define LUASL_USE_ENUM #define LUASL_DEBUG -#ifndef LUASL_USE_ENUM -#include "LuaSL_yaccer.tab.h" -#endif #include // So we can have NULL defined. #include #include #include + +#include "LuaSL_yaccer.tab.h" #define YYERRCODE 256 #define YYDEBUG 1 @@ -41,92 +39,7 @@ typedef enum LSL_CREATION = 32 } LSL_Flags; -#ifdef LUASL_USE_ENUM -typedef enum // In order of precedence, high to low. - // Left to right, unless oterwise stated. - // According to http://wiki.secondlife.com/wiki/Category:LSL_Operators -{ - LSL_COMMA = 257, - LSL_INCREMENT_PRE, // Right to left. - LSL_INCREMENT_POST, // Right to left. - LSL_DECREMENT_PRE, // Right to left. - LSL_DECREMENT_POST, // Right to left. - LSL_DOT, // Right to left. - LSL_ASSIGNMENT_PLAIN, // Right to left. - LSL_ASSIGNMENT_DIVIDE, // Right to left. - LSL_ASSIGNMENT_MODULO, // Right to left. - LSL_ASSIGNMENT_MULTIPLY, // Right to left. - LSL_ASSIGNMENT_SUBTRACT, // Right to left. - LSL_ASSIGNMENT_ADD, // Right to left. - LSL_ASSIGNMENT_CONCATENATE, // Right to left. - LSL_PARENTHESIS_OPEN, // Inner to outer. - LSL_PARENTHESIS_CLOSE, // Inner to outer. - LSL_BRACKET_OPEN, // Inner to outer. - LSL_BRACKET_CLOSE, // Inner to outer. - LSL_ANGLE_OPEN, - LSL_ANGLE_CLOSE, - LSL_TYPECAST, // Right to left. - LSL_BIT_NOT, // Right to left. - LSL_BOOL_NOT, // Right to left. - LSL_NEGATION, // Right to left. - LSL_DIVIDE, - LSL_MODULO, - LSL_MULTIPLY, - LSL_DOT_PRODUCT, - LSL_CROSS_PRODUCT, - LSL_SUBTRACT, - LSL_ADD, - LSL_CONCATENATE, - LSL_LEFT_SHIFT, - LSL_RIGHT_SHIFT, - LSL_LESS_THAN, - LSL_GREATER_THAN, - LSL_LESS_EQUAL, - LSL_GREATER_EQUAL, - LSL_EQUAL, - LSL_NOT_EQUAL, - LSL_BIT_AND, - LSL_BIT_XOR, - LSL_BIT_OR, - LSL_BOOL_OR, - LSL_BOOL_AND, - - // The rest are not operater types. - - LSL_SPACE, - LSL_COMMENT, - LSL_TYPE, - LSL_NAME, - LSL_IDENTIFIER, - LSL_FLOAT, - LSL_INTEGER, - LSL_STRING, - LSL_KEY, - LSL_VECTOR, - LSL_ROTATION, - LSL_LIST, - LSL_LABEL, - LSL_EXPRESSION, - LSL_DO, - LSL_FOR, - LSL_IF, - LSL_ELSE, - LSL_ELSEIF, - LSL_JUMP, - LSL_STATE_CHANGE, - LSL_WHILE, - LSL_RETURN, - LSL_STATEMENT, - LSL_BLOCK, - LSL_PARAMETER, - LSL_FUNCTION, - LSL_STATE, - LSL_SCRIPT, - LSL_UNKNOWN -} LSL_Type; -#else typedef int LSL_Type; -#endif typedef struct { -- cgit v1.1