def unexpected(self): token = self.lookup() self.error('Unexpected: ' + JSLexer.tokenToStr(token))
def expect(self, token, value=None): if not self.match(token, value): if value == None: value = '' else: value = ' ' + value self.error('Expected:' + JSLexer.tokenToStr(token, value) + ' ,got \'' + self.lookup()[1] + '\'') return self.nextToken()