]> git.ipfire.org Git - thirdparty/gettext.git/commit
xgettext: C#: Recognize strings with embedded expressions.
authorBruno Haible <bruno@clisp.org>
Wed, 18 Sep 2024 15:00:04 +0000 (17:00 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 18 Sep 2024 15:00:04 +0000 (17:00 +0200)
commit4391a42f1540ad20aa6e1b7fdc87c8e0e79e34e6
treed01008e35184a58cdf6dbe7a140b1d3bade8c373
parent19b0053e3d4a0791c47d3f249a336c2a46892d96
xgettext: C#: Recognize strings with embedded expressions.

* gettext-tools/src/x-csharp.c (token_type_template, token_type_ltemplate,
token_type_mtemplate, token_type_rtemplate): New enum items.
(free_token): Treat token_type_template like token_type_string_literal.
(accumulate_escaped): Accept a second delimiter argument. Return the delimiter.
(template_literal_depth, brace_depths, brace_depths_alloc): New variables,
copied from x-javascript.c.
(new_brace_depth_level): New function, copied from x-javascript.c.
(phase6_get): Recognize strings with embedded expressions. Handle braces in a
nested manner.
(extract_parenthesized): Handle the token types token_type_template,
token_type_ltemplate, token_type_mtemplate, token_type_rtemplate.
(extract_csharp): Initialize template_literal_depth and call
new_brace_depth_level.
* gettext-tools/tests/xgettext-csharp-5: Add tests of strings with embedded
expressions.
* NEWS: Mention the change.
NEWS
gettext-tools/src/x-csharp.c
gettext-tools/tests/xgettext-csharp-5