Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 5746
Status: resolved
Worked: 5 hours (300 min)
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: claes [...] surfar.nu
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Attribute argument tokenization
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
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
OK then. After much reading, talking to lathos, and doing nasty things to the PPI code base, PPI::Token::Attribute objects are finally parsed correctly. Note the C<attribute> and C<parameters> method of attribute objects Fixed in 0.811, just uploaded. Feedback welcome