Message293789
| Author |
vstinner |
| Recipients |
georg.brandl, josephgordon, martin.panter, meador.inge, serhiy.storchaka, vstinner |
| Date |
2017年05月16日.21:09:26 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1494968966.72.0.705937345545.issue25324@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Another example from Tools/i18n/pygettext.py, TokenEater::
def __call__(self, ttype, tstring, stup, etup, line):
# dispatch
## import token
## print >> sys.stderr, 'ttype:', token.tok_name[ttype], \
## 'tstring:', tstring
self.__state(ttype, tstring, stup[0])
...
eater.set_filename(filename)
try:
tokens = tokenize.tokenize(fp.readline)
for _token in tokens:
eater(*_token)
Another example using token.tok_name with token types coming from tokenize. |
|