def _expect(self, tok_pattern):
        tok = self._accept(tok_pattern)
        if tok is not None:
            return tok
        if isinstance(tok_pattern, type):
            name = getattr(tok_pattern, 'name', tok_pattern.__name__)
            raise ParserError('Expected {}'.format(name),
                              token=self._peek())
        raise ParserError('Expected {}'.format(tok_pattern._data),
                          token=self._peek())
Accepts a token, or raises a ParserError if not found.
dataset/ETHPy150Open dansanderson/picotool/pico8/lua/parser.py/Parser._expect