private int FindStartOfFunctionCall(int currentPos, out int parameterIndex)
{
int bracketDepth = 0;
parameterIndex = 0;
if ((char)this.scintillaControl1.GetCharAt(currentPos) == ')')
{
// if they already have Func(1); and insert a comma after
// the 1, don't count it as opening a new sub-function
currentPos--;
}
int charsCounted = 0;
while (currentPos > 0)
{
char thisChar = (char)this.scintillaControl1.GetCharAt(currentPos);
if ((thisChar == '(') && (bracketDepth == 0))
{
break;
}
if (thisChar == '(') bracketDepth--;
if (thisChar == ')') bracketDepth++;
if ((thisChar == ',') && (bracketDepth == 0)) parameterIndex++;
currentPos--;
charsCounted++;
if (charsCounted > 100)
{
// not inside function parmaeters
return -1;
}
}
return currentPos;
}