Skip to content
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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Add a Lexer for Numba IR #2433

wants to merge 5 commits into from

Conversation

Matt711
Copy link
Contributor

@Matt711 Matt711 commented May 16, 2023

Add a Lexer for Numba Intermediate Representation (IR).

@Matt711 Matt711 marked this pull request as draft May 18, 2023 16:25
Copy link
Contributor

@jeanas jeanas left a 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.

Comment on lines +61 to +63
(words((
'del', 'jump', 'call', 'branch',
), suffix=' '), Keyword),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(words((
'del', 'jump', 'call', 'branch',
), suffix=' '), Keyword),
(words(('del', 'jump', 'call', 'branch'), prefix=r'(', suffix=r')( )'), bygroups(Keyword, Whitespace)),

Comment on lines +66 to +68
'whitespace': [
(r'(\n|\s)', Text),
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'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

@gmarkall
Copy link

(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.

@@ -1,3 +1,4 @@
# Copyright (c) 2023, NVIDIA CORPORATION.
Copy link
Contributor

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.

@gmarkall
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants