From 191f720863f5eb59af3162447de9a5a6f66ea59f Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sat, 27 Aug 2016 22:19:05 +0300 Subject: [PATCH] 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. --- mysql2sql/process_tokens.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)): -- 2.39.2