class PDF::Reader::Parser

def dictionary

reads a PDF dict from the buffer and converts it to a Ruby Hash.
###############################################################################
def dictionary
  dict = {}
  loop do
    key = parse_token
    break if key.kind_of?(Token) and key == ">>"
    raise MalformedPDFError, "unterminated dict" if @buffer.empty?
    PDF::Reader::Error.validate_type_as_malformed(key, "Dictionary key", Symbol)
    value = parse_token
    value.kind_of?(Token) and Error.str_assert_not(value, ">>")
    dict[key] = value
  end
  dict
end