def __init__(self, string_or_filelike, parser_delegate):
if hasattr(string_or_filelike, '<STR_LIT>'):<EOL><INDENT>line_reader = string_or_filelike.readline<EOL><DEDENT>else:  <EOL><INDENT>if six.PY2:<EOL><INDENT>string_or_filelike = unicode(string_or_filelike)<EOL><DEDENT>string_io = io.StringIO(string_or_filelike)<EOL>line_reader = string_io.readline<EOL><DEDENT>def _text_line_reader():<EOL><INDENT>line = line_reader()<EOL>if isinstance(line, bytes):<EOL><INDENT>line = line.decode('<STR_LIT:utf8>')<EOL><DEDENT>return line<EOL><DEDENT>self._token_generator = tokenize.generate_tokens(_text_line_reader)<EOL>self._filename = getattr(string_or_filelike, '<STR_LIT:name>', None)<EOL>self._current_token = None<EOL>self._delegate = parser_delegate<EOL>self._advance_one_token()<EOL>
Construct the parser.

        Args:
          string_or_filelike: Either the string to parse, or a file-like object
            supporting the readline method.
          parser_delegate: An instance of the ParserDelegate class, that will be
            responsible for constructing appropriate objects for configurable
            references and macros.