private void RenameIdentifiers()
{
MatchCollection matches = Regex.Matches(code, @"(var|function) (\w+)");
foreach (Match match in matches)
{
Console.WriteLine(match.Value);
string oldName = match.Groups[2].Value;
string newName = namesManager.NextName;
string pattern = @"(\W)" + oldName + @"(\W)";
string replacement = "$1" + newName + "$2";
code = Regex.Replace(code, pattern, replacement);
}
}