Perl-Critic / PPI

53 stars 44 forks source link

sub name beginning with x and a number parsed as the x operator #122

Closed moregan closed 9 years ago

moregan commented 9 years ago

PPI 1.220:

ppidump 'sub x64 {}'
                    PPI::Document
                      PPI::Statement
[    1,   1,   1 ]     PPI::Token::Word     'sub'
[    1,   5,   5 ]     PPI::Token::Operator     'x'
[    1,   6,   6 ]     PPI::Token::Number   '64'
                        PPI::Structure::Block   { ... }

whereas something other than 'x' is find:

ppidump 'sub X64 {}'
                    PPI::Document
                      PPI::Statement::Sub
[    1,   1,   1 ]     PPI::Token::Word     'sub'
[    1,   5,   5 ]     PPI::Token::Word     'X64'
                        PPI::Structure::Block   { ... }
moregan commented 9 years ago

This is a regression between 1.215 and 1.218

moregan commented 9 years ago

also a regression:

ppidump 'package x64 {}'
                    PPI::Document
                      PPI::Statement::Package
[    1,   1,   1 ]     PPI::Token::Word         'package'
[    1,   9,   9 ]     PPI::Token::Operator     'x'
[    1,  10,  10 ]     PPI::Token::Number       '64'
                        PPI::Structure::Block   { ... }
moregan commented 9 years ago

also a regression:

ppidump 'LABEL: x64'
                    PPI::Document
                      PPI::Statement::Compound
[    1,   1,   1 ]     PPI::Token::Label        'LABEL:'
                      PPI::Statement
[    1,   8,   8 ]     PPI::Token::Operator     'x'
[    1,   9,   9 ]     PPI::Token::Number       '64'
wchristian commented 9 years ago

Split into 3 new commits, cleaned up a bit and pushed to master.

wchristian commented 7 years ago

Thanks, this has been cherry-picked and released. :)