/// <summary> /// Parses the All portion of the query /// </summary> /// <param name="parent">The parent of the All node.</param> /// <returns>The lexical token representing the All query.</returns> private QueryToken ParseAll(QueryToken parent) { NavigationPropertyToken parentNav = (NavigationPropertyToken)parent; parentNav.AnyAllParent = true; this.lexer.NextToken(); if (this.lexer.CurrentToken.Kind != ExpressionTokenKind.OpenParen) { throw ParseError(Strings.UriQueryExpressionParser_OpenParenExpected(this.lexer.CurrentToken.Position, this.lexer.ExpressionText)); } this.lexer.NextToken(); // When faced with All(), return the same thing as if you encountered All(a : true) if (this.lexer.CurrentToken.Kind == ExpressionTokenKind.CloseParen) { this.lexer.NextToken(); return(new AllQueryToken(new LiteralQueryToken(true, "True"), "a", parent)); } ParameterQueryToken paramToken = new ParameterQueryToken(parentNav, this.lexer.CurrentToken.GetIdentifier()); this.parameters.Add(this.lexer.CurrentToken.GetIdentifier(), paramToken); string tmp = this.lexer.CurrentToken.GetIdentifier(); this.lexer.NextToken(); this.lexer.NextToken(); QueryToken expr = this.ParseExpression(); if (this.lexer.CurrentToken.Kind != ExpressionTokenKind.CloseParen) { throw ParseError(Strings.UriQueryExpressionParser_CloseParenOrCommaExpected(this.lexer.CurrentToken.Position, this.lexer.ExpressionText)); } this.lexer.NextToken(); return(new AllQueryToken(expr, tmp, parent)); }
/// <summary> /// Binds a parameter token. /// </summary> /// <param name="parameterQueryToken">The parameter token to bind.</param> /// <returns>The bound query node.</returns> protected virtual QueryNode BindParameter(ParameterQueryToken parameterQueryToken) { ExceptionUtils.CheckArgumentNotNull(parameterQueryToken, "extensionToken"); QueryNode source = this.Bind(parameterQueryToken.Parent); IEdmType type = GetType(source); return new ParameterQueryNode { ParameterType = type.ToTypeReference() }; }
/// <summary> /// Parses the All portion of the query /// </summary> /// <param name="parent">The parent of the All node.</param> /// <returns>The lexical token representing the All query.</returns> private QueryToken ParseAll(QueryToken parent) { NavigationPropertyToken parentNav = (NavigationPropertyToken)parent; parentNav.AnyAllParent = true; this.lexer.NextToken(); if (this.lexer.CurrentToken.Kind != ExpressionTokenKind.OpenParen) { throw ParseError(Strings.UriQueryExpressionParser_OpenParenExpected(this.lexer.CurrentToken.Position, this.lexer.ExpressionText)); } this.lexer.NextToken(); // When faced with All(), return the same thing as if you encountered All(a : true) if (this.lexer.CurrentToken.Kind == ExpressionTokenKind.CloseParen) { this.lexer.NextToken(); return new AllQueryToken(new LiteralQueryToken(true, "True"), "a", parent); } ParameterQueryToken paramToken = new ParameterQueryToken(parentNav, this.lexer.CurrentToken.GetIdentifier()); this.parameters.Add(this.lexer.CurrentToken.GetIdentifier(), paramToken); string tmp = this.lexer.CurrentToken.GetIdentifier(); this.lexer.NextToken(); this.lexer.NextToken(); QueryToken expr = this.ParseExpression(); if (this.lexer.CurrentToken.Kind != ExpressionTokenKind.CloseParen) { throw ParseError(Strings.UriQueryExpressionParser_CloseParenOrCommaExpected(this.lexer.CurrentToken.Position, this.lexer.ExpressionText)); } this.lexer.NextToken(); return new AllQueryToken(expr, tmp, parent); }