private IExpression ParseTermExpression()
{
if (this.TryParse(TokenType.Name, "new"))
return this.ParseNewExpression();
IExpression expression = this.ParseSimpleTermExpression();
while (this.TryParse(TokenType.Delimiter, ".", "[", "("))
{
if (this.TryParse(TokenType.Delimiter, "."))
{
this.lexer.NextToken();
string name = this.ParseName();
IList<IExpression> arguments = null;
if (this.TryParse(TokenType.Delimiter, "("))
arguments = this.ParseArgumentList();
expression = new DotExpression(expression, name, arguments);
continue;
}
if (this.TryParse(TokenType.Delimiter, "("))
{
IList<IExpression> arguments = this.ParseArgumentList();
expression = new InvokeExpression(expression, arguments);
continue;
}
expression = new IndexedExpression(expression, this.ParseArrayArgumentList());
}
return expression;
}