Search in sources :

Example 1 with XmlElemRef

use of org.mozilla.javascript.ast.XmlElemRef in project HL4A by HL4A.

the class Parser method xmlElemRef.

/**
 * Parse the [expr] portion of an xml element reference, e.g.
 * @[expr], @*::[expr], or ns::[expr].
 */
private XmlElemRef xmlElemRef(int atPos, Name namespace, int colonPos) throws IOException {
    int lb = ts.tokenBeg, rb = -1, pos = atPos != -1 ? atPos : lb;
    AstNode expr = expr();
    int end = getNodeEnd(expr);
    if (mustMatchToken(Token.RB, "msg.no.bracket.index")) {
        rb = ts.tokenBeg;
        end = ts.tokenEnd;
    }
    XmlElemRef ref = new XmlElemRef(pos, end - pos);
    ref.setNamespace(namespace);
    ref.setColonPos(colonPos);
    ref.setAtPos(atPos);
    ref.setExpression(expr);
    ref.setBrackets(lb, rb);
    return ref;
}
Also used : XmlElemRef(org.mozilla.javascript.ast.XmlElemRef) AstNode(org.mozilla.javascript.ast.AstNode)

Aggregations

AstNode (org.mozilla.javascript.ast.AstNode)1 XmlElemRef (org.mozilla.javascript.ast.XmlElemRef)1