From f45e1dde5cc9eb67a7891fae5ebe8b38dcef0c97 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 17 Jan 2012 14:15:07 +1000 Subject: Only need one of each in the value union. --- LuaSL/src/LuaSL_LSL_tree.h | 27 ++++----------------------- LuaSL/src/LuaSL_compile.c | 8 ++++---- LuaSL/src/LuaSL_lexer.l | 2 +- 3 files changed, 9 insertions(+), 28 deletions(-) (limited to 'LuaSL') diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 626d005..e179295 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h @@ -183,39 +183,20 @@ struct _LSL_Leaf opType basicType; union { - opType operationValue; - LSL_Parenthesis *parenthesis; - float floatValue; + float vectorValue[3]; + float rotationValue[4]; int integerValue; - char *keyValue; LSL_Leaf *listValue; const char *stringValue; - float vectorValue[3]; - float rotationValue[4]; - + opType operationValue; + LSL_Parenthesis *parenthesis; LSL_Identifier *identifierValue; - LSL_Identifier *variableValue; - - const char *labelValue; - LSL_Statement *doValue; - LSL_Statement *forValue; - LSL_Statement *elseIfValue; - LSL_Statement *elseValue; - LSL_Statement *ifValue; - const char *jumpValue; - LSL_Statement *returnValue; - const char *stateChangeValue; - LSL_Statement *whileValue; LSL_Statement *statementValue; - LSL_Block *blockValue; - LSL_Identifier *parameterValue; LSL_Function *functionValue; LSL_State *stateValue; LSL_Script *scriptValue; - - const char *unknownValue; } value; }; diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index e54e0e6..3a9a6c4 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -298,7 +298,7 @@ LSL_Leaf *addParameter(LSL_Leaf *type, LSL_Leaf *identifier) if ( (identifier) && (result)) { result->name = identifier->value.stringValue; - identifier->value.variableValue = result; + identifier->value.identifierValue = result; identifier->token = tokens[LSL_PARAMETER - lowestToken]; identifier->left = type; if (type) @@ -436,7 +436,7 @@ LSL_Leaf *addVariable(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi if ( (identifier) && (result)) { result->name = identifier->value.stringValue; - identifier->value.variableValue = result; + identifier->value.identifierValue = result; identifier->left = type; identifier->right = assignment; if (assignment) @@ -822,7 +822,7 @@ static void outputIntegerToken(FILE *file, outputMode mode, LSL_Leaf *content) static void outputParameterToken(FILE *file, outputMode mode, LSL_Leaf *content) { if (content) - fprintf(file, "%s", content->value.parameterValue->name); + fprintf(file, "%s", content->value.identifierValue->name); } static void outputParameterListToken(FILE *file, outputMode mode, LSL_Leaf *content) @@ -866,7 +866,7 @@ static void outputStatementToken(FILE *file, outputMode mode, LSL_Leaf *content) static void outputVariableToken(FILE *file, outputMode mode, LSL_Leaf *content) { if (content) - fprintf(file, "%s", content->value.variableValue->name); + fprintf(file, "%s", content->value.identifierValue->name); } static void doneParsing(LuaSL_compiler *compiler) diff --git a/LuaSL/src/LuaSL_lexer.l b/LuaSL/src/LuaSL_lexer.l index 68d0b43..9c90ed5 100644 --- a/LuaSL/src/LuaSL_lexer.l +++ b/LuaSL/src/LuaSL_lexer.l @@ -109,7 +109,7 @@ STRING \"(\\.|[^\\"\n])*\" <> { return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_SCRIPT); } /* Everything else */ -. %{ printf(" unexpected character.\n"); yylval->value.unknownValue = eina_stringshare_add_length(yytext, yyleng); common(yylval, yytext, yyleng, yyextra, TRUE, LSL_UNKNOWN); %} +. %{ printf(" unexpected character.\n"); yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); common(yylval, yytext, yyleng, yyextra, TRUE, LSL_UNKNOWN); %} %% -- cgit v1.1