summaryrefslogtreecommitdiff
path: root/sqlparse/engine
diff options
context:
space:
mode:
authorDarik Gamble <darik.gamble@gmail.com>2015-03-04 10:41:34 -0500
committerDarik Gamble <darik.gamble@gmail.com>2015-03-04 10:41:34 -0500
commitb61fe36f718ca4f7c0b4e8d1cb81cc1370877905 (patch)
tree4f8d9f55cd82a2d525082eab5c2f99e7d3ac8134 /sqlparse/engine
parenta93029f38fc2a1a182da92cf361d700cbe2b79c2 (diff)
downloadsqlparse-b61fe36f718ca4f7c0b4e8d1cb81cc1370877905.tar.gz
Group square-brackets into identifiers
Indentifier.get_array_indices() looks for square brackets, and yields lists of bracket grouped tokens as array indices
Diffstat (limited to 'sqlparse/engine')
-rw-r--r--sqlparse/engine/grouping.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index 73679e3..a317044 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -159,16 +159,17 @@ def group_identifier(tlist):
lambda y: (y.match(T.Punctuation, '.')
or y.ttype in (T.Operator,
T.Wildcard,
- T.ArrayIndex,
- T.Name)),
+ T.Name)
+ or isinstance(y, sql.SquareBrackets)),
lambda y: (y.ttype in (T.String.Symbol,
T.Name,
T.Wildcard,
- T.ArrayIndex,
T.Literal.String.Single,
T.Literal.Number.Integer,
T.Literal.Number.Float)
- or isinstance(y, (sql.Parenthesis, sql.Function)))))
+ or isinstance(y, (sql.Parenthesis,
+ sql.SquareBrackets,
+ sql.Function)))))
for t in tl.tokens[i:]:
# Don't take whitespaces into account.
if t.ttype is T.Whitespace: