Skip to content

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.

@Anteru Anteru marked this pull request as ready for review January 5, 2025 13:53
@Anteru Anteru merged commit 08b8a96 into pygments:master Jan 5, 2025
@Anteru
Copy link
Collaborator

Anteru commented Jan 5, 2025

Merged, thanks!

@Anteru Anteru added this to the 2.19.0 milestone Jan 5, 2025
@Anteru Anteru added the A-lexing area: changes to individual lexers label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lexing area: changes to individual lexers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants