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; }
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; }
protected void Expect(Token token) { Require.NotNull(token, "token"); if (AtEnd || !Equals(Current, token)) throw new ODataException(String.Format(ErrorMessages.Parser_ExpectedToken, token)); MoveNext(); }