private NPathSelectQuery ParseSelectQuery()
        {
            NPathSelectQuery query = new NPathSelectQuery();
            queries.Push(query);

            tokenizer.GetCurrentToken("select", "Select");

            NPathSelectClause selectClause = new NPathSelectClause();
            ParseSelectClause(selectClause);
            query.Select = selectClause;

            tokenizer.GetCurrentToken("from", "From");
            NPathFromClause fromClause = new NPathFromClause();
            ParseFromClause(fromClause);
            query.From = fromClause;

            if (tokenizer.GetCurrentToken().IsType("where"))
            {
                NPathWhereClause whereClause = new NPathWhereClause();
                query.Where = whereClause;
                ParseWhereClause(whereClause);

            }

            if (tokenizer.GetCurrentToken().IsType("order by")) // do not localize
            {
                NPathOrderByClause orderByClause = new NPathOrderByClause();
                ParseOrderByClause(orderByClause);
                query.OrderBy = orderByClause;
            }

            return query;
        }
 public SortOrderComparer(NPathOrderByClause orderBy, IObjectQueryEngine engine)
 {
     this.orderBy = orderBy;
     this.engine = engine;
 }
        private void ParseOrderByClause(NPathOrderByClause orderByClause)
        {
            do
            {
                tokenizer.MoveNext();
                //Token propertyToken = tokenizer.GetCurrentToken("property path","Property path"); // do not localize
                IValue expression = ParseExpression();

                SortProperty sortProperty = new SortProperty();
                //	sortProperty.Path = propertyToken.Text;
                sortProperty.Expression = expression;

                if (tokenizer.GetCurrentToken().IsType("direction"))
                {
                    sortProperty.Direction = (SortDirection) Enum.Parse(typeof (SortDirection), tokenizer.GetCurrentToken().Text, true);
                    tokenizer.MoveNext();
                }

                orderByClause.SortProperties.Add(sortProperty);
            } while (tokenizer.GetCurrentToken().IsType("comma"));
        }