Search in sources :

Example 1 with NotExpressionNode

use of com.google.auto.value.processor.escapevelocity.ExpressionNode.NotExpressionNode in project auto by google.

the class Parser method parseUnaryExpression.

/**
   * Parses an expression not containing any operators (except inside parentheses).
   * <pre>{@code
   * <unary-expression> -> <primary> |
   *                       ( <expression> ) |
   *                       ! <unary-expression>
   * }</pre>
   */
private ExpressionNode parseUnaryExpression() throws IOException {
    skipSpace();
    ExpressionNode node;
    if (c == '(') {
        nextNonSpace();
        node = parseExpression();
        expect(')');
        skipSpace();
        return node;
    } else if (c == '!') {
        next();
        node = new NotExpressionNode(parseUnaryExpression());
        skipSpace();
        return node;
    } else {
        return parsePrimary();
    }
}
Also used : NotExpressionNode(com.google.auto.value.processor.escapevelocity.ExpressionNode.NotExpressionNode) NotExpressionNode(com.google.auto.value.processor.escapevelocity.ExpressionNode.NotExpressionNode) BinaryExpressionNode(com.google.auto.value.processor.escapevelocity.ExpressionNode.BinaryExpressionNode)

Aggregations

BinaryExpressionNode (com.google.auto.value.processor.escapevelocity.ExpressionNode.BinaryExpressionNode)1 NotExpressionNode (com.google.auto.value.processor.escapevelocity.ExpressionNode.NotExpressionNode)1