Skip to content

Commit

Permalink
Merge pull request #216 from shenlongxing/master
Browse files Browse the repository at this point in the history
fix issue #215
  • Loading branch information
andialbrecht committed Dec 22, 2015
2 parents 7dd158b + d0124b8 commit a72f04c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sqlparse/engine/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _change_splitlevel(self, ttype, value):
return 1
return 0

if unified in ('END IF', 'END FOR'):
if unified in ('END IF', 'END FOR', 'END WHILE'):
return -1

if unified == 'END':
Expand All @@ -64,7 +64,7 @@ def _change_splitlevel(self, ttype, value):
self._is_create = True
return 0

if unified in ('IF', 'FOR') \
if unified in ('IF', 'FOR', 'WHILE') \
and self._is_create and self._begin_depth > 0:
return 1

Expand Down
1 change: 1 addition & 0 deletions sqlparse/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
'AS': tokens.Keyword,
'ELSE': tokens.Keyword,
'FOR': tokens.Keyword,
'WHILE': tokens.Keyword,

'CASE': tokens.Keyword,
'WHEN': tokens.Keyword,
Expand Down
2 changes: 1 addition & 1 deletion sqlparse/lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class _Lexer(object):
(r'(?<![\w\])])(\[[^\]]+\])', tokens.Name),
(r'((LEFT\s+|RIGHT\s+|FULL\s+)?(INNER\s+|OUTER\s+|STRAIGHT\s+)?'
r'|(CROSS\s+|NATURAL\s+)?)?JOIN\b', tokens.Keyword),
(r'END(\s+IF|\s+LOOP)?\b', tokens.Keyword),
(r'END(\s+IF|\s+LOOP|\s+WHILE)?\b', tokens.Keyword),
(r'NOT NULL\b', tokens.Keyword),
(r'CREATE(\s+OR\s+REPLACE)?\b', tokens.Keyword.DDL),
(r'DOUBLE\s+PRECISION\b', tokens.Name.Builtin),
Expand Down

0 comments on commit a72f04c

Please sign in to comment.