diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-06-19 16:17:41 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-06-19 16:17:41 -0700 |
commit | 435d55b34422c74af8050da4152fd9dd79bc5848 (patch) | |
tree | 21b468fdc2667fb9a6eeb7a21630b3f517d77231 /macros.pl | |
parent | e21ede9c76fbf10394d3c7cfdb944b24e76cbaf2 (diff) | |
download | nasm-435d55b34422c74af8050da4152fd9dd79bc5848.tar.gz nasm-435d55b34422c74af8050da4152fd9dd79bc5848.tar.bz2 nasm-435d55b34422c74af8050da4152fd9dd79bc5848.zip |
macros.pl: need to use $' to get proper left-to-right behaviour
Using ^(.*) means we do right-to-left search, since (.*) is a greedy
expression; instead use $' to get the lead-in part of the string.
Diffstat (limited to 'macros.pl')
-rwxr-xr-x | macros.pl | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -63,11 +63,11 @@ foreach $fname ( @ARGV ) { $s1 =~ s/\\/\\\\/g; $s1 =~ s/"/\\"/g; $s2 = ''; - while ($s1 =~ /^(.*)(\%[a-zA-Z_][a-zA-Z0-9_]*)((\s+)(.*)|)$/) { - $s2 .= $1; - $pd = $2; - $ws = $4; - $s1 = $5; + while ($s1 =~ /(\%[a-zA-Z_][a-zA-Z0-9_]*)((\s+)(.*)|)$/) { + $s2 .= "$'"; + $pd = $1; + $ws = $3; + $s1 = $4; if (defined($pptok_hash{$pd}) && $pptok_hash{$pd} <= 127) { $s2 .= sprintf("\\x%02x\"\"", $pptok_hash{$pd}+128); |