Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : proto

Dir     : e17/proto/edje_cc


Modified Files:
        edje.l 


Log Message:
this should handle the "foo""bar" type stuff correctly

===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/edje.l,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -3 -r1.25 -r1.26
--- edje.l      12 Sep 2004 14:13:41 -0000      1.25
+++ edje.l      16 Sep 2004 05:37:21 -0000      1.26
@@ -66,12 +66,7 @@
     #define VAL_RETURN(x)   col += yyleng; \
                             if (!comment) return (x);
 
-    #define STRING_RETURN() yylval.string = (char *)malloc(yyleng - 1); \
-                            { \
-                                char *c = yytext; \
-                                snprintf(yylval.string, yyleng - 1, "%s", ++c); \
-                            } \
-                            VAL_RETURN(STRING);
+    #define STRING_RETURN() VAL_RETURN(STRING);
 
     #define FLOAT_RETURN()  yylval.val = atof(yytext); \
                             VAL_RETURN(FLOAT);
@@ -179,7 +174,30 @@
 visible                                { KEYWORD_RETURN(VISIBLE); }
 x                                      { KEYWORD_RETURN(X); }
 y                                      { KEYWORD_RETURN(Y); }
-(\"[^\"]*\")*       { STRING_RETURN(); }
+(\"[^\"]*\")*       {{ 
+                        char *tmp = NULL;
+                        int i = 0;
+
+                        yylval.string = (char *)calloc(yyleng - 1, sizeof(char));
+
+                        for(i = 0; i < yyleng; i++) {
+                            if (yytext[i] == '"') {
+                                if (tmp != NULL) {
+                                    yytext[i] = '\0';
+                                    strcat(yylval.string, tmp);
+                                    tmp = NULL;
+                                }
+                                continue;
+                            }
+
+                            if (tmp == NULL)
+                                tmp = yytext + i;
+                        }
+                        if (tmp != NULL)
+                            strcat(yylval.string, tmp);
+
+                        STRING_RETURN(); 
+                    }}
 {floating_constant} { FLOAT_RETURN(); }
 \+                                     { KEYWORD_RETURN(PLUS); }
 \-                                     { KEYWORD_RETURN(MINUS); }




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to