class RDoc::Markup::Parser

def build_list margin

def build_list margin
  p :list_start => margin if @debug
  list = RDoc::Markup::List.new
  until @tokens.empty? do
    type, data, column, = get
    case type
    when :BULLET, :LABEL, :LALPHA, :NOTE, :NUMBER, :UALPHA then
      list_type = type
      if column < margin then
        unget
        break
      end
      if list.type and list.type != list_type then
        unget
        break
      end
      list.type = list_type
      case type
      when :NOTE, :LABEL then
        _, indent, = get # SPACE
        if :NEWLINE == peek_token.first then
          get
          peek_type, new_indent, peek_column, = peek_token
          indent = new_indent if
            peek_type == :INDENT and peek_column >= column
          unget
        end
      else
        data = nil
        _, indent, = get
      end
      list_item = build_list_item(margin + indent, data)
      list << list_item if list_item
    else
      unget
      break
    end
  end
  p :list_end => margin if @debug
  return nil if list.empty?
  list
end