+/* Concat string */
+res_unicode_string_concat:
+ res_unicode_string
+ {
+ $$ = $1;
+ }
+ |
+ res_unicode_string_concat res_unicode_string
+ {
+ rc_uint_type l1 = unichar_len ($1);
+ rc_uint_type l2 = unichar_len ($2);
+ unichar *h = (unichar *) res_alloc ((l1 + l2 + 1) * sizeof (unichar));
+ if (l1 != 0)
+ memcpy (h, $1, l1 * sizeof (unichar));
+ if (l2 != 0)
+ memcpy (h + l1, $2, l2 * sizeof (unichar));
+ h[l1 + l2] = 0;
+ $$ = h;
+ }
+ ;
+
+res_unicode_string:
+ QUOTEDUNISTRING
+ {
+ $$ = unichar_dup ($1);
+ }
+ | QUOTEDSTRING
+ {
+ unichar *h = NULL;
+ unicode_from_ascii ((rc_uint_type *) NULL, &h, $1);
+ $$ = h;
+ }
+ ;
+
+res_unicode_sizedstring:
+ sizedunistring
+ {
+ $$ = $1;
+ }
+ | sizedstring
+ {
+ unichar *h = NULL;
+ rc_uint_type l = 0;
+ unicode_from_ascii_len (&l, &h, $1.s, $1.length);
+ $$.s = h;
+ $$.length = l;
+ }
+ ;
+
+/* Concat string */
+res_unicode_sizedstring_concat:
+ res_unicode_sizedstring
+ {
+ $$ = $1;
+ }
+ |
+ res_unicode_sizedstring_concat res_unicode_sizedstring
+ {
+ rc_uint_type l1 = $1.length;
+ rc_uint_type l2 = $2.length;
+ unichar *h = (unichar *) res_alloc ((l1 + l2 + 1) * sizeof (unichar));
+ if (l1 != 0)
+ memcpy (h, $1.s, l1 * sizeof (unichar));
+ if (l2 != 0)
+ memcpy (h + l1, $2.s, l2 * sizeof (unichar));
+ h[l1 + l2] = 0;
+ $$.length = l1 + l2;
+ $$.s = h;
+ }
+ ;
+
+sizedstring:
+ SIZEDSTRING
+ {
+ $$ = $1;
+ }
+ | sizedstring SIZEDSTRING
+ {
+ rc_uint_type l = $1.length + $2.length;
+ char *h = (char *) res_alloc (l);
+ memcpy (h, $1.s, $1.length);
+ memcpy (h + $1.length, $2.s, $2.length);
+ $$.s = h;
+ $$.length = l;
+ }
+ ;
+
+sizedunistring:
+ SIZEDUNISTRING
+ {
+ $$ = $1;
+ }
+ | sizedunistring SIZEDUNISTRING
+ {
+ rc_uint_type l = $1.length + $2.length;
+ unichar *h = (unichar *) res_alloc (l * sizeof (unichar));
+ memcpy (h, $1.s, $1.length * sizeof (unichar));
+ memcpy (h + $1.length, $2.s, $2.length * sizeof (unichar));
+ $$.s = h;
+ $$.length = l;
+ }
+ ;
+