(tlist)
| 378 | |
| 379 | @recurse(sql.Function) |
| 380 | def group_functions(tlist): |
| 381 | has_create = False |
| 382 | has_table = False |
| 383 | has_as = False |
| 384 | for tmp_token in tlist.tokens: |
| 385 | if tmp_token.value.upper() == 'CREATE': |
| 386 | has_create = True |
| 387 | if tmp_token.value.upper() == 'TABLE': |
| 388 | has_table = True |
| 389 | if tmp_token.value == 'AS': |
| 390 | has_as = True |
| 391 | if has_create and has_table and not has_as: |
| 392 | return |
| 393 | |
| 394 | tidx, token = tlist.token_next_by(t=T.Name) |
| 395 | while token: |
| 396 | nidx, next_ = tlist.token_next(tidx) |
| 397 | if isinstance(next_, sql.Parenthesis): |
| 398 | over_idx, over = tlist.token_next(nidx) |
| 399 | if over and isinstance(over, sql.Over): |
| 400 | eidx = over_idx |
| 401 | else: |
| 402 | eidx = nidx |
| 403 | tlist.group_tokens(sql.Function, tidx, eidx) |
| 404 | tidx, token = tlist.token_next_by(t=T.Name, idx=tidx) |
| 405 | |
| 406 | |
| 407 | @recurse(sql.Identifier) |
nothing calls this directly
no test coverage detected
searching dependent graphs…