diff options
-rw-r--r-- | sqlparse/engine/grouping.py | 26 | ||||
-rw-r--r-- | tests/test_format.py | 1 |
2 files changed, 17 insertions, 10 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index 66ae807..7dfc219 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -209,7 +209,6 @@ def group_identifier_list(tlist): """ Create and group the identifiers list """ - print "group_identifierlist", start, after tokens = tlist.tokens_between(start, after) return tlist.group_tokens(sql.IdentifierList, tokens) @@ -235,20 +234,27 @@ def group_identifier_list(tlist): if start == None: start = before - def continue_next(): # Check the next token next_ = tlist.token_next(after) while next_: - # Next token is another comma or an identifier list keyword - if next_.match(T.Punctuation, ','): - return next_ - +# # Next token is another comma or an identifier list keyword +# if next_.match(T.Punctuation, ','): +# return next_ +# +# next_ = tlist.token_next(next_) + + passed = False + for func in fend1_funcs: + if func(next_): + passed = True + break + + if not passed: + break + + after = next_ next_ = tlist.token_next(next_) - tcomma = continue_next() - if tcomma: - continue - # Reached the end of the list # Create and group the identifiers list tcomma = group_identifierlist(start, after) diff --git a/tests/test_format.py b/tests/test_format.py index 0ec2192..c614fce 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -161,6 +161,7 @@ class TestFormatReindent(TestCaseBase): def test_identifier_list(self): f = lambda sql: sqlparse.format(sql, reindent=True) s = 'select foo, bar, baz from table1, table2 where 1 = 2' + print f(s) self.ndiffAssertEqual(f(s), '\n'.join(['select foo,', ' bar,', ' baz', |