Exemplo n.º 1
0
 @Override
 public boolean enter(ScopeNode node) {
   if (node.getParent() != null && node.isBracketsDisplayed()) {
     print('{');
     List<Node> children = node.getChildren();
     if (children.isEmpty()) {
       // do nothing
     } else {
       addIndent();
     }
   }
   return super.enter(node);
 }
Exemplo n.º 2
0
  @Override
  public boolean exit(ScopeNode node) {
    if (node.getParent() != null && node.isBracketsDisplayed()) {
      List<Node> children = node.getChildren();
      if (children.isEmpty()) {
        // do nothing
      } else {
        removeIndent();
      }
      deleteIndent().print('}');

      // Some editors and version control systems don't like extremely long lines, so add
      // line breaks every so often when compressing.
      if (_compress && _sb.length() - _lastCompressedLineBreak > COMPRESSED_LINE_BREAK_POSITION) {
        printLine();
        _lastCompressedLineBreak = _sb.length();
      }
    }
    return super.exit(node);
  }