summaryrefslogtreecommitdiff
path: root/sqlparse/engine
diff options
context:
space:
mode:
Diffstat (limited to 'sqlparse/engine')
-rw-r--r--sqlparse/engine/grouping.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/sqlparse/engine/grouping.py b/sqlparse/engine/grouping.py
index 62357d3..42305c3 100644
--- a/sqlparse/engine/grouping.py
+++ b/sqlparse/engine/grouping.py
@@ -97,12 +97,17 @@ def group_period(tlist):
return imt(token, i=sqlcls, t=ttypes)
def valid_next(token):
+ # issue261, allow invalid next token
+ return True
+
+ def post(tlist, pidx, tidx, nidx):
+ # next_ validation is being performed here. issue261
sqlcls = sql.SquareBrackets, sql.Function
ttypes = T.Name, T.String.Symbol, T.Wildcard
- return token is None or imt(token, i=sqlcls, t=ttypes)
+ next_ = tlist[nidx] if nidx is not None else None
+ valid_next = imt(next_, i=sqlcls, t=ttypes)
- def post(tlist, pidx, tidx, nidx):
- return (pidx, nidx) if nidx is not None else (pidx, tidx)
+ return (pidx, nidx) if valid_next else (pidx, tidx)
_group(tlist, sql.Identifier, match, valid_prev, valid_next, post)