Skip to content

Commit

Permalink
fix "x64" being parsed as x operator after a label
Browse files Browse the repository at this point in the history
  • Loading branch information
moregan committed Nov 17, 2014
1 parent 0eac65c commit a0b259e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/PPI/Tokenizer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ sub _current_x_is_operator {
&& (!$prev->isa('PPI::Token::Operator') || $X_CAN_FOLLOW_OPERATOR{$prev})
&& (!$prev->isa('PPI::Token::Structure') || $X_CAN_FOLLOW_STRUCTURE{$prev})
&& (!$prev->isa('PPI::Token::Word') || $X_CAN_FOLLOW_WORD{$prev})
&& !$prev->isa('PPI::Token::Label')
;
}

Expand Down
13 changes: 12 additions & 1 deletion t/ppi_token_operator.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ BEGIN {
$PPI::XS_DISABLE = 1;
$PPI::Lexer::X_TOKENIZER ||= $ENV{X_TOKENIZER};
}
use Test::More tests => 1125;
use Test::More tests => 1126;
use Test::NoWarnings;
use PPI;

Expand Down Expand Up @@ -409,6 +409,17 @@ OPERATOR_X: {
'PPI::Token::Structure' => '}',
]
},
{
desc => 'label plus x',
code => 'LABEL: x64',
expected => [
'PPI::Statement::Compound' => 'LABEL:',
'PPI::Token::Label' => 'LABEL:',
'PPI::Token::Whitespace' => ' ',
'PPI::Statement' => 'x64',
'PPI::Token::Word' => 'x64',
]
},
);

# Exhaustively test when a preceding operator implies following
Expand Down

0 comments on commit a0b259e

Please sign in to comment.