def peek(self, *types, **kw):
        """Returns the token type for lookahead; if there are any args
        then the list of args is the set of token types to allow"""
        context = kw.get("context",None)
        if self.last_token is None:
            self.last_types = types
            self.last_token = self.token(types,context)
        elif self.last_types:
            for t in types:
                if t not in self.last_types:
                    raise NotImplementedError("Unimplemented: restriction set changed")
        return self.last_token.type
dataset/ETHPy150Open smurfix/yapps/yapps/runtime.py/Scanner.peek/original