Typehinting a tokenizer #1316
decorator-factory
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Just wanted to share a trick I found to improve editor support for a tokenizer.
If instead of a dict you pass in a sequence of tuples to define a tokenizer, the keys (token names) are treated as

Literals if they are string or integer literals:With this definition, token types are displayed and even narrowed:

Beta Was this translation helpful? Give feedback.
All reactions