concatenate adjacent string literal tokens
authorJuerg Billeter <j@bitron.ch>
Tue, 27 Nov 2007 19:48:54 +0000 (19:48 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Tue, 27 Nov 2007 19:48:54 +0000 (19:48 +0000)
2007-11-27  Juerg Billeter  <j@bitron.ch>

* gobject-introspection/cparser.y: concatenate adjacent string literal
  tokens

svn path=/trunk/; revision=726

ChangeLog
gobject-introspection/cparser.y

index d8a6845..07ab851 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2007-11-27  Jürg Billeter  <j@bitron.ch>
 
+       * gobject-introspection/cparser.y: concatenate adjacent string literal
+         tokens
+
+2007-11-27  Jürg Billeter  <j@bitron.ch>
+
        * vapi/glib-2.0.vapi: bind sscanf instead of scanf, add memcpy binding
 
 2007-11-27  Jürg Billeter  <j@bitron.ch>
index 415607e..c29ca8f 100644 (file)
@@ -133,6 +133,7 @@ static void csymbol_merge_type (CSymbol *symbol, CType *type)
 %type <unary_operator> unary_operator
 %type <str> function_macro
 %type <str> object_macro
+%type <symbol> strings
 
 %%
 
@@ -166,15 +167,31 @@ primary_expression
          {
                $$ = csymbol_new (CSYMBOL_TYPE_INVALID);
          }
-       | STRING
+       | strings
+       | '(' expression ')'
+         {
+               $$ = $2;
+         }
+       ;
+
+/* concatenate adjacent string literal tokens */
+strings
+       : STRING
          {
                $$ = csymbol_new (CSYMBOL_TYPE_CONST);
                yytext[strlen (yytext) - 1] = '\0';
                $$->const_string = g_strcompress (yytext + 1);
          }
-       | '(' expression ')'
+       | strings STRING
          {
-               $$ = $2;
+               char *strings, *string2;
+               $$ = $1;
+               yytext[strlen (yytext) - 1] = '\0';
+               string2 = g_strcompress (yytext + 1);
+               strings = g_strconcat ($$->const_string, string2, NULL);
+               g_free ($$->const_string);
+               g_free (string2);
+               $$->const_string = strings;
          }
        ;