/** * Start an element * * @param name the name of the element * @return the depth of the tree before this element: for diagnostics, this can be compared * with the value returned by endElement */ public int startElement(String name) { nameStack.push(name); return _startElement(name); }
/** * Start an element * * @param name the name of the element * @return the depth of the tree before this element: for diagnostics, this can be compared * with the value returned by endElement */ public int startElement(String name) { nameStack.push(name); return _startElement(name); }
/** * Start an element representing an expression in the expression tree * * @param name the name of the element * @param expr the expression represented * @return the depth of the tree before this element: for diagnostics, this can be compared * with the value returned by endElement */ public int startElement(String name, Expression expr) { Expression parent = expressionStack.isEmpty() ? null : expressionStack.peek(); expressionStack.push(expr); nameStack.push("*" + name); int n = _startElement(name); if (parent == null || expr.getRetainedStaticContext() != parent.getRetainedStaticContext()) { if (expr.getRetainedStaticContext() == null) { throw new AssertionError("Export failure: no retained static context on " + expr.toShortString()); } else { emitRetainedStaticContext(expr.getRetainedStaticContext(), parent == null ? null : parent.getRetainedStaticContext()); } } String mod = expr.getLocation().getSystemId(); if (mod != null && parent != null && (parent.getLocation().getSystemId() == null || !parent.getLocation().getSystemId().equals(mod))) { emitAttribute("module", truncatedModuleName(mod)); } int lineNr = expr.getLocation().getLineNumber(); if (parent == null || (parent.getLocation().getLineNumber() != lineNr && lineNr != -1)) { emitAttribute("line", lineNr + ""); } return n; }
/** * Start an element representing an expression in the expression tree * * @param name the name of the element * @param expr the expression represented * @return the depth of the tree before this element: for diagnostics, this can be compared * with the value returned by endElement */ public int startElement(String name, Expression expr) { Expression parent = expressionStack.isEmpty() ? null : expressionStack.peek(); expressionStack.push(expr); nameStack.push("*" + name); int n = _startElement(name); if (parent == null || expr.getRetainedStaticContext() != parent.getRetainedStaticContext()) { if (expr.getRetainedStaticContext() == null) { throw new AssertionError("Export failure: no retained static context on " + expr.toShortString()); } else { emitRetainedStaticContext(expr.getRetainedStaticContext(), parent == null ? null : parent.getRetainedStaticContext()); } } String mod = expr.getLocation().getSystemId(); if (mod != null && parent != null && (parent.getLocation().getSystemId() == null || !parent.getLocation().getSystemId().equals(mod))) { emitAttribute("module", truncatedModuleName(mod)); } int lineNr = expr.getLocation().getLineNumber(); if (parent == null || (parent.getLocation().getLineNumber() != lineNr && lineNr != -1)) { emitAttribute("line", lineNr + ""); } return n; }