From 21bcc5ba96159d9b00d59e92ffc16078a0f4c4ed Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 2 Feb 2012 12:59:47 +1000 Subject: Partially implement parsing/outputting rotations and vectors. --- LuaSL/src/LuaSL_compile.c | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'LuaSL/src/LuaSL_compile.c') diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 2d5878f..cf9d767 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -104,9 +104,9 @@ LSL_Token LSL_Tokens[] = {LSL_INTEGER, ST_NONE, "integer", LSL_NONE, outputIntegerToken, evaluateIntegerToken}, {LSL_KEY, ST_NONE, "key", LSL_NONE, outputStringToken, NULL}, {LSL_LIST, ST_NONE, "list", LSL_NONE, outputListToken, NULL}, - {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, NULL, NULL}, + {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, outputListToken, NULL}, {LSL_STRING, ST_NONE, "string", LSL_NONE, outputStringToken, NULL}, - {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, NULL, NULL}, + {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, outputListToken, NULL}, // Types names. {LSL_TYPE_FLOAT, ST_NONE, "float", LSL_NONE, NULL, NULL}, @@ -724,6 +724,18 @@ LSL_Leaf *addList(LSL_Leaf *left, LSL_Leaf *list, LSL_Leaf *right) return left; } +LSL_Leaf *addRotVec(LSL_Leaf *left, LSL_Leaf *list, LSL_Leaf *right) +{ + LSL_Type type = LSL_ROTATION; + opType otype = OT_rotation; + + // TODO - count the members of list to see if it's a vector. + left = addParenthesis(left, list, type, right); + left->toKen = tokens[type - lowestToken]; + left->basicType = otype; + return left; +} + LSL_Leaf *addNumby(LSL_Leaf *numby) { LSL_Numby *num = calloc(1, sizeof(LSL_Numby)); @@ -1820,18 +1832,30 @@ static void outputListToken(FILE *file, outputMode mode, LSL_Leaf *content) { LSL_FunctionCall *call = parens->contents->value.functionCallValue; LSL_Leaf *param = NULL; + const char *ig = ""; // TODO - should output it's own ignorable here. - fprintf(file, "["); + switch (parens->type) + { + case LSL_LIST : fprintf(file, "["); break; + case LSL_ROTATION : + case LSL_VECTOR : fprintf(file, "<"); + default : break; + } EINA_INARRAY_FOREACH((&(call->params)), param) { outputLeaf(file, mode, param); } #if LUASL_DIFF_CHECK - fprintf(file, "%s]", eina_strbuf_string_get(parens->rightIgnorable)); -#else - fprintf(file, "]"); + ig = eina_strbuf_string_get(parens->rightIgnorable); #endif + switch (parens->type) + { + case LSL_LIST : fprintf(file, "%s]", ig); break; + case LSL_ROTATION : + case LSL_VECTOR : fprintf(file, "%s>", ig); + default : break; + } } } } -- cgit v1.1