Test a token against a token expression. This can either be a token type or ``'token_type:token_value'``. This can only test against string values and types.
(self, expr)
| 245 | return self.type |
| 246 | |
| 247 | def test(self, expr): |
| 248 | """Test a token against a token expression. This can either be a |
| 249 | token type or ``'token_type:token_value'``. This can only test |
| 250 | against string values and types. |
| 251 | """ |
| 252 | # here we do a regular string equality check as test_any is usually |
| 253 | # passed an iterable of not interned strings. |
| 254 | if self.type == expr: |
| 255 | return True |
| 256 | elif ':' in expr: |
| 257 | return expr.split(':', 1) == [self.type, self.value] |
| 258 | return False |
| 259 | |
| 260 | def test_any(self, *iterable): |
| 261 | """Test against multiple token expressions.""" |