Пример #1
0
        private Operator? GetOperator(Token token)
        {
            var identifier = token as IdentifierToken;

            if (identifier != null)
            {
                switch (identifier.Identifier)
                {
                    case "and": return Operator.And;
                    case "or": return Operator.Or;
                    case "eq": return Operator.Eq;
                    case "ne": return Operator.Ne;
                    case "lt": return Operator.Lt;
                    case "le": return Operator.Le;
                    case "gt": return Operator.Gt;
                    case "ge": return Operator.Ge;
                    case "add": return Operator.Add;
                    case "sub": return Operator.Sub;
                    case "mul": return Operator.Mul;
                    case "div": return Operator.Div;
                    case "mod": return Operator.Mod;
                    case "not": return Operator.Not;
                }
            }

            return null;
        }
Пример #2
0
        protected OrderByDirection? GetOrderByDirection(Token token)
        {
            var identifier = token as IdentifierToken;

            if (identifier != null)
            {
                switch (identifier.Identifier)
                {
                    case "asc": return OrderByDirection.Ascending;
                    case "desc": return OrderByDirection.Descending;
                }
            }

            return null;
        }
Пример #3
0
        protected void Expect(Token token)
        {
            Require.NotNull(token, "token");

            if (AtEnd || !Equals(Current, token))
                throw new ODataException(String.Format(ErrorMessages.Parser_ExpectedToken, token));

            MoveNext();
        }