From: Oleg Broytman Date: Sun, 19 Mar 2017 16:16:11 +0000 (+0300) Subject: Fix: test if token is an instance of Comment X-Git-Tag: 0.1.0~8 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=3ca451ce7cd26a5444c2dc3897f7559db062de59;p=sqlconvert.git Fix: test if token is an instance of Comment --- diff --git a/sqlconvert/process_tokens.py b/sqlconvert/process_tokens.py index e55513e..cb14467 100644 --- a/sqlconvert/process_tokens.py +++ b/sqlconvert/process_tokens.py @@ -1,4 +1,5 @@ +from sqlparse.sql import Comment from sqlobject.converters import sqlrepr from sqlparse import parse from sqlparse.compat import PY3 @@ -14,8 +15,9 @@ def find_error(token_list): def is_comment_or_space(token): - return token.ttype in (T.Comment.Single, T.Comment.Multiline, - T.Newline, T.Whitespace) + return isinstance(token, Comment) or \ + token.ttype in (T.Comment, T.Comment.Single, T.Comment.Multiline, + T.Newline, T.Whitespace) def is_newline_statement(statement):