private static bool TryReadVariableDeclaration(IMember member, string text, string[] allLines, ref int lineHint) { var match = TypeRegex.Match(text); if (match.Success) { var variableType = match.Groups[1].Value; var names = match.Groups[2].Value; var doubleDots = names.IndexOf("::", StringComparison.InvariantCultureIgnoreCase); var variableNamesString = doubleDots >= 0 ? names.Substring(doubleDots + 2) : names; variableNamesString = RemoveBetweenSlashes(RemoveParenthesis(RemoveBetweenQuotes(variableNamesString))); var nameMatches = VariableNamesRegex.Matches(variableNamesString); foreach (var variableNameMatch in nameMatches.OfType <Match>()) { var variableName = variableNameMatch.Groups[1].Value; //first group: variable with comma behind it if (String.IsNullOrEmpty(variableName)) { variableName = variableNameMatch.Groups[2].Value; //second group: only variable, or last variable in list } var location = FindFirstLocationOfElementNameInLines(member, variableName, allLines, ref lineHint); if (variableType == "type") { var typeMatch = VariableOfCustomTypeRegex.Match(text); if (typeMatch.Success) { var actualType = typeMatch.Groups[1].Value; var variable = new Variable { TypeString = actualType, Name = variableName, Location = location, Member = member, IsBuildInType = false }; member.AddLocalVariable(variable); } else { throw new InvalidOperationException("Unable to parse type"); } } else { var variable = new Variable { TypeString = variableType.ToLower(), Name = variableName, Location = location, Member = member, IsBuildInType = true }; member.AddLocalVariable(variable); } } if (nameMatches.Count == 0) { throw new InvalidOperationException("No variable names found."); } } return(match.Success); }