]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
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 d8a684525a4c6c655d2047dd9d90a573337ea94c..07ab851b4258f8a2a8ed26d3af984d5e73359de0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+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
index 415607e9bd5be6ab7e2665ab30da38c915b55e2e..c29ca8f8145109294be2dd5562f9f98193d3486c 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;
          }
        ;