From: Bruno Haible Date: Fri, 1 Oct 2004 12:13:35 +0000 (+0000) Subject: Fix a small Perl parsing bug. X-Git-Tag: v0.14.2~222 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b360474ca43ff459ee6fe4c8e6d38aa81f19cecf;p=thirdparty%2Fgettext.git Fix a small Perl parsing bug. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 5d070aa40..779062d67 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,8 @@ +2004-10-01 Guido Flohr + + * x-perl.c (x_perl_prelex): Recognize function names starting with '-'. + Reported by Ryan Anderson . + 2004-09-16 Bruno Haible * format.h (formatstring_error_logger_t): Modify decl for GCC <= 3.0. diff --git a/gettext-tools/src/x-perl.c b/gettext-tools/src/x-perl.c index 9fe5b8192..b17315a5b 100644 --- a/gettext-tools/src/x-perl.c +++ b/gettext-tools/src/x-perl.c @@ -1,5 +1,5 @@ /* xgettext Perl backend. - Copyright (C) 2002-2003 Free Software Foundation, Inc. + Copyright (C) 2002-2004 Free Software Foundation, Inc. This file was written by Guido Flohr , 2002-2003. @@ -2459,6 +2459,13 @@ x_perl_prelex (message_list_ty *mlp, token_ty *tp) tp->type = token_type_dereference; return; } + else if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) + { + /* One of the -X (filetest) functions. We play safe + and accept all alphabetical characters here. */ + tp->type = token_type_other; + return; + } phase1_ungetc (c); tp->type = token_type_other; prefer_division_over_regexp = false; diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index db69d239e..a0bdde354 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,3 +1,8 @@ +2004-10-01 Guido Flohr + + * xgettext-perl-4: Add test case with '-s' function. + Reported by Ryan Anderson . + 2004-09-11 Bruno Haible * msginit-1: New file. diff --git a/gettext-tools/tests/xgettext-perl-4 b/gettext-tools/tests/xgettext-perl-4 index 8a00ece76..2dae75cda 100755 --- a/gettext-tools/tests/xgettext-perl-4 +++ b/gettext-tools/tests/xgettext-perl-4 @@ -44,6 +44,11 @@ print "@{[hello_func]} world!\n"; print `ls $0`; print qx;ls $0;; +if (!defined($size = -s $filename)) { + # The above s is part of the function -s, not + # the substitution operator! +} + # The rest requires a Unicode aware Perl. require 5.006; print "\U\x70\LO\154\x{69}\x{004E}a \Q\lRu\LLeS\E\041\n";