diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-09-24 10:50:23 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-09-24 10:50:23 -0700 |
commit | 0c3e395cc17fd7d2587c1a17325ca0af66443e33 (patch) | |
tree | 6ca3b9eca2710c04412f1ba2705fbe98459c3518 | |
parent | fc565dd3627660c8d6184bc2dcb9a33aaa52e74b (diff) | |
download | nasm-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-x | tokhash.pl | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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"); |