(tlist)
| 162 | |
| 163 | |
| 164 | def group_period(tlist): |
| 165 | def match(token): |
| 166 | for ttype, value in ((T.Punctuation, '.'), |
| 167 | (T.Operator, '->'), |
| 168 | (T.Operator, '->>')): |
| 169 | if token.match(ttype, value): |
| 170 | return True |
| 171 | return False |
| 172 | |
| 173 | def valid_prev(token): |
| 174 | sqlcls = sql.SquareBrackets, sql.Identifier |
| 175 | ttypes = T.Name, T.String.Symbol |
| 176 | return imt(token, i=sqlcls, t=ttypes) |
| 177 | |
| 178 | def valid_next(token): |
| 179 | # issue261, allow invalid next token |
| 180 | return True |
| 181 | |
| 182 | def post(tlist, pidx, tidx, nidx): |
| 183 | # next_ validation is being performed here. issue261 |
| 184 | sqlcls = sql.SquareBrackets, sql.Function |
| 185 | ttypes = T.Name, T.String.Symbol, T.Wildcard, T.String.Single |
| 186 | next_ = tlist[nidx] if nidx is not None else None |
| 187 | valid_next = imt(next_, i=sqlcls, t=ttypes) |
| 188 | |
| 189 | return (pidx, nidx) if valid_next else (pidx, tidx) |
| 190 | |
| 191 | _group(tlist, sql.Identifier, match, valid_prev, valid_next, post) |
| 192 | |
| 193 | |
| 194 | def group_as(tlist): |
nothing calls this directly
no test coverage detected
searching dependent graphs…