tokhash: allow a bit smarter pattern matching

Allow constants to match only part of the token string.
This commit is contained in:
H. Peter Anvin 2007-09-24 10:50:23 -07:00
parent fc565dd362
commit 0c3e395cc1

View file

@ -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");