/** * Constructs a new {@code ExpressionStatement} wrapping * the specified expression. Sets this node's position to the * position of the wrapped node, and sets the wrapped node's * position to zero. Sets this node's length to the length of * the wrapped node. * @param expr the wrapped expression */ public ExpressionStatement(AstNode expr) { this(expr.getPosition(), expr.getLength(), expr); }
public ParenthesizedExpression(AstNode expr) { this(expr != null ? expr.getPosition() : 0, expr != null ? expr.getLength() : 1, expr); }
public ParenthesizedExpression(AstNode expr) { this(expr != null ? expr.getPosition() : 0, expr != null ? expr.getLength() : 1, expr); }
/** * Constructs a new {@code ExpressionStatement} wrapping * the specified expression. Sets this node's position to the * position of the wrapped node, and sets the wrapped node's * position to zero. Sets this node's length to the length of * the wrapped node. * @param expr the wrapped expression */ public ExpressionStatement(AstNode expr) { this(expr.getPosition(), expr.getLength(), expr); }
public ParenthesizedExpression(AstNode expr) { this(expr != null ? expr.getPosition() : 0, expr != null ? expr.getLength() : 1, expr); }
/** * Constructs a new {@code ExpressionStatement} wrapping * the specified expression. Sets this node's position to the * position of the wrapped node, and sets the wrapped node's * position to zero. Sets this node's length to the length of * the wrapped node. * @param expr the wrapped expression */ public ExpressionStatement(AstNode expr) { this(expr.getPosition(), expr.getLength(), expr); }
private void warnTrailingComma(int pos, List<?> elems, int commaPos) { if (compilerEnv.getWarnTrailingComma()) { // back up from comma to beginning of line or array/objlit if (!elems.isEmpty()) { pos = ((AstNode)elems.get(0)).getPosition(); } pos = Math.max(pos, lineBeginningFor(commaPos)); addWarning("msg.extra.trailing.comma", pos, commaPos - pos); } }
private void warnTrailingComma(int pos, List<?> elems, int commaPos) { if (compilerEnv.getWarnTrailingComma()) { // back up from comma to beginning of line or array/objlit if (!elems.isEmpty()) { pos = ((AstNode)elems.get(0)).getPosition(); } pos = Math.max(pos, lineBeginningFor(commaPos)); addWarning("msg.extra.trailing.comma", pos, commaPos - pos); } }
private void warnTrailingComma(int pos, List<?> elems, int commaPos) { if (compilerEnv.getWarnTrailingComma()) { // back up from comma to beginning of line or array/objlit if (!elems.isEmpty()) { pos = ((AstNode)elems.get(0)).getPosition(); } pos = Math.max(pos, lineBeginningFor(commaPos)); addWarning("msg.extra.trailing.comma", pos, commaPos - pos); } }
private void exitLoop() { Loop loop = loopSet.remove(loopSet.size() - 1); loopAndSwitchSet.remove(loopAndSwitchSet.size() - 1); if (loop.getParent() != null) { // see comment in enterLoop loop.setRelative(loop.getParent().getPosition()); } popScope(); }
private void exitLoop() { Loop loop = loopSet.remove(loopSet.size() - 1); loopAndSwitchSet.remove(loopAndSwitchSet.size() - 1); if (loop.getParent() != null) { // see comment in enterLoop loop.setRelative(loop.getParent().getPosition()); } popScope(); }
private void exitLoop() { Loop loop = loopSet.remove(loopSet.size() - 1); loopAndSwitchSet.remove(loopAndSwitchSet.size() - 1); if (loop.getParent() != null) { // see comment in enterLoop loop.setRelative(loop.getParent().getPosition()); } popScope(); }
/** * Constructs a new {@code InfixExpression}. * @param operatorPos the <em>absolute</em> position of the operator */ public InfixExpression(int operator, AstNode left, AstNode right, int operatorPos) { setType(operator); setOperatorPosition(operatorPos - left.getPosition()); setLeftAndRight(left, right); }
public void setLeftAndRight(AstNode left, AstNode right) { assertNotNull(left); assertNotNull(right); // compute our bounds while children have absolute positions int beg = left.getPosition(); int end = right.getPosition() + right.getLength(); setBounds(beg, end); // this updates their positions to be parent-relative setLeft(left); setRight(right); }
public void setLeftAndRight(AstNode left, AstNode right) { assertNotNull(left); assertNotNull(right); // compute our bounds while children have absolute positions int beg = left.getPosition(); int end = right.getPosition() + right.getLength(); setBounds(beg, end); // this updates their positions to be parent-relative setLeft(left); setRight(right); }
/** * Constructs a new {@code InfixExpression}. * @param operatorPos the <em>absolute</em> position of the operator */ public InfixExpression(int operator, AstNode left, AstNode right, int operatorPos) { setType(operator); setOperatorPosition(operatorPos - left.getPosition()); setLeftAndRight(left, right); }
public void setLeftAndRight(AstNode left, AstNode right) { assertNotNull(left); assertNotNull(right); // compute our bounds while children have absolute positions int beg = left.getPosition(); int end = right.getPosition() + right.getLength(); setBounds(beg, end); // this updates their positions to be parent-relative setLeft(left); setRight(right); }
/** * Sets loop body. Sets the parent of the body to this loop node, * and updates its offset to be relative. Extends the length of this * node to include the body. */ public void setBody(AstNode body) { this.body = body; int end = body.getPosition() + body.getLength(); this.setLength(end - this.getPosition()); body.setParent(this); }
/** * Sets loop body. Sets the parent of the body to this loop node, * and updates its offset to be relative. Extends the length of this * node to include the body. */ public void setBody(AstNode body) { this.body = body; int end = body.getPosition() + body.getLength(); this.setLength(end - this.getPosition()); body.setParent(this); }
/** * Sets loop body. Sets the parent of the body to this loop node, * and updates its offset to be relative. Extends the length of this * node to include the body. */ public void setBody(AstNode body) { this.body = body; int end = body.getPosition() + body.getLength(); this.setLength(end - this.getPosition()); body.setParent(this); }