private IExpression ParseCollectionItem()
{
Token token = this.NextToken();
if (token == null)
return null;
if (token.Type == TokenType.Punctuation && token.Value == ")")
{
this.PushToken(token);
return null;
}
if (token.Type == TokenType.Punctuation && token.Value == "(")
return this.ParseArray();
// TODO review if operators in collections are symbols or not
if (token.Type == TokenType.Name || token.Type == TokenType.Operator || token.Type == TokenType.Symbol)
return new SymbolExpression(token.Value);
if (token.Type == TokenType.Integer)
return new ConstantExpression(Convert.ToInt32(token.Value, CultureInfo.InvariantCulture));
if (token.Type == TokenType.Real)
return new ConstantExpression(Convert.ToDouble(token.Value, CultureInfo.InvariantCulture));
return new ConstantExpression(token.Value);
}