/// <devdoc> /// parse the argument to an Aggregate function. /// the syntax is /// Func(child[(relation_name)].column_name) /// When the function is called we have already parsed the Aggregate name, and open paren /// </devdoc> private ExpressionNode ParseAggregateArgument(FunctionId aggregate) { Debug.Assert(token == Tokens.LeftParen, "ParseAggregateArgument(): Invalid argument, token <> '('"); bool child; string relname; string colname; Scan(); try { if (token != Tokens.Child) { if (token != Tokens.Name) { throw ExprException.AggregateArgument(); } colname = NameNode.ParseName(text, start, pos); ScanToken(Tokens.RightParen); return(new AggregateNode(_table, aggregate, colname)); } child = (token == Tokens.Child); prevOperand = Scalar; // expecting an '(' or '.' Scan(); if (token == Tokens.LeftParen) { //read the relation name ScanToken(Tokens.Name); relname = NameNode.ParseName(text, start, pos); ScanToken(Tokens.RightParen); ScanToken(Tokens.Dot); } else { relname = null; CheckToken(Tokens.Dot); } ScanToken(Tokens.Name); colname = NameNode.ParseName(text, start, pos); ScanToken(Tokens.RightParen); } catch (Exception e) { // if (!Common.ADP.IsCatchableExceptionType(e)) { throw; } throw ExprException.AggregateArgument(); } return(new AggregateNode(_table, aggregate, colname, !child, relname)); }
private ExpressionNode ParseAggregateArgument(FunctionId aggregate) { string str; string str2; bool flag; this.Scan(); try { if (this.token != Tokens.Child) { if (this.token != Tokens.Name) { throw ExprException.AggregateArgument(); } str = NameNode.ParseName(this.text, this.start, this.pos); this.ScanToken(Tokens.RightParen); return(new AggregateNode(this._table, aggregate, str)); } flag = this.token == Tokens.Child; this.prevOperand = 1; this.Scan(); if (this.token == Tokens.LeftParen) { this.ScanToken(Tokens.Name); str2 = NameNode.ParseName(this.text, this.start, this.pos); this.ScanToken(Tokens.RightParen); this.ScanToken(Tokens.Dot); } else { str2 = null; this.CheckToken(Tokens.Dot); } this.ScanToken(Tokens.Name); str = NameNode.ParseName(this.text, this.start, this.pos); this.ScanToken(Tokens.RightParen); } catch (Exception exception) { if (!ADP.IsCatchableExceptionType(exception)) { throw; } throw ExprException.AggregateArgument(); } return(new AggregateNode(this._table, aggregate, str, !flag, str2)); }