summaryrefslogtreecommitdiff
path: root/macros.pl
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-06-19 16:17:41 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-06-19 16:17:41 -0700
commit435d55b34422c74af8050da4152fd9dd79bc5848 (patch)
tree21b468fdc2667fb9a6eeb7a21630b3f517d77231 /macros.pl
parente21ede9c76fbf10394d3c7cfdb944b24e76cbaf2 (diff)
downloadnasm-435d55b34422c74af8050da4152fd9dd79bc5848.tar.gz
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-xmacros.pl10
1 files changed, 5 insertions, 5 deletions
diff --git a/macros.pl b/macros.pl
index 2c6c1d10..b3084fcb 100755
--- a/macros.pl
+++ b/macros.pl
@@ -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);