diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2015-12-22 05:31:44 +0100 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2015-12-22 05:31:44 +0100 |
| commit | a72f04cd1a3030dd1ac0a34b8fb6dba1b808fe97 (patch) | |
| tree | 2bd9000dc8eb0b32c8739890bfad3a75bf5e7e49 /sqlparse | |
| parent | 7dd158b772e15ab7adc5fdd5350c2cef285f651e (diff) | |
| parent | d0124b877739501187c76b6587856d86396123a7 (diff) | |
| download | sqlparse-a72f04cd1a3030dd1ac0a34b8fb6dba1b808fe97.tar.gz | |
Merge pull request #216 from shenlongxing/master
fix issue #215
Diffstat (limited to 'sqlparse')
| -rw-r--r-- | sqlparse/engine/filter.py | 4 | ||||
| -rw-r--r-- | sqlparse/keywords.py | 1 | ||||
| -rw-r--r-- | sqlparse/lexer.py | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/sqlparse/engine/filter.py b/sqlparse/engine/filter.py index 149db58..360ff9b 100644 --- a/sqlparse/engine/filter.py +++ b/sqlparse/engine/filter.py @@ -51,7 +51,7 @@ class StatementFilter: 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': @@ -64,7 +64,7 @@ class StatementFilter: 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 diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index 1595aa8..b3bda86 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -565,6 +565,7 @@ KEYWORDS_COMMON = { 'AS': tokens.Keyword, 'ELSE': tokens.Keyword, 'FOR': tokens.Keyword, + 'WHILE': tokens.Keyword, 'CASE': tokens.Keyword, 'WHEN': tokens.Keyword, diff --git a/sqlparse/lexer.py b/sqlparse/lexer.py index d0f8e3b..7dd013e 100644 --- a/sqlparse/lexer.py +++ b/sqlparse/lexer.py @@ -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), |
