From b737d2093eacf3c34e1eb413192f86f0d8623ecd Mon Sep 17 00:00:00 2001 From: Andi Albrecht Date: Thu, 17 Jun 2010 20:21:44 +0200 Subject: Improve detection of escaped single quotes (fixes issue13, reported by Martin Brochhaus, patch by bluemaro with test case by Dan Carley). --- sqlparse/lexer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sqlparse') diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index a416c16..b7b16af 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -175,8 +175,8 @@ class Lexer: (r'[+/@#%^&|`?^-]+', Operator), (r'[0-9]+', Number.Integer), # TODO: Backslash escapes? - (r"'(''|[^'])*'", String.Single), - (r'"(""|[^"])*"', String.Symbol), # not a real string literal in ANSI SQL + (r"(''|'.*?[^\\]')", String.Single), + (r'(""|".*?[^\\]")', String.Symbol), # not a real string literal in ANSI SQL (r'(LEFT |RIGHT )?(INNER |OUTER )?JOIN\b', Keyword), (r'END( IF| LOOP)?\b', Keyword), (r'CREATE( OR REPLACE)?\b', Keyword.DDL), -- cgit v1.2.1