From 8fb26357f9fed5decc48aa5a7868688a3dd449fd Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 31 Jan 2012 15:44:13 +1000 Subject: Output string tokens. --- LuaSL/src/LuaSL_compile.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/LuaSL/src/LuaSL_compile.c b/LuaSL/src/LuaSL_compile.c index 00f41da..c01529a 100644 --- a/LuaSL/src/LuaSL_compile.c +++ b/LuaSL/src/LuaSL_compile.c @@ -17,6 +17,7 @@ static void outputParameterListToken(FILE *file, outputMode mode, LSL_Leaf *cont static void outputParenthesisToken(FILE *file, outputMode mode, LSL_Leaf *content); static void outputStateToken(FILE *file, outputMode mode, LSL_Leaf *content); static void outputStatementToken(FILE *file, outputMode mode, LSL_Leaf *content); +static void outputStringToken(FILE *file, outputMode mode, LSL_Leaf *content); LSL_Token LSL_Tokens[] = { @@ -99,10 +100,10 @@ LSL_Token LSL_Tokens[] = // Types. {LSL_FLOAT, ST_NONE, "float", LSL_NONE, outputFloatToken, evaluateFloatToken}, {LSL_INTEGER, ST_NONE, "integer", LSL_NONE, outputIntegerToken, evaluateIntegerToken}, - {LSL_KEY, ST_NONE, "key", LSL_NONE, NULL, NULL}, + {LSL_KEY, ST_NONE, "key", LSL_NONE, outputStringToken, NULL}, {LSL_LIST, ST_NONE, "list", LSL_NONE, NULL, NULL}, {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, NULL, NULL}, - {LSL_STRING, ST_NONE, "string", LSL_NONE, NULL, NULL}, + {LSL_STRING, ST_NONE, "string", LSL_NONE, outputStringToken, NULL}, {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, NULL, NULL}, // Types names. @@ -1460,6 +1461,12 @@ static void outputText(FILE *file, LSL_Text *text, boolean ignore) } } +static void outputBlockToken(FILE *file, outputMode mode, LSL_Leaf *content) +{ + if (content) + outputRawBlock(file, mode, content->value.blockValue); +} + static void outputFloatToken(FILE *file, outputMode mode, LSL_Leaf *content) { if (content) @@ -1560,10 +1567,10 @@ static void outputStatementToken(FILE *file, outputMode mode, LSL_Leaf *content) outputRawStatement(file, mode, content->value.statementValue); } -static void outputBlockToken(FILE *file, outputMode mode, LSL_Leaf *content) +static void outputStringToken(FILE *file, outputMode mode, LSL_Leaf *content) { if (content) - outputRawBlock(file, mode, content->value.blockValue); + fprintf(file, "%s", content->value.stringValue); // The quotes are part of the string value already. } static boolean doneParsing(LuaSL_compiler *compiler) -- cgit v1.1