diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2009-05-27 20:58:12 +0200 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2009-05-27 20:58:12 +0200 |
| commit | 895f021a0515dbf948efb1dfe960c0aa63cd160d (patch) | |
| tree | 7a68db321f6d58b458345cecef1b6a0ca7b9c4a5 /sqlparse/engine | |
| parent | 9917967e25669d21e577123583a2d3a191844c62 (diff) | |
| download | sqlparse-895f021a0515dbf948efb1dfe960c0aa63cd160d.tar.gz | |
Grouping of function/procedure calls.
Diffstat (limited to 'sqlparse/engine')
| -rw-r--r-- | sqlparse/engine/grouping.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index 471116e..66f4df5 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -245,8 +245,25 @@ def group_typecasts(tlist): _group_left_right(tlist, T.Punctuation, '::', Identifier) +def group_functions(tlist): + [group_functions(sgroup) for sgroup in tlist.get_sublists() + if not isinstance(sgroup, Function)] + idx = 0 + token = tlist.token_next_by_type(idx, T.Name) + while token: + next_ = tlist.token_next(token) + if not isinstance(next_, Parenthesis): + idx = tlist.token_index(token)+1 + else: + func = tlist.group_tokens(Function, + tlist.tokens_between(token, next_)) + idx = tlist.token_index(func)+1 + token = tlist.token_next_by_type(idx, T.Name) + + def group(tlist): for func in [group_parenthesis, + group_functions, group_comments, group_where, group_case, |
