Return a callable object that returns whether a token is of the given type `token_type`.
(token_type)
| 1281 | |
| 1282 | |
| 1283 | def token_is(token_type): |
| 1284 | """Return a callable object that returns whether a token is of the |
| 1285 | given type `token_type`.""" |
| 1286 | |
| 1287 | def token_is_type(token): |
| 1288 | """Return whether a token is of a certain type or not.""" |
| 1289 | token = token[0] |
| 1290 | while token is not token_type and token.parent: |
| 1291 | token = token.parent |
| 1292 | return token is token_type |
| 1293 | |
| 1294 | return token_is_type |
| 1295 | |
| 1296 | |
| 1297 | def token_is_any_of(token_types): |
nothing calls this directly
no outgoing calls
no test coverage detected