code: List<Token> analyzeIndentations(List<Token> tokens, Object lf) {
      if (tokens.isEmpty()) {
        return tokens;
      }
      int size = tokens.size();
      List<Token> result = Lists.arrayList(size + size / 16);
      Stack<Integer> indentations = new Stack<Integer>();
      boolean freshLine = true;
      int lfIndex = 0;
      for (Token token : tokens) {
        if (freshLine) {
          int indentation = token.index() - lfIndex;
          if (Objects.equals(token.value(), lf)) {
            // if first token on a line is lf, indentation is ignored.
            indentation = 0;
          }
          newLine(token, indentations, indentation, result);
        }
        if (Objects.equals(token.value(), lf)) {
          freshLine = true;
          lfIndex = token.index() + token.length();
        }
        else {
          freshLine = false;
          result.add(token);
        }
      }
      Token lastToken = tokens.get(tokens.size() - 1);
      int endIndex = lastToken.index() + lastToken.length();
      Token outdentToken = pseudoToken(endIndex, outdent);
      for (int i = 0; i < indentations.size() - 1; i++) {
        // add outdent for every remaining indentation except the first one
        result.add(outdentToken);
      }
      return result;
    }
docs: Analyzes indentation by looking at the first token after each {@code lf} and inserting
  {@code indent} and {@code outdent} tokens properly.