summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-24 10:50:23 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-24 10:50:23 -0700
commit0c3e395cc17fd7d2587c1a17325ca0af66443e33 (patch)
tree6ca3b9eca2710c04412f1ba2705fbe98459c3518
parentfc565dd3627660c8d6184bc2dcb9a33aaa52e74b (diff)
downloadnasm-0c3e395cc17fd7d2587c1a17325ca0af66443e33.tar.gz
nasm-0c3e395cc17fd7d2587c1a17325ca0af66443e33.tar.bz2
nasm-0c3e395cc17fd7d2587c1a17325ca0af66443e33.zip
tokhash: allow a bit smarter pattern matching
Allow constants to match only part of the token string.
-rwxr-xr-xtokhash.pl12
1 files changed, 12 insertions, 0 deletions
diff --git a/tokhash.pl b/tokhash.pl
index a63e55f..f45d07d 100755
--- a/tokhash.pl
+++ b/tokhash.pl
@@ -101,6 +101,18 @@ while (defined($line = <TD>)) {
$tokens{$token} = scalar @tokendata;
$data = $pattern;
+ if ($data =~ /^(.*)\{(.*)\}(.*)$/) {
+ my $head = $1, $tail = $3;
+ my $px = $2;
+
+ $px =~ s/\*/(.*)/g;
+ if ($token =~ /$px/i) {
+ $data = $head."\U$1".$tail;
+ } else {
+ die "$0: token $token doesn't match $px\n";
+ }
+ }
+
$data =~ s/\*/\U$token/g;
push(@tokendata, "\"$token\", $data");