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
-
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
Literal
s 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