next token that match functions
(self, funcs, start=0, end=None, reverse=False)
| 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. |
no outgoing calls
no test coverage detected