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

Method _token_matching

sqlparse/sql.py:227–247  ·  view source on GitHub ↗

next token that match functions

(self, funcs, start=0, end=None, reverse=False)

Source from the content-addressed store, hash-verified

225 return self.tokens
226
227 def _token_matching(self, funcs, start=0, end=None, reverse=False):
228 """next token that match functions"""
229 if start is None:
230 return None
231
232 if not isinstance(funcs, (list, tuple)):
233 funcs = (funcs,)
234
235 if reverse:
236 assert end is None
237 indexes = range(start - 2, -1, -1)
238 else:
239 if end is None:
240 end = len(self.tokens)
241 indexes = range(start, end)
242 for idx in indexes:
243 token = self.tokens[idx]
244 for func in funcs:
245 if func(token):
246 return idx, token
247 return None, None
248
249 def token_first(self, skip_ws=True, skip_cm=False):
250 """Returns the first child token.

Callers 5

token_firstMethod · 0.95
token_next_byMethod · 0.95
token_not_matchingMethod · 0.95
token_matchingMethod · 0.95
token_nextMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected