build_list(margin)
  public
  
    
    
Builds a List flush to margin
   
  
    Show source    
    
      
  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
        if column < margin || (list.type && list.type != type) then
          unget
          break
        end
        list.type = type
        peek_type, _, column, = peek_token
        case type
        when :NOTE, :LABEL then
          if peek_type == :NEWLINE then
            
            
            while peek_type == :NEWLINE
              get
              peek_type, _, column, = peek_token
            end
            
            
            
            
            
            
            
            
            
            
            
            
            
            if peek_type.nil? || column < margin then
              empty = 1
            elsif column == margin then
              case peek_type
              when type
                empty = 2 
              when *LIST_TOKENS
                empty = 1
              else
                empty = 0
              end
            else
              empty = 0
            end
            if empty > 0 then
              item = RDoc::Markup::ListItem.new(data)
              item << RDoc::Markup::BlankLine.new
              list << item
              break if empty == 1
              next
            end
          end
        else
          data = nil
        end
        list_item = RDoc::Markup::ListItem.new data
        parse list_item, column
        list << list_item
      else
        unget
        break
      end
    end
    p :list_end => margin if @debug
    return nil if list.empty?
    list
  end