Search in sources :

Example 1 with IndexReferenceNode

use of com.google.auto.value.processor.escapevelocity.ReferenceNode.IndexReferenceNode in project auto by google.

the class Parser method parseReferenceIndex.

/**
   * Parses an index suffix to a method, like {@code $x[$i]}.
   * <pre>{@code
   * <reference-index> -> [ <expression> ]
   * }</pre>
   *
   * @param lhs the reference node representing what appears to the left of the dot, like the
   * {@code $x} in {@code $x[$i]}.
   */
private ReferenceNode parseReferenceIndex(ReferenceNode lhs) throws IOException {
    assert c == '[';
    next();
    ExpressionNode index = parseExpression();
    if (c != ']') {
        throw parseException("Expected ]");
    }
    next();
    ReferenceNode reference = new IndexReferenceNode(lhs, index);
    return parseReferenceSuffix(reference);
}
Also used : IndexReferenceNode(com.google.auto.value.processor.escapevelocity.ReferenceNode.IndexReferenceNode) MemberReferenceNode(com.google.auto.value.processor.escapevelocity.ReferenceNode.MemberReferenceNode) MethodReferenceNode(com.google.auto.value.processor.escapevelocity.ReferenceNode.MethodReferenceNode) PlainReferenceNode(com.google.auto.value.processor.escapevelocity.ReferenceNode.PlainReferenceNode) NotExpressionNode(com.google.auto.value.processor.escapevelocity.ExpressionNode.NotExpressionNode) BinaryExpressionNode(com.google.auto.value.processor.escapevelocity.ExpressionNode.BinaryExpressionNode) IndexReferenceNode(com.google.auto.value.processor.escapevelocity.ReferenceNode.IndexReferenceNode)

Aggregations

BinaryExpressionNode (com.google.auto.value.processor.escapevelocity.ExpressionNode.BinaryExpressionNode)1 NotExpressionNode (com.google.auto.value.processor.escapevelocity.ExpressionNode.NotExpressionNode)1 IndexReferenceNode (com.google.auto.value.processor.escapevelocity.ReferenceNode.IndexReferenceNode)1 MemberReferenceNode (com.google.auto.value.processor.escapevelocity.ReferenceNode.MemberReferenceNode)1 MethodReferenceNode (com.google.auto.value.processor.escapevelocity.ReferenceNode.MethodReferenceNode)1 PlainReferenceNode (com.google.auto.value.processor.escapevelocity.ReferenceNode.PlainReferenceNode)1