From b1657be3e0236a29562c0a261a9d2a515e117c45 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 30 Apr 2014 17:29:04 +0900 Subject: scheme: Recognize GIMP script-fu extension _"abc" * gettext-tools/src/x-scheme.c (read_object): Recognize _"abc". --- gettext-tools/src/ChangeLog | 5 +++++ gettext-tools/src/x-scheme.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'gettext-tools/src') diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 98a425f..c7c953f 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,5 +1,10 @@ 2014-04-30 Daiki Ueno + scheme: Recognize GIMP script-fu extension _"abc" + * x-scheme.c (read_object): Recognize _"abc". + +2014-04-30 Daiki Ueno + format-python-brace: Limit acceptable format specifiers Problem reported by Kovid Goyal at: . diff --git a/gettext-tools/src/x-scheme.c b/gettext-tools/src/x-scheme.c index 1ddcb2d..361156a 100644 --- a/gettext-tools/src/x-scheme.c +++ b/gettext-tools/src/x-scheme.c @@ -682,6 +682,7 @@ read_object (struct object *op, flag_context_ty outer_context) for (;;) { int c = do_getc (); + bool seen_underscore_prefix = false; switch (c) { @@ -1167,6 +1168,33 @@ read_object (struct object *op, flag_context_ty outer_context) abort (); } + case '_': + /* GIMP script-fu extension: '_' before a string literal is + considered a gettext call on the string. */ + { + int c = do_getc (); + if (c == EOF) + /* Invalid input. Be tolerant, no error message. */ + { + op->type = t_other; + return; + } + if (c != '"') + { + do_ungetc (c); + + /* If '_' is not followed by a string literal, + consider it a part of symbol. */ + op->token = XMALLOC (struct token); + read_token (op->token, '_'); + op->type = t_symbol; + last_non_comment_line = line_number; + return; + } + seen_underscore_prefix = true; + } + /*FALLTHROUGH*/ + case '"': { op->token = XMALLOC (struct token); @@ -1220,7 +1248,7 @@ read_object (struct object *op, flag_context_ty outer_context) } op->type = t_string; - if (extract_all) + if (seen_underscore_prefix || extract_all) { lex_pos_ty pos; -- cgit v1.1