/* xgettext Scheme backend.
- Copyright (C) 2004-2009, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2004-2009, 2011, 2015 Free Software Foundation, Inc.
This file was written by Bruno Haible <bruno@clisp.org>, 2004-2005.
{
const char *str = tp->chars;
int len = tp->charcount;
- int radix = 10;
enum { unknown, exact, inexact } exactness = unknown;
bool seen_radix_prefix = false;
bool seen_exactness_prefix = false;
case 'B': case 'b':
if (seen_radix_prefix)
return false;
- radix = 2;
seen_radix_prefix = true;
break;
case 'O': case 'o':
if (seen_radix_prefix)
return false;
- radix = 8;
seen_radix_prefix = true;
break;
case 'D': case 'd':
if (seen_radix_prefix)
return false;
- radix = 10;
seen_radix_prefix = true;
break;
case 'X': case 'x':
if (seen_radix_prefix)
return false;
- radix = 16;
seen_radix_prefix = true;
break;
case 'E': case 'e':
for (;;)
{
int c = do_getc ();
+ bool seen_underscore_prefix = false;
switch (c)
{
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);
}
op->type = t_string;
- if (extract_all)
+ if (seen_underscore_prefix || extract_all)
{
lex_pos_ty pos;