/// <summary> /// Parses the -, not unary operators. /// </summary> /// <returns>The lexical token representing the expression.</returns> private QueryToken ParseUnary() { this.RecurseEnter(); if (this.lexer.CurrentToken.Kind == ExpressionTokenKind.Minus || this.TokenIdentifierIs(ExpressionConstants.KeywordNot)) { ExpressionToken operatorToken = this.lexer.CurrentToken; this.lexer.NextToken(); if (operatorToken.Kind == ExpressionTokenKind.Minus && (ExpressionLexerUtils.IsNumeric(this.lexer.CurrentToken.Kind))) { ExpressionToken numberLiteral = this.lexer.CurrentToken; numberLiteral.Text = "-" + numberLiteral.Text; numberLiteral.Position = operatorToken.Position; this.lexer.CurrentToken = numberLiteral; this.RecurseLeave(); return(this.ParsePrimary()); } QueryToken operand = this.ParseUnary(); UnaryOperatorKind unaryOperatorKind; if (operatorToken.Kind == ExpressionTokenKind.Minus) { unaryOperatorKind = UnaryOperatorKind.Negate; } else { Debug.Assert(operatorToken.IdentifierIs(ExpressionConstants.KeywordNot, enableCaseInsensitiveBuiltinIdentifier), "Was a new unary operator added?"); unaryOperatorKind = UnaryOperatorKind.Not; } this.RecurseLeave(); return(new UnaryOperatorToken(unaryOperatorKind, operand)); } this.RecurseLeave(); return(this.ParsePrimary()); }