From b68e4b781b8d74b0222411e83a16408a83cde7d6 Mon Sep 17 00:00:00 2001 From: Andi Albrecht Date: Mon, 24 Oct 2016 20:06:39 +0200 Subject: Fix special case for #284 when statement starts with orphaned AS. --- sqlparse/engine/grouping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sqlparse/engine') diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index 5fa3909..3c49201 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -380,7 +380,7 @@ def _group(tlist, cls, match, if match(token): nidx, next_ = tlist.token_next(tidx) - if valid_prev(prev_) and valid_next(next_): + if prev_ and valid_prev(prev_) and valid_next(next_): from_idx, to_idx = post(tlist, pidx, tidx, nidx) grp = tlist.group_tokens(cls, from_idx, to_idx, extend=extend) -- cgit v1.2.1