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); }
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); }
/// <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); }