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
![image](https://user-images.githubusercontent.com/42166884/103152368-3ed9e300-4798-11eb-9f4a-3721c4d5dd24.png)
Literal
s if they are string or integer literals:With this definition, token types are displayed and even narrowed:
![image](https://user-images.githubusercontent.com/42166884/103152408-aee86900-4798-11eb-8b06-aa11bfc16b8d.png)
Beta Was this translation helpful? Give feedback.
All reactions