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 Macaulay2 lexer #1791

Merged
merged 13 commits into from
Mar 31, 2022
Merged

Add Macaulay2 lexer #1791

merged 13 commits into from
Mar 31, 2022

Conversation

d-torrance
Copy link
Contributor

Macaulay2 is a computer algebra system that is widely used for research in algebraic geometry and commutative algebra. It comes with its own programming language, and it would be great if support were added to Pygments, e.g., for syntax highlighting Macaulay2 code in journal articles using minted.

The lists of symbols are generated automatically using the script make-M2-symbols.m2 in the Macaulay2 source. See Macaulay2/M2#2040.

@Anteru Anteru added changelog-update Items which need to get mentioned in the changelog A-lexing area: changes to individual lexers labels May 5, 2021
@d-torrance
Copy link
Contributor Author

Macaulay2 1.18 was just released, so I've pushed a new commit with some updated symbols.

@Anteru Anteru added the update needed Waiting for an update from the PR/issue creator label Jun 20, 2021
@d-torrance
Copy link
Contributor Author

I notice there's an "updated needed" label. What update is requested?

pygments/lexers/macaulay2.py Outdated Show resolved Hide resolved
pygments/lexers/macaulay2.py Show resolved Hide resolved
@Anteru
Copy link
Collaborator

Anteru commented Jul 18, 2021

I notice there's an "updated needed" label. What update is requested?

Looks like I forgot to request changes when I reviewed. My bad -- sorry. Should be online now.

@d-torrance
Copy link
Contributor Author

I notice there's an "updated needed" label. What update is requested?

Looks like I forgot to request changes when I reviewed. My bad -- sorry. Should be online now.

No problem! I believe I've addressed the comments.

pygments/lexers/macaulay2.py Outdated Show resolved Hide resolved
@d-torrance
Copy link
Contributor Author

Just pushed a couple new commits addressing the comments.

pygments/lexers/macaulay2.py Outdated Show resolved Hide resolved
pygments/lexers/macaulay2.py Outdated Show resolved Hide resolved
Instead of matching each character one at a time, we match all
characters without special meaning together.
@d-torrance
Copy link
Contributor Author

I've pushed a new commit addressing the latest comments (plus another updating the test output).

@Anteru Anteru removed the update needed Waiting for an update from the PR/issue creator label Aug 9, 2021
@Anteru
Copy link
Collaborator

Anteru commented Aug 15, 2021

Thanks, that looks much better now. I'll merge this soon, just waiting for any post 2.10 fallout which might require a point release.

@Anteru Anteru added this to the 2.11.0 milestone Aug 15, 2021
@d-torrance
Copy link
Contributor Author

I've just pushed a new commit updating the symbols for the latest release of Macaulay2.

@Anteru
Copy link
Collaborator

Anteru commented Nov 21, 2021

Can you please move the comment somewhere further down the file? The automated check expects each file to start with a docstring.

@d-torrance
Copy link
Contributor Author

Can you please move the comment somewhere further down the file? The automated check expects each file to start with a docstring.

Done!

@Anteru Anteru self-assigned this Nov 28, 2021
@d-torrance
Copy link
Contributor Author

Am I correct that the failed test is unrelated to this pull request?

  =================================== FAILURES ===================================
  ____________________ test_long_unclosed_javascript_fragment ____________________
  
  lexer_html = <pygments.lexers.HtmlLexer>
  
      def test_long_unclosed_javascript_fragment(lexer_html):
          """unclosed, long Javascript fragments should parse quickly"""
      
          reps = 2000
          fragment = "<script type=\"text/javascript\">"+"alert(\"hi\");"*reps
          start_time = time.time()
          tokens = list(lexer_html.get_tokens(fragment))
  >       assert time.time() - start_time < MAX_HL_TIME, \
              'The HTML lexer might have an expensive error script case'
  E       AssertionError: The HTML lexer might have an expensive error script case
  E       assert (1638127016.9544926 - 1638127006.3483639) < 10
  E        +  where 1638127016.9544926 = <built-in function time>()
  E        +    where <built-in function time> = time.time
  
  /home/runner/work/pygments/pygments/tests/test_html_lexer.py:53: AssertionError
  =========================== short test summary info ============================
  FAILED tests/test_html_lexer.py::test_long_unclosed_javascript_fragment - Ass...
  ============ 1 failed, 3809 passed, 12 skipped in 390.88s (0:06:30) ============
  make: *** [Makefile:54: test] Error 1

@Anteru
Copy link
Collaborator

Anteru commented Nov 29, 2021

This is PyPy3 failing and it's been very flaky recently, so yes, unrelated. @birkenfeld any concerns disabling PyPy3 until we find a way to make it not fail with 50% chance?

@birkenfeld
Copy link
Member

Sure!

@Anteru Anteru modified the milestones: 2.11.0, 2.12.0 Dec 30, 2021
@d-torrance
Copy link
Contributor Author

I noticed that this was bumped to the next release milestone. I believe all the requested changes have been addressed -- am I missing something?

@Anteru
Copy link
Collaborator

Anteru commented Jan 4, 2022

No, I just had to make the cut somewhere for the release (and that still went not as great as hoped for ...) It's firmly going into the next one, assuming the fallout from the current one is resolved (and to avoid creating a release branch for point releases I'm not merging this yet.)

@d-torrance
Copy link
Contributor Author

I've updated this branch so it no longer conflicts with master after the recent languages.rst updates and also added a url field.

@Anteru
Copy link
Collaborator

Anteru commented Mar 30, 2022

Dang it, this fails due to a missing copyright string. Can you please check once more and I'll merge this tomorrow? Sorry for leaving you hanging here more than half a year :(

@d-torrance
Copy link
Contributor Author

Dang it, this fails due to a missing copyright string. Can you please check once more and I'll merge this tomorrow? Sorry for leaving you hanging here more than half a year :(

The test passes after I bump the final copyright year from 2021 to 2022. I just pushed a commit with the fix.

@Anteru
Copy link
Collaborator

Anteru commented Mar 31, 2022

Thanks. Assuming CI passes this goes in -- thanks again for your contribution!

@Anteru Anteru merged commit aa385f0 into pygments:master Mar 31, 2022
@Anteru Anteru removed the changelog-update Items which need to get mentioned in the changelog label Mar 31, 2022
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.

None yet

3 participants