Tolerate u or ull suffixes on tokens - GL_INVALID_INDEX, GL_TIMEOUT_IGNORED

This commit is contained in:
Nigel Stewart 2016-07-08 21:54:56 +10:00
parent 5505e52896
commit b3ff4606be
2 changed files with 19 additions and 7 deletions

View File

@ -10,7 +10,7 @@ my %regex = (
extname => qr/^[A-Z][A-Za-z0-9_]+$/, extname => qr/^[A-Z][A-Za-z0-9_]+$/,
exturl => qr/^http.+$/, exturl => qr/^http.+$/,
function => qr/^(.+) ([a-z][a-z0-9_]*) \((.+)\)$/i, function => qr/^(.+) ([a-z][a-z0-9_]*) \((.+)\)$/i,
token => qr/^([A-Z][A-Z0-9_x]*)\s+((?:0x)?[0-9A-Fa-f]+|[A-Z][A-Z0-9_]*)$/, token => qr/^([A-Z][A-Z0-9_x]*)\s+((?:0x)?[0-9A-Fa-f]+(u(ll)?)?|[A-Z][A-Z0-9_]*)$/,
type => qr/^typedef\s+(.+)$/, type => qr/^typedef\s+(.+)$/,
exact => qr/.*;$/, exact => qr/.*;$/,
); );

View File

@ -149,7 +149,7 @@ my %regex = (
prefix => qr/^(?:[aw]?gl|glX)/, # gl | agl | wgl | glX prefix => qr/^(?:[aw]?gl|glX)/, # gl | agl | wgl | glX
tprefix => qr/^(?:[AW]?GL|GLX)_/, # GL_ | AGL_ | WGL_ | GLX_ tprefix => qr/^(?:[AW]?GL|GLX)_/, # GL_ | AGL_ | WGL_ | GLX_
section => compile_regex('^(', join('|', @sections), ')$'), # sections in spec section => compile_regex('^(', join('|', @sections), ')$'), # sections in spec
token => qr/^([A-Z0-9][A-Z0-9_x]*):?\s+((?:0x)?[0-9A-Fa-f]+)(|\s[^\?]*)$/, # define tokens token => qr/^([A-Z0-9][A-Z0-9_x]*):?\s+((?:0x)?[0-9A-Fa-f]+(u(ll)?)?)(|\s[^\?]*)$/, # define tokens
types => compile_regex('\b(', join('|', keys %typemap), ')\b'), # var types types => compile_regex('\b(', join('|', keys %typemap), ')\b'), # var types
voidtype => compile_regex('\b(', keys %voidtypemap, ')\b '), # void type voidtype => compile_regex('\b(', keys %voidtypemap, ')\b '), # void type
); );
@ -352,6 +352,16 @@ foreach my $spec (sort @speclist)
} else { } else {
if (${$tokens}{$b} =~ /_/) { if (${$tokens}{$b} =~ /_/) {
1 1
} else {
if (${$tokens}{$a} =~ /u(ll)?$/) {
if (${$tokens}{$b} =~ /u(ll)?$/) {
$a cmp $b
} else {
-1
}
} else {
if (${$tokens}{$b} =~ /u(ll)?$/) {
1
} else { } else {
if (hex ${$tokens}{$a} eq hex ${$tokens}{$b}) if (hex ${$tokens}{$a} eq hex ${$tokens}{$b})
{ {
@ -362,6 +372,8 @@ foreach my $spec (sort @speclist)
} }
} }
} }
}
}
} keys %{$tokens}) } keys %{$tokens})
{ {
if ($token =~ /^$prefix\_.*/i) if ($token =~ /^$prefix\_.*/i)