public int GetNumberOfLinesInRegularStatement(string[] allLines, int index)
{
int lineCount = 0;
int parensDeep = 0;
int curlyBracketsDeep = 0;
// This is not an if statement, not a comment, therefore it must end in a semicolon
while (index < allLines.Length)
{
lineCount++;
string lineAtIndex = allLines[index].Trim();
parensDeep += allLines[index].CountOf('(');
parensDeep -= allLines[index].CountOf(')');
curlyBracketsDeep += allLines[index].CountOf('{');
curlyBracketsDeep -= allLines[index].CountOf('}');
index++;
if (curlyBracketsDeep == 0 && parensDeep == 0 && lineAtIndex.Trim().EndsWith(";"))
{
break;
}
}
return lineCount;
}