New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a Lexer for Numba IR #2433
base: master
Are you sure you want to change the base?
Add a Lexer for Numba IR #2433
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments; please also inline the 'keyword'
and 'whitespace'
states, which don't need to be separate.
(words(( | ||
'del', 'jump', 'call', 'branch', | ||
), suffix=' '), Keyword), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(words(( | |
'del', 'jump', 'call', 'branch', | |
), suffix=' '), Keyword), | |
(words(('del', 'jump', 'call', 'branch'), prefix=r'(', suffix=r')( )'), bygroups(Keyword, Whitespace)), |
'whitespace': [ | ||
(r'(\n|\s)', Text), | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'whitespace': [ | |
(r'(\n|\s)', Text), | |
], | |
'whitespace': [ | |
(r'\s+', Whitespace), | |
], |
Avoid “1 token per char”. See https://pygments.org/docs/lexerdevelopment/#common-pitfalls-and-best-practices
(I am working with @Matt711) @jeanas Many thanks for reviewing this - this PR was opened prior to us receiving approval to contribute it upstream to Pygments due to a miscommunication. Thank you for providing the suggestions above - we'll hold off updating the PR until we've received approval to make this contribution, then address the feedback above (I hope this won't delay things too long). Apologies for the slight confusion here. |
pygments/lexers/numbair.py
Outdated
@@ -1,3 +1,4 @@ | |||
# Copyright (c) 2023, NVIDIA CORPORATION. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this line?
There is already “Copyright 2006-2023 by the Pygments team, see AUTHORS”; you should add yourself or NVIDIA (not sure which is correct legally) there if you want to record the copyright.
We received permission / approval to make this contribution upstream, so we can now continue to work on this PR - many thanks for your time and understanding so far @jeanas, and apologies for the delay. |
Add a Lexer for Numba Intermediate Representation (IR).