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

Lexer for new language Maxima #1885

Merged
merged 13 commits into from
Sep 4, 2021
Merged

Lexer for new language Maxima #1885

merged 13 commits into from
Sep 4, 2021

Conversation

robert-dodier
Copy link
Contributor

This PR implements a Pygments lexer for Maxima, a computer algebra system. See: https://maxima.sourceforge.io

The Maxima lexer is derived from the lexer for MuPAD, another computer algebra system.

The PR contains the lexer implementation and an example input, foo.mac, and its expected output from pytest --update-goldens.

Copy link
Collaborator

@Anteru Anteru left a comment

Choose a reason for hiding this comment

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

Thanks! I found a few minor things, please check the review comments.

pygments/lexers/maxima.py Outdated Show resolved Hide resolved
pygments/lexers/maxima.py Outdated Show resolved Hide resolved
pygments/lexers/maxima.py Show resolved Hide resolved
pygments/lexers/maxima.py Show resolved Hide resolved
Robert Dodier added 11 commits August 22, 2021 09:54
 * New lexer class MaximaLexer
 * Update _mapping.py to include Maxima lexer
 * New test input file maxima/foo.mac

I find that the commands

$ python3 -m pygments -O full -f html -o /tmp/foo.html tests/examplefiles/maxima/foo.mac

$ python3 -m pygments -x -l pygments/lexers/maxima.py:MaximaLexer tests/examplefiles/maxima/foo.mac

both produce expected output.
Commit output from pytest tests/examplefiles/maxima --update-goldens
as obtained by Cameron Smith.
all at once, instead of capturing each character separately.

Update expected output for example input file, as produce by:

$ pytest tests/examplefiles/maxima --update-goldens
…gs such as operators

via the words function, instead of a long regex with alternation.

Incidentally update the example output, for which one symbol
(namely "done") has changed classification.
so integers are more accurately identified.

Update test example output accordingly.
Include additional test input for floats and update expected output.
@robert-dodier
Copy link
Contributor Author

Hi @Anteru I'm sorry for the bother, but can I ask you to review this PR again? I made the changes you requested (and some other improvements as well).

@Anteru
Copy link
Collaborator

Anteru commented Aug 28, 2021

I'll take another look this weekend. Please keep in mind that the next release will be in 2-3 months so it'll be a while until you'll see this packaged in a PyPI release.

@robert-dodier
Copy link
Contributor Author

I'll take another look this weekend. Please keep in mind that the next release will be in 2-3 months so it'll be a while until you'll see this packaged in a PyPI release.

Sounds good, you can let me know how it goes. There's no hurry, I just want to make sure the wheels are in motion. Thanks a lot for your help.

@Anteru Anteru merged commit 2755398 into pygments:master Sep 4, 2021
@Anteru
Copy link
Collaborator

Anteru commented Sep 4, 2021

Merged, thanks a lot!

@Anteru Anteru added this to the 2.11.0 milestone Sep 4, 2021
@Anteru Anteru added the A-lexing area: changes to individual lexers label Sep 4, 2021
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

2 participants