MCPcopy
hub / github.com/andialbrecht/sqlparse / token_next

Method token_next

sqlparse/sql.py:286–300  ·  view source on GitHub ↗

Returns the next token relative to *idx*. If *skip_ws* is ``True`` (the default) whitespace tokens are ignored. If *skip_cm* is ``True`` comments are ignored. ``None`` is returned if there's no next token.

(self, idx, skip_ws=True, skip_cm=False, _reverse=False)

Source from the content-addressed store, hash-verified

284
285 # TODO: May need to re-add default value to idx
286 def token_next(self, idx, skip_ws=True, skip_cm=False, _reverse=False):
287 """Returns the next token relative to *idx*.
288
289 If *skip_ws* is ``True`` (the default) whitespace tokens are ignored.
290 If *skip_cm* is ``True`` comments are ignored.
291 ``None`` is returned if there's no next token.
292 """
293 if idx is None:
294 return None, None
295 idx += 1 # alot of code usage current pre-compensates for this
296
297 def matcher(tk):
298 return not ((skip_ws and tk.is_whitespace)
299 or (skip_cm and imt(tk, t=T.Comment, i=Comment)))
300 return self._token_matching(matcher, idx, reverse=_reverse)
301
302 def token_index(self, token, start=0):
303 """Return list index of token."""

Callers 13

token_prevMethod · 0.95
insert_afterMethod · 0.95
get_typeMethod · 0.80
get_typecastMethod · 0.80
group_overFunction · 0.80
group_aliasedFunction · 0.80
group_functionsFunction · 0.80
group_valuesFunction · 0.80
_groupFunction · 0.80
_processMethod · 0.80

Calls 1

_token_matchingMethod · 0.95

Tested by 1