diff options
| author | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-05-11 10:33:13 -0700 |
|---|---|---|
| committer | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-12 12:31:27 -0700 |
| commit | 90ef13bf9a8ebdefab25669173e07ae5530e9c89 (patch) | |
| tree | 19b38fbb6b1b8a1eb34a51571da6edc1334589eb /sqlparse/engine | |
| parent | 50de51a5d6abb2a2f8649091912090983dab843d (diff) | |
| download | sqlparse-90ef13bf9a8ebdefab25669173e07ae5530e9c89.tar.gz | |
Add sql.Operation tokenlist
Diffstat (limited to 'sqlparse/engine')
| -rw-r--r-- | sqlparse/engine/grouping.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py index 91bb3d9..3bdc303 100644 --- a/sqlparse/engine/grouping.py +++ b/sqlparse/engine/grouping.py @@ -85,7 +85,8 @@ def group_assignment(tlist): def group_comparison(tlist): - I_COMPERABLE = (sql.Parenthesis, sql.Function, sql.Identifier) + I_COMPERABLE = (sql.Parenthesis, sql.Function, sql.Identifier, + sql.Operation) T_COMPERABLE = T_NUMERICAL + T_STRING + T_NAME func = lambda tk: imt(tk, t=T_COMPERABLE, i=I_COMPERABLE) or ( @@ -134,9 +135,9 @@ def group_arrays(tlist): @recurse(sql.Identifier) def group_operator(tlist): I_CYCLE = (sql.SquareBrackets, sql.Parenthesis, sql.Function, - sql.Identifier,) # sql.Operation) + sql.Identifier, sql.Operation) # wilcards wouldn't have operations next to them - T_CYCLE = T_NUMERICAL + T_STRING + T_NAME # + T.Wildcard + T_CYCLE = T_NUMERICAL + T_STRING + T_NAME func = lambda tk: imt(tk, i=I_CYCLE, t=T_CYCLE) token = tlist.token_next_by(t=(T.Operator, T.Wildcard)) @@ -146,8 +147,7 @@ def group_operator(tlist): if func(left) and func(right): token.ttype = T.Operator tokens = tlist.tokens_between(left, right) - # token = tlist.group_tokens(sql.Operation, tokens) - token = tlist.group_tokens(sql.Identifier, tokens) + token = tlist.group_tokens(sql.Operation, tokens) token = tlist.token_next_by(t=(T.Operator, T.Wildcard), idx=token) @@ -155,7 +155,7 @@ def group_operator(tlist): @recurse(sql.IdentifierList) def group_identifier_list(tlist): I_IDENT_LIST = (sql.Function, sql.Case, sql.Identifier, sql.Comparison, - sql.IdentifierList) # sql.Operation + sql.IdentifierList, sql.Operation) T_IDENT_LIST = (T_NUMERICAL + T_STRING + T_NAME + (T.Keyword, T.Comment, T.Wildcard)) @@ -212,7 +212,7 @@ def group_where(tlist): @recurse() def group_aliased(tlist): I_ALIAS = (sql.Parenthesis, sql.Function, sql.Case, sql.Identifier, - ) # sql.Operation) + sql.Operation) token = tlist.token_next_by(i=I_ALIAS, t=T.Number) while token: |
