Ejemplo n.º 1
0
        private CallExpression ReadFirstExpressionContent()
        {
            var fnExpression    = new CallExpression();
            var tknFunctionName = Reader.DiscardToken(TokenType.First);

            Reader.DiscardToken(TokenType.OpenParenthesis);
            fnExpression.Name = "First";
            var cursor = Reader.Marker.Clone();
            //Create a predicate untill the closing of the function
            var isKeyword                 = Filters.Keyword(cursor);
            var isSameLevelComma          = Filters.SameLevel(cursor, TokenType.Comma);
            var isSameLevelClosingBracket = Filters.SameLevel(cursor, TokenType.CloseBracket);
            var semiColonBreak            = Filters.SameLevel(cursor, TokenType.Semicolon);
            var newLineBreak              = Filters.SameLevel(cursor, TokenType.NewLine);
            var isExpressionBreak         = new Predicate <TokenMarker>((x) =>
            {
                return(semiColonBreak(x) || newLineBreak(x) || isSameLevelClosingBracket(x) || isKeyword(x) || isSameLevelComma(x));
            });

            while (!Reader.IsComplete && !isExpressionBreak(Reader.Marker))
            {
                ParameterExpression fnParameter = ReadFunctionParameter();
                fnExpression.AddParameter(fnParameter);
                if (Reader.Current.TokenType == TokenType.Comma)
                {
                    Reader.DiscardToken();
                }
            }
            return(fnExpression);
        }
Ejemplo n.º 2
0
        private AggregateJobTree AddAggregateTreeFromField(NameExpression expression)
        {
            Clean();
            _expVisitor.Clear();
            var firstCallExpression = new CallExpression()
            {
                Name = "first"
            };

            firstCallExpression.AddParameter(new ParameterExpression(expression));
            var firstGrpStage = AddAggregateTreeFromCall(firstCallExpression);

            //var outputTree = _expVisitor.AggregateTree.Clone();
            return(firstGrpStage);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public CallExpression ReadFunctionCall()
        {
            var f = new CallExpression();
            var tknFunctionName = Reader.DiscardToken(TokenType.Symbol);

            Reader.DiscardToken(TokenType.OpenParenthesis);
            f.Name = tknFunctionName.Value;
            var cursor = Reader.Marker.Clone();
            //Create a predicate untill the closing of the function
            var fnEndPredicate = DonutSyntaxReader.Filters.FunctionCallEnd(cursor);

            while (!Reader.IsComplete && !fnEndPredicate(Reader.Marker))
            {
                ParameterExpression fnParameter = ReadFunctionParameter();
                f.AddParameter(fnParameter);
                if (Reader.Current.TokenType == TokenType.Comma)
                {
                    Reader.DiscardToken();
                }
            }
            Reader.DiscardToken(TokenType.CloseParenthesis);
            return(f);
        }