def get_token(self):
if self.pushback:<EOL><INDENT>tok = self.pushback.popleft()<EOL>return tok<EOL><DEDENT>raw = self.read_token()<EOL>if self.source is not None:<EOL><INDENT>while raw == self.source:<EOL><INDENT>spec = self.sourcehook(self.read_token())<EOL>if spec:<EOL><INDENT>(newfile, newstream) = spec<EOL>self.push_source(newstream, newfile)<EOL><DEDENT>raw = self.get_token()<EOL><DEDENT><DEDENT>while raw == self.eof:<EOL><INDENT>if not self.filestack:<EOL><INDENT>return self.eof<EOL><DEDENT>else:<EOL><INDENT>self.pop_source()<EOL>raw = self.get_token()<EOL><DEDENT><DEDENT>return raw<EOL>
Get a token from the input stream (or from stack if it's nonempty)