Cleaned up ending trim regex

Trim regex will now correctly match GetInteger64 and other functions
ending in "64". It also uses a correct ending anchor to avoid matches
in the middle of a function name.
This commit is contained in:
Stefanos A 2013-11-17 01:45:01 +01:00
parent fd910e6a6c
commit f8a81f396e

View file

@ -43,10 +43,15 @@ namespace Bind
class FuncProcessor
{
static readonly Regex Endings =
new Regex(@"((((d|f|fi)|(L?(u?i?64)?u?[isb]))_?(64)?v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft);
static readonly Regex EndingsNotToTrim =
new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Attrib|Access|Coord|Feedbacks|Flag|Queries|Tess|Status|Pixels|Instanced|Indexed|Varyings|Boolean|IDs|Uniforms)", RegexOptions.Compiled | RegexOptions.RightToLeft);
static readonly Regex Endings = new Regex(
@"([hfd]v?|u?[isb](64)?v?|v|i_v|fi)$",
RegexOptions.Compiled);
static readonly Regex EndingsNotToTrim = new Regex(
"([st]h|ib|[tdrey]s|[eE]n[vd]|bled" +
"|Attrib|Access|Boolean|Coord|Feedbacks|Finish|Flag" +
"|IDs|Indexed|Instanced|Pixels|Queries|Status|Tess|Uniforms|" +
"Varyings)$",
RegexOptions.Compiled);
static readonly Regex EndingsAddV = new Regex("^0", RegexOptions.Compiled);
string Overrides { get; set; }
@ -347,6 +352,9 @@ namespace Bind
string extension = d.Extension;
string trimmed_name = GetTrimmedExtension(name, extension);
if (name.Contains("GetInteger64"))
;//System.Diagnostics.Debugger.Break();
// Note: some endings should not be trimmed, for example: 'b' from Attrib.
// Check the endingsNotToTrim regex for details.
Match m = EndingsNotToTrim.Match(trimmed_name);