def do_keyword(self, pos, token):
if token in (self.KEYWORD_XREF, self.KEYWORD_STARTXREF):<EOL><INDENT>self.add_results(*self.pop(<NUM_LIT:1>))<EOL><DEDENT>elif token is self.KEYWORD_ENDOBJ:<EOL><INDENT>self.add_results(*self.pop(<NUM_LIT:4>))<EOL><DEDENT>elif token is self.KEYWORD_NULL:<EOL><INDENT>self.push((pos, None))<EOL><DEDENT>elif token is self.KEYWORD_R:<EOL><INDENT>try:<EOL><INDENT>((_, objid), (_, genno)) = self.pop(<NUM_LIT:2>)<EOL>(objid, genno) = (int(objid), int(genno))<EOL>obj = PDFObjRef(self.doc, objid, genno)<EOL>self.push((pos, obj))<EOL><DEDENT>except PSSyntaxError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>elif token is self.KEYWORD_STREAM:<EOL><INDENT>((_, dic),) = self.pop(<NUM_LIT:1>)<EOL>dic = dict_value(dic)<EOL>objlen = <NUM_LIT:0><EOL>if not self.fallback:<EOL><INDENT>try:<EOL><INDENT>objlen = int_value(dic['<STR_LIT>'])<EOL><DEDENT>except KeyError:<EOL><INDENT>if STRICT:<EOL><INDENT>raise PDFSyntaxError('<STR_LIT>' % dic)<EOL><DEDENT><DEDENT><DEDENT>self.seek(pos)<EOL>try:<EOL><INDENT>(_, line) = self.nextline()  <EOL><DEDENT>except PSEOF:<EOL><INDENT>if STRICT:<EOL><INDENT>raise PDFSyntaxError('<STR_LIT>')<EOL><DEDENT>return<EOL><DEDENT>pos += len(line)<EOL>self.fp.seek(pos)<EOL>data = self.fp.read(objlen)<EOL>self.seek(pos+objlen)<EOL>while <NUM_LIT:1>:<EOL><INDENT>try:<EOL><INDENT>(linepos, line) = self.nextline()<EOL><DEDENT>except PSEOF:<EOL><INDENT>if STRICT:<EOL><INDENT>raise PDFSyntaxError('<STR_LIT>')<EOL><DEDENT>break<EOL><DEDENT>if b'<STR_LIT>' in line:<EOL><INDENT>i = line.index(b'<STR_LIT>')<EOL>objlen += i<EOL>if self.fallback:<EOL><INDENT>data += line[:i]<EOL><DEDENT>break<EOL><DEDENT>objlen += len(line)<EOL>if self.fallback:<EOL><INDENT>data += line<EOL><DEDENT><DEDENT>self.seek(pos+objlen)<EOL>if self.debug:<EOL><INDENT>logging.debug('<STR_LIT>' %(pos, objlen, dic, data[:<NUM_LIT:10>]))<EOL><DEDENT>obj = PDFStream(dic, data, self.doc.decipher)<EOL>self.push((pos, obj))<EOL><DEDENT>else:<EOL><INDENT>self.push((pos, token))<EOL><DEDENT>return<EOL>
Handles PDF-related keywords.