aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/LuaSL/LuaSL_LSL_tree.h3
-rw-r--r--src/LuaSL/LuaSL_compile.c11
-rw-r--r--src/LuaSL/LuaSL_lemon_yaccer.y3
-rw-r--r--src/LuaSL/LuaSL_lexer.l2
4 files changed, 16 insertions, 3 deletions
diff --git a/src/LuaSL/LuaSL_LSL_tree.h b/src/LuaSL/LuaSL_LSL_tree.h
index 3b0a6d5..dd15bed 100644
--- a/src/LuaSL/LuaSL_LSL_tree.h
+++ b/src/LuaSL/LuaSL_LSL_tree.h
@@ -144,7 +144,8 @@ typedef enum
144 MF_POSTDEC = 64, 144 MF_POSTDEC = 64,
145 MF_POSTINC = 128, 145 MF_POSTINC = 128,
146 MF_LSLCONST = 256, 146 MF_LSLCONST = 256,
147 MF_TYPECAST = 512 147 MF_TYPECAST = 512,
148 MF_MSTRING = 1024
148} miscFlags; 149} miscFlags;
149 150
150struct _allowedTypes 151struct _allowedTypes
diff --git a/src/LuaSL/LuaSL_compile.c b/src/LuaSL/LuaSL_compile.c
index 9d6834d..ecc61bd 100644
--- a/src/LuaSL/LuaSL_compile.c
+++ b/src/LuaSL/LuaSL_compile.c
@@ -105,6 +105,7 @@ LSL_Token LSL_Tokens[] =
105 {LSL_KEY, ST_NONE, "key", LSL_NONE, outputStringToken}, 105 {LSL_KEY, ST_NONE, "key", LSL_NONE, outputStringToken},
106 {LSL_LIST, ST_NONE, "list", LSL_NONE, outputListToken}, 106 {LSL_LIST, ST_NONE, "list", LSL_NONE, outputListToken},
107 {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, outputListToken}, 107 {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, outputListToken},
108 {LSL_MSTRING, ST_NONE, "string", LSL_NONE, outputStringToken},
108 {LSL_STRING, ST_NONE, "string", LSL_NONE, outputStringToken}, 109 {LSL_STRING, ST_NONE, "string", LSL_NONE, outputStringToken},
109 {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, outputListToken}, 110 {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, outputListToken},
110 111
@@ -2184,7 +2185,15 @@ static void outputStatementToken(FILE *file, outputMode mode, LSL_Leaf *content)
2184static void outputStringToken(FILE *file, outputMode mode, LSL_Leaf *content) 2185static void outputStringToken(FILE *file, outputMode mode, LSL_Leaf *content)
2185{ 2186{
2186 if (content) 2187 if (content)
2187 fprintf(file, "%s", content->value.stringValue); // The quotes are part of the string value already. 2188 {
2189 if (MF_MSTRING & content->flags)
2190 {
2191 // TODO - LSL might ignore leading spaces in later lines, but does Lua?
2192 fprintf(file, "[=[%.*s]=]", (int) strlen(content->value.stringValue) - 2, &content->value.stringValue[1]);
2193 }
2194 else
2195 fprintf(file, "%s", content->value.stringValue); // The quotes are part of the string value already.
2196 }
2188} 2197}
2189 2198
2190boolean compilerSetup(gameGlobals *ourGlobals) 2199boolean compilerSetup(gameGlobals *ourGlobals)
diff --git a/src/LuaSL/LuaSL_lemon_yaccer.y b/src/LuaSL/LuaSL_lemon_yaccer.y
index 5ddf45a..9d507c9 100644
--- a/src/LuaSL/LuaSL_lemon_yaccer.y
+++ b/src/LuaSL/LuaSL_lemon_yaccer.y
@@ -216,7 +216,8 @@ expr(A) ::= LSL_BRACKET_OPEN(L) exprList(E) LSL_BRACKET_CLOSE(R). [LSL_BRACKET_O
216%nonassoc LSL_ROTATION LSL_VECTOR. 216%nonassoc LSL_ROTATION LSL_VECTOR.
217// Uses the same symbol for less than, greater than, and the rotation / vector delimiters. 217// Uses the same symbol for less than, greater than, and the rotation / vector delimiters.
218expr(A) ::= LSL_LESS_THAN(L) exprList(E) LSL_GREATER_THAN(R). [LSL_ANGLE_OPEN] { A = addRotVec(L, E, R); } 218expr(A) ::= LSL_LESS_THAN(L) exprList(E) LSL_GREATER_THAN(R). [LSL_ANGLE_OPEN] { A = addRotVec(L, E, R); }
219%nonassoc LSL_STRING. 219%nonassoc LSL_MSTRING LSL_STRING.
220expr(A) ::= LSL_MSTRING(B). { B->basicType = OT_string; B->flags |= MF_MSTRING; A = B; }
220expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; } 221expr(A) ::= LSL_STRING(B). { B->basicType = OT_string; A = B; }
221 222
222 223
diff --git a/src/LuaSL/LuaSL_lexer.l b/src/LuaSL/LuaSL_lexer.l
index 9d58899..248ba3e 100644
--- a/src/LuaSL/LuaSL_lexer.l
+++ b/src/LuaSL/LuaSL_lexer.l
@@ -27,6 +27,7 @@ IDENTIFIER (_|[[:alpha:]])(_|[[:alpha:]]|[[:digit:]])*
27CHAR '(\\.|[^\\'\n])+' 27CHAR '(\\.|[^\\'\n])+'
28KEY \"{HEX}{8}-{HEX}{4}-{HEX}{4}-{HEX}{4}-{HEX}{12}\" 28KEY \"{HEX}{8}-{HEX}{4}-{HEX}{4}-{HEX}{4}-{HEX}{12}\"
29STRING \"(\\.|[^\\"\n])*\" 29STRING \"(\\.|[^\\"\n])*\"
30MSTRING \"(\\.|[^\\"])*\"
30 31
31%% 32%%
32 33
@@ -109,6 +110,7 @@ STRING \"(\\.|[^\\"\n])*\"
109{FLOAT} %{ yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_FLOAT); %} 110{FLOAT} %{ yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_FLOAT); %}
110{KEY} %{ yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_KEY); %} 111{KEY} %{ yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_KEY); %}
111{STRING} %{ yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_STRING); %} 112{STRING} %{ yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_STRING); %}
113{MSTRING} %{ yylval->value.stringValue = eina_stringshare_add_length(yytext, yyleng); return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_MSTRING); %}
112 114
113<<EOF>> { return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_SCRIPT); } 115<<EOF>> { return common(yylval, yytext, yyleng, yyextra, TRUE, LSL_SCRIPT); }
114 116