protected internal PdfDictionary ReadDictionary() {
PdfDictionary dic = new PdfDictionary();
while (true) {
tokens.NextValidToken();
if (tokens.TokenType == PRTokeniser.TK_END_DIC)
break;
if (tokens.TokenType != PRTokeniser.TK_NAME)
tokens.ThrowError("Dictionary key is not a name.");
PdfName name = new PdfName(tokens.StringValue, false);
PdfObject obj = ReadPRObject();
int type = obj.Type;
if (-type == PRTokeniser.TK_END_DIC)
tokens.ThrowError("Unexpected '>>'");
if (-type == PRTokeniser.TK_END_ARRAY)
tokens.ThrowError("Unexpected ']'");
dic.Put(name, obj);
}
return dic;
}