summaryrefslogtreecommitdiff
path: root/gobject-introspection
diff options
context:
space:
mode:
authorJuerg Billeter <j@bitron.ch>2007-11-27 19:48:54 +0000
committerJürg Billeter <juergbi@src.gnome.org>2007-11-27 19:48:54 +0000
commit815f47ef3075e9cae6f7dbdd283c3d19bd90d198 (patch)
tree3197f94f08dd64027f6830cec165509dd8a8082b /gobject-introspection
parente8c021302450c3a0016597510e1b60c38da057cf (diff)
downloadvala-815f47ef3075e9cae6f7dbdd283c3d19bd90d198.tar.gz
concatenate adjacent string literal tokens
2007-11-27 Juerg Billeter <j@bitron.ch> * gobject-introspection/cparser.y: concatenate adjacent string literal tokens svn path=/trunk/; revision=726
Diffstat (limited to 'gobject-introspection')
-rw-r--r--gobject-introspection/cparser.y23
1 files changed, 20 insertions, 3 deletions
diff --git a/gobject-introspection/cparser.y b/gobject-introspection/cparser.y
index 415607e9b..c29ca8f81 100644
--- a/gobject-introspection/cparser.y
+++ b/gobject-introspection/cparser.y
@@ -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;
}
;