/// <summary>
        /// Returns a query option value by its name and removes the query option from the <paramref name="queryOptions"/> collection.
        /// Currently, it is only used by un-exposed syntactic tree parsing.
        /// </summary>
        /// <param name="queryOptions">The collection of query options.</param>
        /// <param name="queryOptionName">The name of the query option to get.</param>
        /// <returns>The value of the query option or null if no such query option exists.</returns>
        internal static string GetQueryOptionValueAndRemove(this List <CustomQueryOptionToken> queryOptions, string queryOptionName)
        {
            Debug.Assert(queryOptions != null, "queryOptions != null");
            Debug.Assert(queryOptionName == null || queryOptionName.Length > 0, "queryOptionName == null || queryOptionName.Length > 0");

            CustomQueryOptionToken option = null;

            for (int i = 0; i < queryOptions.Count; ++i)
            {
                if (queryOptions[i].Name == queryOptionName)
                {
                    if (option == null)
                    {
                        option = queryOptions[i];
                    }
                    else
                    {
                        throw new ODataException(Strings.QueryOptionUtils_QueryParameterMustBeSpecifiedOnce(queryOptionName));
                    }

                    queryOptions.RemoveAt(i);
                    i--;
                }
            }

            return(option == null ? null : option.Value);
        }
        /// <summary>
        /// Returns a query option value by its name from the <paramref name="queryOptions"/> collection.
        /// </summary>
        /// <param name="queryOptions">The collection of query options.</param>
        /// <param name="queryOptionName">The name of the query option to get.</param>
        /// <returns>The value of the query option or null if no such query option exists.</returns>
        internal static string GetQueryOptionValue(this List <CustomQueryOptionToken> queryOptions, string queryOptionName)
        {
            Debug.Assert(queryOptions != null, "queryOptions != null");
            Debug.Assert(queryOptionName == null || queryOptionName.Length > 0, "queryOptionName == null || queryOptionName.Length > 0");

            CustomQueryOptionToken option = null;

            foreach (var queryOption in queryOptions)
            {
                if (queryOption.Name == queryOptionName)
                {
                    if (option == null)
                    {
                        option = queryOption;
                    }
                    else
                    {
                        throw new ODataException(Strings.QueryOptionUtils_QueryParameterMustBeSpecifiedOnce(queryOptionName));
                    }
                }
            }

            return(option == null ? null : option.Value);
        }
 /// <summary>
 /// Visits a CustomQueryOptionToken
 /// </summary>
 /// <param name="tokenIn">The CustomQueryOptionToken to bind</param>
 /// <returns>A CustomQueryOptionNode bound to this CustomQueryOptionToken</returns>
 public virtual T Visit(CustomQueryOptionToken tokenIn)
 {
     throw new NotImplementedException();
 }