Perl-Critic / PPI

53 stars 44 forks source link

whitespace not allowed between sigil and identifier #158

Open moregan opened 9 years ago

moregan commented 9 years ago

Perl allows whitespace between a sigil and its identifier, but PPI doesn't support it. @ foo is the same as @foo and should parse as PPI::Token::Symbol, but doesn't:

$ ppidump '@ foo'
                    PPI::Document
                      PPI::Statement
[    1,   1,   1 ]     PPI::Token::Cast         '@'
[    1,   3,   3 ]     PPI::Token::Word         'foo'
adamkennedy commented 9 years ago

There was a reason for this. I think I was trying to avoid the problem of dealing with the whitespace by treating it kind of like a fake soft reference. I.E. @{foo}

I felt at the time that the space was such a strange case that it wasn't worth supporting, and I don't recall encountering it more than once or twice ever in the wild.

A tinderbox search run over CPAN would confirm if anyone ever uses it.

Adam On Dec 31, 2014 5:18 PM, "moregan" notifications@github.com wrote:

Perl allows whitespace between a sigil and its identifier, but PPI doesn't support it. @ foo is the same as @foo and should parse as PPI::Token::Symbol, but doesn't:

$ ppidump '@ foo' PPI::Document PPI::Statement [ 1, 1, 1 ] PPI::Token::Cast '@' [ 1, 3, 3 ] PPI::Token::Word 'foo'

— Reply to this email directly or view it on GitHub https://github.com/adamkennedy/PPI/issues/158.

moregan commented 9 years ago

Had to go to backpan to find PPI::Tinderbox, and the latest there is 0.08. Was that the last release (January 2005)?

adamkennedy commented 9 years ago

Probably. There are other modern equivalents, I think dagolden has a cpan scanner and then I wrote a derivative of it. So it might have a different name On Jan 1, 2015 5:54 AM, "moregan" notifications@github.com wrote:

Had to go to backpan to find PPI::Tinderbox, and the latest there is 0.08. Was that the last release (January 2005)?

— Reply to this email directly or view it on GitHub https://github.com/adamkennedy/PPI/issues/158#issuecomment-68461760.