Skip to content

Commit 7eb7c1b

Browse files
moreganwchristian
authored andcommitted
Issue #50 - illusion of use of $1 after failed match
1 parent 18adbca commit 7eb7c1b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/PPI/Token/Prototype.pm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ sub __TOKENIZER__on_char {
6161

6262
# Suck in until we find the closing paren (or the end of line)
6363
pos $t->{line} = $t->{line_cursor};
64-
if ( $t->{line} =~ m/\G(.*?(?:\)|$))/gc ) {
65-
$t->{token}->{content} .= $1;
66-
$t->{line_cursor} += length $1;
67-
}
64+
die "regex should always match" if $t->{line} !~ m/\G(.*?(?:\)|$))/gc;
65+
$t->{token}->{content} .= $1;
66+
$t->{line_cursor} += length $1;
6867

6968
# Shortcut if end of line
7069
return 0 unless $1 =~ /\)$/;

0 commit comments

Comments
 (0)