void startNode(final AstNode node) { // Ensure that nodes are visited in the proper nested order. // Jumps to different subtrees are allowed only for the child of a placeholder node. assert containerStack.isEmpty() || node.getParent() == containerStack.peek() || containerStack.peek().getNodeType() == NodeType.PATTERN; if (positionStack.size() > 0) { writeSpecialsUpToNode(node); } containerStack.push(node); positionStack.push(node.getFirstChild()); formatter.startNode(node); }
void startNode(final AstNode node) { // Ensure that nodes are visited in the proper nested order. // Jumps to different subtrees are allowed only for the child of a placeholder node. assert containerStack.isEmpty() || node.getParent() == containerStack.peek() || containerStack.peek().getNodeType() == NodeType.PATTERN; if (positionStack.size() > 0) { writeSpecialsUpToNode(node); } containerStack.push(node); positionStack.push(node.getFirstChild()); formatter.startNode(node); }
@Override public Void visitNewLine(final NewLineNode node, final Void ignored) { formatter.startNode(node); formatter.newLine(); formatter.endNode(node); return null; }
@Override public Void visitNewLine(final NewLineNode node, final Void ignored) { formatter.startNode(node); formatter.newLine(); formatter.endNode(node); return null; }
@Override public Void visitNewLine(final NewLineNode node, final Void ignored) { formatter.startNode(node); formatter.newLine(); formatter.endNode(node); return null; }
void startNode(final AstNode node) { // Ensure that nodes are visited in the proper nested order. // Jumps to different subtrees are allowed only for the child of a placeholder node. assert containerStack.isEmpty() || node.getParent() == containerStack.peek() || containerStack.peek().getNodeType() == NodeType.PATTERN; if (positionStack.size() > 0) { writeSpecialsUpToNode(node); } containerStack.push(node); positionStack.push(node.getFirstChild()); formatter.startNode(node); }
@Override public Void visitComment(final Comment comment, final Void ignored) { if (lastWritten == LastWritten.Division) { formatter.space(); } formatter.startNode(comment); formatter.writeComment(comment.getCommentType(), comment.getContent()); formatter.endNode(comment); lastWritten = LastWritten.Whitespace; return null; }
@Override public Void visitComment(final Comment comment, final Void ignored) { if (lastWritten == LastWritten.Division) { formatter.space(); } formatter.startNode(comment); formatter.writeComment(comment.getCommentType(), comment.getContent()); formatter.endNode(comment); lastWritten = LastWritten.Whitespace; return null; }
@Override public Void visitComment(final Comment comment, final Void ignored) { if (lastWritten == LastWritten.Division) { formatter.space(); } formatter.startNode(comment); formatter.writeComment(comment.getCommentType(), comment.getContent()); formatter.endNode(comment); lastWritten = LastWritten.Whitespace; return null; }