Skip to content

Commit a342f72

Browse files
moreganwchristian
authored andcommitted
Expand $'x to $::main::x
fixes # 159
1 parent ef72d8f commit a342f72

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

lib/PPI/Token/Symbol.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ variations.
6161
sub canonical {
6262
my $symbol = shift->content;
6363
$symbol =~ s/\s+//;
64-
$symbol =~ s/(?<=[\$\@\%\&\*])::/main::/;
6564
$symbol =~ s/\'/::/g;
65+
$symbol =~ s/(?<=[\$\@\%\&\*])::/main::/;
6666
$symbol;
6767
}
6868

t/ppi_token_symbol.t

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ TOKEN_FROM_PARSE: {
1717
parse_and_test( '$x[0]', { content => '$x', canonical => '$x', raw_type => '$', symbol_type => '@', symbol => '@x' } );
1818
parse_and_test( '$x{0}', { content => '$x', canonical => '$x', raw_type => '$', symbol_type => '%', symbol => '%x' } );
1919
parse_and_test( '$::x', { content => '$::x', canonical => '$main::x', raw_type => '$', symbol_type => '$', symbol => '$main::x' } );
20-
{
21-
local $ENV{TODO} = 'bug in canonical';
22-
parse_and_test( q{$'x}, { content => q{$'x}, canonical => '$main::x', raw_type => '$', symbol_type => '$', symbol => '$main::x' } );
23-
}
20+
parse_and_test( q{$'x}, { content => q{$'x}, canonical => '$main::x', raw_type => '$', symbol_type => '$', symbol => '$main::x' } );
2421

2522
parse_and_test( '@x', { content => '@x', canonical => '@x', raw_type => '@', symbol_type => '@', symbol => '@x' } );
2623
parse_and_test( '@x[0]', { content => '@x', canonical => '@x', raw_type => '@', symbol_type => '@', symbol => '@x' } );

0 commit comments

Comments
 (0)