From 8b5a957f4dad82fda0dc174538fdaf0860a9256a Mon Sep 17 00:00:00 2001 From: Andi Albrecht Date: Sun, 26 Jul 2015 11:05:58 +0200 Subject: Recognize MSSQL temp tables and distinguish from MySQL comments (fixes #192). --- sqlparse/lexer.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sqlparse/lexer.py') diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index 9533e8a..fd29f5c 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -164,10 +164,10 @@ class Lexer(object): tokens = { 'root': [ - (r'(--|#).*?(\r\n|\r|\n)', tokens.Comment.Single), + (r'(--|# ).*?(\r\n|\r|\n)', tokens.Comment.Single), # $ matches *before* newline, therefore we have two patterns # to match Comment.Single - (r'(--|#).*?$', tokens.Comment.Single), + (r'(--|# ).*?$', tokens.Comment.Single), (r'(\r\n|\r|\n)', tokens.Newline), (r'\s+', tokens.Whitespace), (r'/\*', tokens.Comment.Multiline, 'multiline-comments'), @@ -185,7 +185,7 @@ class Lexer(object): # FIXME(andi): VALUES shouldn't be listed here # see https://github.com/andialbrecht/sqlparse/pull/64 (r'VALUES', tokens.Keyword), - (r'@[^\W\d_]\w+', tokens.Name), + (r'(@|##|#)[^\W\d_]\w+', tokens.Name), # IN is special, it may be followed by a parenthesis, but # is never a functino, see issue183 (r'in\b(?=[ (])?', tokens.Keyword), -- cgit v1.2.1