Fixed bug in acronym capitalization handling, when multiple acronyms exist in the same enum.

This commit is contained in:
the_fiddler 2011-12-05 15:16:11 +00:00
parent 17974b6c7b
commit 687140323e
2 changed files with 3 additions and 2 deletions

View file

@ -101,9 +101,10 @@ namespace Bind
// Split on IHV names, to ensure that characters appearing after these name are uppercase.
var match = Utilities.Acronyms.Match(name);
int offset = 0; // Everytime we insert a match, we must increase offset to compensate.
while (match.Success)
{
int insert_pos = match.Index + match.Length;
int insert_pos = match.Index + match.Length + offset++;
translator.Insert(insert_pos, "_");
match = match.NextMatch();
}
@ -117,7 +118,6 @@ namespace Bind
// 4. if current char is lowercase, respect next char case.
bool is_after_underscore_or_number = true;
bool is_previous_uppercase = false;
int pos = 0;
foreach (char c in name)
{
char char_to_add;

View file

@ -74,6 +74,7 @@ namespace Bind
RegexOptions.Compiled);
public static readonly Regex Acronyms = new Regex(Extensions.ToString() + "|EGL|3TC|DXT|ES|RGBA|BGRA|RGB|BGR|ETC",
RegexOptions.Compiled);
#region internal StreamReader OpenSpecFile(string file)
internal static StreamReader OpenSpecFile(string folder, string file)