diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2015-04-12 15:13:16 +0200 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2015-04-12 15:13:16 +0200 |
| commit | d463a753216b5c9e2c7f2b3c8a48fa76cbdb73c2 (patch) | |
| tree | ed18fb65bfe8c4a565d95ee6ec407e5a10b9ff3e /sqlparse | |
| parent | e038a06f0c92a9aec95c9771bae22fb5e8f16432 (diff) | |
| parent | f775030692222a5a0b296284328276b65259cc02 (diff) | |
| download | sqlparse-d463a753216b5c9e2c7f2b3c8a48fa76cbdb73c2.tar.gz | |
Merge remote-tracking branch 'origin/master' into v0.2.0
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/filters.py | 1 | ||||
| -rw-r--r-- | sqlparse/lexer.py | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sqlparse/filters.py b/sqlparse/filters.py index 7e82f26..b187907 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -347,6 +347,7 @@ class ReindentFilter: nl = self.nl() added.add(nl) tlist.insert_before(token, nl) + offset += 1 token = _next_token(tlist.token_index(nl) + offset) def _split_statements(self, tlist): diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index a0cc7ae..602d275 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -141,10 +141,10 @@ class Lexer(compat.with_metaclass(LexerMeta)): 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'), @@ -163,6 +163,9 @@ class Lexer(compat.with_metaclass(LexerMeta)): # see https://github.com/andialbrecht/sqlparse/pull/64 (r'VALUES', tokens.Keyword), (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), (r'[^\W\d_]\w*(?=[.(])', tokens.Name), # see issue39 (r'[-]?0x[0-9a-fA-F]+', tokens.Number.Hexadecimal), (r'[-]?[0-9]*(\.[0-9]+)?[eE][-]?[0-9]+', tokens.Number.Float), |
