class CFPropertyList::PlainParser

def read_dict

def read_dict
  skip_whitespaces
  hsh = {}
  while not @doc.scan(/\}/)
    key = import_plain
    raise CFFormatError.new("invalid dictionary format") if !key
    if key.is_a?(CFString)
      key = key.value
    elsif key.is_a?(CFInteger) or key.is_a?(CFReal)
      key = key.value.to_s
    else
      raise CFFormatError.new("invalid key format")
    end
    skip_whitespaces
    raise CFFormatError.new("invalid dictionary format") unless @doc.scan(/=/)
    skip_whitespaces
    val = import_plain
    skip_whitespaces
    raise CFFormatError.new("invalid dictionary format") unless @doc.scan(/;/)
    skip_whitespaces
    hsh[key] = val
    raise CFFormatError.new("invalid dictionary format") if @doc.eos?
  end
  CFDictionary.new(hsh)
end