diff options
author | Bruno Haible <bruno@clisp.org> | 2004-01-12 11:15:50 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:11:36 +0200 |
commit | 0bb8ba7319ed3c6e13ee9ccfd9fd1f25287d9139 (patch) | |
tree | 9734114ef801c063ceaea758a32ae3b18aaedb0b /gettext-tools/src/x-python.c | |
parent | 19062fd887e47f4618724f59842ab32bee1f2ae0 (diff) | |
download | external_gettext-0bb8ba7319ed3c6e13ee9ccfd9fd1f25287d9139.zip external_gettext-0bb8ba7319ed3c6e13ee9ccfd9fd1f25287d9139.tar.gz external_gettext-0bb8ba7319ed3c6e13ee9ccfd9fd1f25287d9139.tar.bz2 |
Improved handling of multi-part strings when there is a newline between
the parts of the string.
Diffstat (limited to 'gettext-tools/src/x-python.c')
-rw-r--r-- | gettext-tools/src/x-python.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gettext-tools/src/x-python.c b/gettext-tools/src/x-python.c index 3e2ced7..d2b6a85 100644 --- a/gettext-tools/src/x-python.c +++ b/gettext-tools/src/x-python.c @@ -240,7 +240,7 @@ comment_line_end () buffer = xrealloc (buffer, bufmax); } buffer[buflen] = '\0'; - xgettext_comment_add (buffer); + savable_comment_add (buffer); } /* These are for tracking whether comments count as immediately before @@ -322,6 +322,7 @@ struct token_ty { token_type_ty type; char *string; /* for token_type_string, token_type_symbol */ + refcounted_string_list_ty *comment; /* for token_type_string */ int line_number; }; @@ -696,7 +697,7 @@ phase5_get (token_ty *tp) case '\n': if (last_non_comment_line > last_comment_line) - xgettext_comment_reset (); + savable_comment_reset (); /* Ignore newline if and only if it is used for implicit line joining. */ if (open_pbb > 0) @@ -911,6 +912,7 @@ phase5_get (token_ty *tp) assert (q - utf8_string <= 3 * bufpos); tp->string = (char *) utf8_string; } + tp->comment = add_reference (savable_comment); tp->type = token_type_string; return; } @@ -1121,7 +1123,11 @@ extract_parenthesized (message_list_ty *mlp, pos.line_number = token.line_number; if (extract_all) - remember_a_message (mlp, token.string, inner_context, &pos); + { + savable_comment_to_xgettext_comment (token.comment); + remember_a_message (mlp, token.string, inner_context, &pos); + savable_comment_reset (); + } else { if (commas_to_skip == 0) @@ -1129,9 +1135,12 @@ extract_parenthesized (message_list_ty *mlp, if (plural_mp == NULL) { /* Seen an msgid. */ - message_ty *mp = - remember_a_message (mlp, token.string, - inner_context, &pos); + message_ty *mp; + + savable_comment_to_xgettext_comment (token.comment); + mp = remember_a_message (mlp, token.string, + inner_context, &pos); + savable_comment_reset (); if (plural_commas > 0) plural_mp = mp; } @@ -1147,6 +1156,7 @@ extract_parenthesized (message_list_ty *mlp, free (token.string); } } + drop_reference (token.comment); next_context_iter = null_context_list_iterator; state = 0; continue; |