Returns the first child token. If *skip_ws* is ``True`` (the default), whitespace tokens are ignored. if *skip_cm* is ``True`` (default: ``False``), comments are ignored too.
(self, skip_ws=True, skip_cm=False)
| 247 | return None, None |
| 248 | |
| 249 | def token_first(self, skip_ws=True, skip_cm=False): |
| 250 | """Returns the first child token. |
| 251 | |
| 252 | If *skip_ws* is ``True`` (the default), whitespace |
| 253 | tokens are ignored. |
| 254 | |
| 255 | if *skip_cm* is ``True`` (default: ``False``), comments are |
| 256 | ignored too. |
| 257 | """ |
| 258 | # this on is inconsistent, using Comment instead of T.Comment... |
| 259 | def matcher(tk): |
| 260 | return not ((skip_ws and tk.is_whitespace) |
| 261 | or (skip_cm and imt(tk, t=T.Comment, i=Comment))) |
| 262 | return self._token_matching(matcher)[1] |
| 263 | |
| 264 | def token_next_by(self, i=None, m=None, t=None, idx=-1, end=None): |
| 265 | idx += 1 |