class RDoc::Parser::Ruby

def parse_constant container, tk, comment, ignore_constants = false

def parse_constant container, tk, comment, ignore_constants = false
  line_no = tk[:line_no]
  name = tk[:text]
  skip_tkspace_without_nl
  return unless name =~ /^\w+$/
  new_modules = []
  if :on_op == peek_tk[:kind] && '::' == peek_tk[:text] then
    unget_tk tk
    container, name_t, _, new_modules = get_class_or_module container, true
    name = name_t[:text]
  end
  is_array_or_hash = false
  if peek_tk && :on_lbracket == peek_tk[:kind]
    get_tk
    nest = 1
    while bracket_tk = get_tk
      case bracket_tk[:kind]
      when :on_lbracket
        nest += 1
      when :on_rbracket
        nest -= 1
        break if nest == 0
      end
    end
    skip_tkspace_without_nl
    is_array_or_hash = true
  end
  unless peek_tk && :on_op == peek_tk[:kind] && '=' == peek_tk[:text] then
    return false
  end
  get_tk
  unless ignore_constants
    new_modules.each do |prev_c, new_module|
      prev_c.add_module_by_normal_module new_module
      new_module.ignore unless prev_c.document_children
      @top_level.add_to_classes_or_modules new_module
    end
  end
  value = ''
  con = RDoc::Constant.new name, value, comment
  body = parse_constant_body container, con, is_array_or_hash
  return unless body
  con.value = body
  record_location con
  con.line   = line_no
  read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
  return if is_array_or_hash
  @stats.add_constant con
  container.add_constant con
  true
end