def error(self, tokens, index):
    token = tokens[index]
    if self.debug.get('local_print', False):
        print(self.text)
        print(((' ' * (token.offset + len(str(token.value)))) + '^'))
        print(("Syntax error at or near token '%s'" % token.value))
        if (('context' in self.debug) and self.debug['context']):
            super(LocationParser, self).error(tokens, index)
    raise LocationError(self.text, ((' ' * (token.offset + len(str(token.value)))) + '^'))
def error(self, tokens, index):
    token = tokens[index]
    if self.debug.get('local_print', False):
        print(self.text)
        print(((' ' * (token.offset + len(str(token.value)))) + '^'))
        print(("Syntax error at or near token '%s'" % token.value))
        if (('context' in self.debug) and self.debug['context']):
            super(LocationParser, self).error(tokens, index)
    raise LocationError(self.text, ((' ' * (token.offset + len(str(token.value)))) + '^'))