예제 #1
0
        ConditionExpression ParseFactorExpression()
        {
            ConditionExpression e;
            Token token = tokenizer.Token;

            tokenizer.GetNextToken();

            if (token.Type == TokenType.LeftParen)
            {
                e = ParseExpression();
                tokenizer.Expect(TokenType.RightParen);
            }
            else if (token.Type == TokenType.String && tokenizer.Token.Type == TokenType.LeftParen)
            {
                e = ParseFunctionExpression(token.Value);
            }
            else if (token.Type == TokenType.String)
            {
                e = new ConditionFactorExpression(token);
            }
            else if (token.Type == TokenType.Number)
            {
                e = new ConditionFactorExpression(token);
            }
            else if (token.Type == TokenType.Item || token.Type == TokenType.Property ||
                     token.Type == TokenType.Metadata)
            {
                e = ParseReferenceExpression(token.Value [0]);
            }
            else if (token.Type == TokenType.Not)
            {
                e = ParseNotExpression();
            }
            else
            {
                throw new ExpressionParseException(String.Format("Unexpected token {0}, while parsing condition \"{1}\"", token, conditionStr));
            }

            return(e);
        }
예제 #2
0
		ConditionExpression ParseFactorExpression ()
		{
			ConditionExpression e;
			Token token = tokenizer.Token;
			tokenizer.GetNextToken ();

			if (token.Type == TokenType.LeftParen) {
				e = ParseExpression ();
				tokenizer.Expect (TokenType.RightParen);
			} else if (token.Type == TokenType.String && tokenizer.Token.Type == TokenType.LeftParen) {
				e = ParseFunctionExpression (token.Value);
			} else if (token.Type == TokenType.String) {
				e = new ConditionFactorExpression (token);
			} else if (token.Type == TokenType.Number) {
				e = new ConditionFactorExpression (token);
			} else if (token.Type == TokenType.Item || token.Type == TokenType.Property
					|| token.Type == TokenType.Metadata) {
				e = ParseReferenceExpression (token.Value [0]);
			} else if (token.Type == TokenType.Not) {
				e = ParseNotExpression ();
			} else
				throw new ExpressionParseException (String.Format ("Unexpected token {0}, while parsing condition \"{1}\"", token, conditionStr));
			
			return e;
		}