bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#386912: errors in the Perl parser of xgettext: invalid variable


From: Bruno Haible
Subject: Re: Bug#386912: errors in the Perl parser of xgettext: invalid variable interpolation at "$"
Date: Mon, 2 Oct 2006 14:30:16 +0200
User-agent: KMail/1.9.1

Guido Flohr wrote:
> The attached Perl script illustrates some of the problems. It defines 
> the function one_arg() that requires one argument, two_args() that 
> requires two_arguments(), list_args() requires one scalar argument plus 
> a (variable-size) list and var_args which just takes a (variable-size) 
> list. Actually var_args() and list_args() are equivalent.  All functions 
> just take their arguments and print them out. As you can see, even 
> identical argument lists produce different results, depending on the 
> signature of the called function.  Unfortunately, the signature of the 
> called function is mostly not visible, at least you can not rely on that.

Thanks a lot for this script. I made some more tests in this direction,
to understand the Perl argument parsing rules.

>       foo "bar", ("baz", "bazoo"), "ignored" <==> foo ("bar", "baz", "bazoo");

I don't understand what you mean here. According to my tests, if foo is
defined with a prototype (other than $@)

        foo "bar", ("baz", "bazoo"), "ignored"
        <==> foo ("bar", ("baz", "bazoo"), "ignored")

and if not, then

        foo "bar", ("baz", "bazoo"), "ignored"
        <==> foo ("bar", "baz", "bazoo", "ignored")

I.e. the last string argument is not ignored by the argument passing. (It
may be ignored by the function foo, though.)

Furthermore, if xgettext is passed the argument --keyword=foo:3, it will have
to extract the string "ignored" in the first case but the string "bazoo" in
the second case. One could make xgettext distinguish these cases according to
whether a "total argument count" is specified: --keyword=foo:3,3t versus
--keyword=foo:3. But currently, let's simply assume this weird case
doesn't occur.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]