Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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