pyebnf/compiler.py
def _indent(self, text, depth=1, *, skip_first_line=False, suffix=""):
    """Indent text by depth * self.indent.

    Text can be either a string, or a list of strings. If it is a string, it will be split on
    newline to a list of strings.

    if skip_first_line is true, the first line will not be indented like the others.
    """
    as_list = isinstance(text, list)

    if as_list:
      lines = text
    else:
      lines = text.split("\n")
    new_lines = []

    if isinstance(depth, int):
      spacing = self.indent * depth
    else:
      spacing = depth

    for i, line in enumerate(lines):
      if skip_first_line and i == 0:
        new_lines.append("{0}{1}".format(line, suffix))
      else:
        new_lines.append("{0}{1}{2}".format(spacing, line, suffix))

    if as_list:
      return new_lines
    else:
      return "\n".join(new_lines)
def _indent(self, text, depth=1, *, skip_first_line=False, suffix=""):
    """Indent text by depth * self.indent.

    Text can be either a string, or a list of strings. If it is a string, it will be split on
    newline to a list of strings.

    if skip_first_line is true, the first line will not be indented like the others.
    """
    as_list = isinstance(text, list)

    if as_list:
      lines = text
    else:
      lines = text.split("\n")
    new_lines = []

    if isinstance(depth, int):
      spacing = self.indent * depth
    else:
      spacing = depth

    for i, line in enumerate(lines):
      if skip_first_line and i == 0:
        new_lines.append("{0}{1}".format(line, suffix))
      else:
        new_lines.append("{0}{1}{2}".format(spacing, line, suffix))

    if as_list:
      return new_lines
    else:
      return "\n".join(new_lines)
Indent text by depth * self.indent.

    Text can be either a string, or a list of strings. If it is a string, it will be split on
    newline to a list of strings.

    if skip_first_line is true, the first line will not be indented like the others.