Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many operators/builtins not separated from following single quote #58

Closed
moregan opened this issue Mar 12, 2014 · 1 comment
Closed

Comments

@moregan
Copy link
Collaborator

moregan commented Mar 12, 2014

PPI::Token::Word has code to make sure that some operators/builtins (eq ne ge le gt lt q qq qx qw qr m s tr y pack unpack) are separated from an immediately-following single quote because that’s what perl does. E.g.: “ $foo eq’bar’ “ is parsed by PPI and by perl as a symbol, the eq operator, and a single-quoted string. However, there are many words that perl separates that PPI does not, e.g.: ‘cmp’:

ppidump "\$foo cmp'bar'"
                    PPI::Document
                      PPI::Statement
[    1,   1,   1 ]     PPI::Token::Symbol       '$foo'
[    1,   6,   6 ]     PPI::Token::Word         'cmp'bar'
[    1,  13,  13 ]     PPI::Token::Quote::Single        '''

There are dozens of words PPI::Token::Word doesn't handle in regen/keywords.pl of the perl sources. Presumably most (all?) of them should be handled.

See Perl-Critic/Perl-Critic#451 for a real-world example.

@wchristian
Copy link
Member

The full version of the fix for this is now released to CPAN as PPI 1.220.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants