/// <summary>
/// Evaluates a function call, when the left part (function identification) has been parsed
/// </summary>
/// <param name="left">The left part of the function call expression</param>
/// <returns></returns>
private Expression EvaluateFunctionCallExpression(Expression left)
{
Call retVal = null;
SkipWhiteSpaces();
if (LookAhead("("))
{
retVal = new Call(Root, RootLog, left, left.Start, -1);
Match("(");
bool cont = true;
while (cont)
{
SkipWhiteSpaces();
if (LookAhead(")"))
{
Match(")");
cont = false;
}
else
{
// Handle named parameters
int current2 = Index;
string id = Identifier();
Designator parameter = null;
if (id != null)
{
string assignOp = LookAhead(AssignOps);
if (assignOp != null)
{
Match(assignOp);
parameter = new Designator(Root, RootLog, id, current2, current2 + id.Length);
}
else
{
Index = current2;
}
}
Expression arg = Expression(0);
if (arg != null)
{
retVal.AddActualParameter(parameter, arg);
if (LookAhead(","))
{
Match(",");
}
else if (LookAhead(")"))
{
Match(")");
cont = false;
}
}
else
{
throw new ParseErrorException("Syntax error", Index, Buffer);
}
}
}
retVal.End = Index;
}
return retVal;
}