+2014-12-01 Daiki Ueno <ueno@gnu.org>
+
+ c#: Recognize Unicode surrogate character pair
+ * x-csharp.c (accumulate_escaped): Change the first argument type
+ from 'struct string_buffer *' to 'struct mixed_string_buffer *',
+ for Unicode surrogate character pair handling; all callers
+ changed. Reported by Petr Kadlec at:
+ <https://savannah.gnu.org/bugs/?32505>.
+
2014-11-28 Daiki Ueno <ueno@gnu.org>
* msgfilter.c (prepare_read): Simplify the last commit 06e206f5,
/* Read a regular string literal or character literal.
See ECMA-334 sections 9.4.4.4., 9.4.4.5. */
static void
-accumulate_escaped (struct string_buffer *literal, int delimiter)
+accumulate_escaped (struct mixed_string_buffer *literal, int delimiter)
{
int c;
}
if (c == '\\')
c = do_getc_escaped ();
- string_buffer_append_unicode (literal, c);
+ if (literal)
+ mixed_string_buffer_append_unicode (literal, c);
}
}
case '"':
/* Regular string literal. */
{
- struct string_buffer literal;
+ struct mixed_string_buffer *literal;
lexical_context = lc_string;
- init_string_buffer (&literal);
- accumulate_escaped (&literal, '"');
- tp->string = xstrdup (string_buffer_result (&literal));
- free_string_buffer (&literal);
+ literal = mixed_string_buffer_alloc (lexical_context,
+ logical_file_name,
+ logical_line_number);
+ accumulate_escaped (literal, '"');
+ tp->string = mixed_string_buffer_done (literal);
tp->comment = add_reference (savable_comment);
lexical_context = lc_outside;
tp->type = token_type_string_literal;
case '\'':
/* Character literal. */
{
- struct string_buffer literal;
-
- init_string_buffer (&literal);
- accumulate_escaped (&literal, '\'');
- free_string_buffer (&literal);
+ accumulate_escaped (NULL, '\'');
tp->type = token_type_other;
return;
}