Helper for the various indent methods.
@param chg The number of indent levels to change.
164389
private JsCodeBuilder changeIndentHelper(int chg) {
    int newIndentDepth = indent.length() + chg * INDENT_SIZE;
    Preconditions.checkState(newIndentDepth >= 0);
    indent = Strings.repeat(" ", newIndentDepth);
    return this;
  }
16403
def indent(self, levels, first_line=None):
        """"""
        self._indentation_levels.append(levels)
        self._indent_first_line.append(first_line)
242754
def set_indent(TokenClass, implicit=False):
    """"""
    def callback(lexer, match, context):
        text = match.group()
        if context.indent < context.next_indent:
            context.indent_stack.append(context.indent)
            context.indent = context.next_indent
        if not implicit:
            context.next_indent += len(text)
        yield match.start(), TokenClass, text
        context.pos = match.end()
    return callback
384259
final public void write(int ch)
  {
    try {
      _out.print((char) ch);
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }
  }
691935
def reset_indentation(self, amount):
        """"""
        while self.result and self.result[-1][0] == INDENT:
            self.result.pop()
        self.result.append((INDENT, amount))
756626
String indent(String s, int level) {
        return Stream.of(s.split("\n"))
                .map(sub -> INDENT_STRING.substring(0, level * INDENT_WIDTH) + sub)
                .collect(Collectors.joining("\n"));
    }
785304
public static void indent(int num, StringBuilder out) {
        if (num <= SIXTY_FOUR) {
            out.append(SIXTY_FOUR_SPACES, 0, num);
            return;
        } else if (num <= 128){
            // avoid initializing loop counters if only one iteration
            out.append(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
            out.append(SIXTY_FOUR_SPACES, 0, num - SIXTY_FOUR);
        } else {
            int times = num / SIXTY_FOUR;
            int rem = num % SIXTY_FOUR;
            for (int i = 0; i< times; i++) {
                out.append(SIXTY_FOUR_SPACES, 0, SIXTY_FOUR);
            }
            out.append(SIXTY_FOUR_SPACES, 0, rem);
            return;
        }
    }
909087
private static char[] getIndent(int indentSize, Map<Integer, char[]> indentCache) {
        char[] indent = indentCache.get(indentSize);
        if (indent == null) {
            indent = new char[indentSize];
            Arrays.fill(indent, SPACE);
            indentCache.put(indentSize, indent);
        }

        return indent;
    }
866098
private void checkMarkupLevel(final int markupLevel) {
        if (markupLevel >= this.matchedMarkupLevels.length) {
            final int newLen = Math.max(markupLevel + 1, this.matchedMarkupLevels.length + MATCHED_MARKUP_LEVELS_LEN);
            final boolean[] newMatchedMarkupLevels = new boolean[newLen];
            Arrays.fill(newMatchedMarkupLevels, false);
            System.arraycopy(this.matchedMarkupLevels, 0, newMatchedMarkupLevels, 0, this.matchedMarkupLevels.length);
            this.matchedMarkupLevels = newMatchedMarkupLevels;
        }
    }
866579
protected void writeIndent() throws IOException {
		final int start = writeLineSepartor ? 0 : offsetNewLine;
		final int level = (depth > maxIndentLevel) ? maxIndentLevel : depth;
		out.write(indentationBuf, start, ((level - 1) * indentationJump) + offsetNewLine);
	}
837437
def determine_indentation(self):
        """"""
        # Ensuring NEWLINE tokens are actually specified as such
        if self.current.tokenum != NEWLINE and self.current.value == '\n':
            self.current.tokenum = NEWLINE

        # I want to change dedents into indents, because they seem to screw nesting up
        if self.current.tokenum == DEDENT:
            self.current.tokenum, self.current.value = self.convert_dedent()

        if self.after_space and not self.is_space and (not self.in_container or self.just_started_container):
            # Record current indentation level
            if not self.indent_amounts or self.current.scol > self.indent_amounts[-1]:
                self.indent_amounts.append(self.current.scol)

            # Adjust indent as necessary
            while self.adjust_indent_at:
                self.result[self.adjust_indent_at.pop()] = (INDENT, self.indent_type * (self.current.scol - self.groups.level))

        # Roll back groups as necessary
        if not self.is_space and not self.in_container:
            while not self.groups.root and self.groups.level >= self.current.scol:
                self.finish_hanging()
                self.groups = self.groups.parent

        # Reset indentation to deal with nesting
        if self.current.tokenum == INDENT and not self.groups.root:
           self.current.value = self.current.value[self.groups.level:]
843832
function(indent, c) {
		var iChar = c || ">";
		if (indent > 0) {
			for (var i=0; i<indent; ++i) this.logPrefix+=iChar;
		} else {
			this.logPrefix = this.logPrefix.substr(0,this.logPrefix.length+indent*iChar.length);
		}
	}
1108310
private void decreaseIndent() throws IOException
   {
      if (m_pretty)
      {
         m_writer.write('\n');
         m_indent = m_indent.substring(0, m_indent.length() - INDENT.length());
         m_writer.write(m_indent);
      }
      m_firstNameValuePair.pop();
   }
307965
def _get_indent(marker, s, tab_width=8):
    """"""
    # Figure out how much the marker is indented.
    INDENT_CHARS = tuple(' \t')
    start = s.index(marker)
    i = start
    while i > 0:
        if s[i - 1] not in INDENT_CHARS:
            break
        i -= 1
    indent = s[i:start]
    indent_width = 0
    for ch in indent:
        if ch == ' ':
            indent_width += 1
        elif ch == '\t':
            indent_width += tab_width - (indent_width % tab_width)
    return indent, indent_width
651786
protected void correctIndentation() {
    	// TODO: Fix
//        if(this.parentList != null) {
//            this.leftIndent = this.leftIndent + this.parentList.getLeftIndent() + this.parentList.getFirstIndent();
//        }
        for(int i = 0; i < this.items.size(); i++) {
            if(this.items.get(i) instanceof RtfList) {
                ((RtfList) this.items.get(i)).correctIndentation();
            } else if(this.items.get(i) instanceof RtfListItem) {
                ((RtfListItem) this.items.get(i)).correctIndentation();
            }
        }
    }
1167018
def collapse_indents(indentation):
    """"""
    change_in_level = ind_change(indentation)
    if change_in_level == 0:
        indents = ""
    elif change_in_level < 0:
        indents = closeindent * (-change_in_level)
    else:
        indents = openindent * change_in_level
    return indentation.replace(openindent, "").replace(closeindent, "") + indents
1258005
def set_block_scalar_indent(token_class):
        """"""
        def callback(lexer, match, context):
            text = match.group()
            context.block_scalar_indent = None
            if not text:
                return
            increment = match.group(1)
            if increment:
                current_indent = max(context.indent, 0)
                increment = int(increment)
                context.block_scalar_indent = current_indent + increment
            if text:
                yield match.start(), token_class, text
                context.pos = match.end()
        return callback