/// <summary>
        /// run step 123.
        /// </summary>
        /// <returns></returns>
        public override Expr Parse()
        {
            // avg min max sum count
            string aggregate = _tokenIt.NextToken.Token.Text.ToLower();

            var  next = _tokenIt.Peek().Token;
            Expr exp  = null;

            // 1. sum( <expression> )
            if (next == Tokens.LeftParenthesis)
            {
                _tokenIt.Advance(2);
                exp = _parser.ParseExpression(Terminators.ExpParenthesisEnd, passNewLine: false);
                _tokenIt.Expect(Tokens.RightParenthesis);
            }
            // 2. sum of <expression>
            else if (string.Compare(next.Text, "of", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                _tokenIt.Advance(2);
                exp = _parser.ParseExpression(null, false, true, passNewLine: false);
            }

            var aggExp = new AggregateExpr(aggregate, exp);

            return(aggExp);
        }
Beispiel #2
0
        /// <summary>
        /// run step 123.
        /// </summary>
        /// <returns></returns>
        public override Expr Parse()
        {
            // avg min max sum count
            string aggregate = _tokenIt.NextToken.Token.Text.ToLower();

            var next = _tokenIt.Peek().Token;
            Expr exp = null;

            // 1. sum( <expression> )
            if (next == Tokens.LeftParenthesis)
            {
                _tokenIt.Advance(2);
                exp = _parser.ParseExpression(Terminators.ExpParenthesisEnd, passNewLine: false);
                _tokenIt.Expect(Tokens.RightParenthesis);
            }
            // 2. sum of <expression>
            else if (string.Compare(next.Text, "of", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                _tokenIt.Advance(2);
                exp = _parser.ParseExpression(null, false, true, passNewLine: false);
            }
            
            var aggExp = new AggregateExpr(aggregate, exp);
            return aggExp;
        }