Invalid CODE attribute: bar(quax => &#"Foo")
The problem here is NOT the attribute itself. It should be just fine to
tokenise this normally. I get the following.
PPI::Document
PPI::Statement::Sub
PPI::Token::Bareword 'sub'
PPI::Token::Whitespace ' '
PPI::Token::Bareword 'foo'
PPI::Token::Whitespace ' '
PPI::Token::Operator ':'
PPI::Token::Whitespace ' '
PPI::Token::Bareword 'bar'
PPI::Structure ( ... ???
PPI::Statement
PPI::Token::Bareword 'foo'
PPI::Token::Whitespace ' '
PPI::Token::Operator '=>'
PPI::Token::Whitespace ' '
PPI::Token::Operator '&'
PPI::Token::Comment '#"Foo");'
PPI::Token::Whitespace '\n'
As far as I'm aware &#"Foo" is the problem, in that &# is not a valid
anything...
Am I wrong?
[CLAESJAC - Mon Mar 22 02:05:12 2004]:
Show quoted text> Hey,
>
> When perl encounters an attribute with arguments it only checks that (
> and ) nest properly.
>
> The code qq{sub foo : bar(quax => &#"Foo")} is valid and what's
> between the nested () will be passed as the data to the attribute
> handler.
>
> PPI::Tokenizer tokenizes the data part as
> bareword,whitespace,operator,whitespace,operator,comment.
>
> It would be really nice to introduce something like a
> PPI::Token::AttrData token that containts the attribute data incl. the
> parentheses.
>
> I suspect this is a tricky one =)
>
> Cheers
> Claes