From cfd9edae2557192c5de95ec3336a496874377068 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 30 Jan 2012 18:56:12 +1000 Subject: Track function type ignorable, and no need to store the leaf. --- LuaSL/src/LuaSL_LSL_tree.h | 2 +- LuaSL/src/LuaSL_compile.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'LuaSL') diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h index 561a2ff..104ba45 100644 --- a/LuaSL/src/LuaSL_LSL_tree.h +++ b/LuaSL/src/LuaSL_LSL_tree.h @@ -256,7 +256,7 @@ struct _LSL_Block struct _LSL_Function { LSL_Text name; - LSL_Leaf *type; + LSL_Text type; #if LUASL_DIFF_CHECK // LSL_Leaf *params; // So we store the parenthesis, and their ignorables. // This points to the params leaf, which is a function, pointing to this structure. The actual params are in vars. diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 7745f93..b10ae07 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -539,9 +539,12 @@ LSL_Leaf *addFunction(LuaSL_compiler *compiler, LSL_Leaf *type, LSL_Leaf *identi func->name.ignorableText = identifier->ignorableText; identifier->toKen = tokens[LSL_FUNCTION - lowestToken]; identifier->value.functionValue = func; - func->type = type; if (type) + { + func->type.text = type->toKen->toKen; + func->type.ignorableText = type->ignorableText; identifier->basicType = type->basicType; + } else identifier->basicType = OT_nothing; eina_hash_add(compiler->script.functions, func->name.text, identifier); @@ -1227,9 +1230,8 @@ static void outputFunctionToken(FILE *file, outputMode mode, LSL_Leaf *content) LSL_Leaf *param = NULL; int first = TRUE; - outputLeaf(file, mode, func->type); + outputText(file, &(func->type), !(LSL_NOIGNORE & content->toKen->flags)); outputText(file, &(func->name), !(LSL_NOIGNORE & content->toKen->flags)); -// fprintf(file, "%s(", func->name); // TODO - should print comma and parenthesis ignorables. fprintf(file, "("); EINA_INARRAY_FOREACH((&(func->vars)), param) -- cgit v1.1