PPI icon indicating copy to clipboard operation
PPI copied to clipboard

-1 parsing as number rather than operator and 1

Open moregan opened this issue 11 years ago • 0 comments

https://github.com/Perl-Critic/Perl-Critic/issues/500 is not happy with this "-1" parsing as a number rather than the operator '-' followed by the number 1:

ppidump '(1)-1'
                    PPI::Document
                      PPI::Statement
                        PPI::Structure::List    ( ... )
                          PPI::Statement::Expression
[    1,   2,   2 ]         PPI::Token::Number   '1'
[    1,   4,   4 ]     PPI::Token::Number       '-1'

However it's a different story with '+':

ppidump '(1)+1'
                    PPI::Document
                      PPI::Statement
                        PPI::Structure::List    ( ... )
                          PPI::Statement::Expression
[    1,   2,   2 ]         PPI::Token::Number   '1'
[    1,   4,   4 ]     PPI::Token::Operator     '+'
[    1,   5,   5 ]     PPI::Token::Number       '1'

moregan avatar Feb 20 '14 02:02 moregan