diff options
| author | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-19 07:50:50 -0700 |
|---|---|---|
| committer | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-19 07:52:46 -0700 |
| commit | b3700f44ff6945d1ace9d5d809dd272c9acd268e (patch) | |
| tree | c4b67697f8158006eaa2ad26fadbcb06817a4c7f /sqlparse/engine | |
| parent | 24f0d3d650d4a83214c4a9539aa04cf4f3045f06 (diff) | |
| download | sqlparse-b3700f44ff6945d1ace9d5d809dd272c9acd268e.tar.gz | |
Previous fix for period failed when another token (non-groupable) followed.
Diffstat (limited to 'sqlparse/engine')
| -rw-r--r-- | sqlparse/engine/grouping.py | 11 |
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) |
