From: Oleg Broytman Date: Sat, 27 Aug 2016 19:19:05 +0000 (+0300) Subject: Fix a bug: do not add additional newlines X-Git-Tag: 0.0.1~13 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=191f720863f5eb59af3162447de9a5a6f66ea59f;p=sqlconvert.git Fix a bug: do not add additional newlines As the package doesn't strip newlines from the input string (to preserve original newlines) there is no need to separate lines with additional newlines. --- diff --git a/mysql2sql/process_tokens.py b/mysql2sql/process_tokens.py index 7e32354..9e1e760 100644 --- a/mysql2sql/process_tokens.py +++ b/mysql2sql/process_tokens.py @@ -42,7 +42,7 @@ class StatementGrouper(object): self.process_lines() def process_lines(self): - statements = parse('\n'.join(self.lines)) + statements = parse(''.join(self.lines)) last_stmt = statements[-1] for i in xrange(len(last_stmt.tokens) - 1, 0, -1): token = last_stmt.tokens[i] @@ -64,7 +64,7 @@ class StatementGrouper(object): def close(self): if not self.lines: return - tokens = parse('\n'.join(self.lines)) + tokens = parse(''.join(self.lines)) for token in tokens: if (token.ttype not in (Comment.Single, Comment.Multiline, Newline, Whitespace)):