Skip to content

Conversation

@hroemer
Copy link
Contributor

@hroemer hroemer commented Apr 9, 2024

basic implementation for #2515 based upon PythonLexer

@Anteru
Copy link
Collaborator

Anteru commented Apr 9, 2024

This needs an example file, otherwise we can't merge this. A basic .mojo file should suffice (and make sure to update the golden test outputs.) See: https://pygments.org/docs/lexerdevelopment/#how-to-test-your-lexer

@hroemer
Copy link
Contributor Author

hroemer commented Apr 9, 2024

Thanks for guiding me along. I tested it locally (e.g. pygments -O full,style=emacs,linenos=1 -o test.html ...) and unfortunately was in a little rush here not reading the docs. I will add an according test file and output in the next couple of days, hopefully doing it more properly that time.

@hroemer
Copy link
Contributor Author

hroemer commented Apr 11, 2024

@Anteru I am currently struggling with tox. The command mentioned in the docs is not working out for me. I get tox: error: unrecognized arguments: --update-goldens. It works when adding the run command, but I cannot reason about the output, yet.

I guess I need to dig more into tox / pygments.

One general question as I don't have any experience with tox, but have done snapshot based testing (pytest / jest) in the past. Are the lexer tests similar to that?

Cheers

@jeanas
Copy link
Contributor

jeanas commented Apr 11, 2024

The command mentioned in the docs is not working out for me. I get tox: error: unrecognized arguments: --update-goldens.

It's tox -- --update-goldens, mind the extra --.

One general question as I don't have any experience with tox, but have done snapshot based testing (pytest / jest) in the past. Are the lexer tests similar to that?

Yes. And they're done with pytest, tox is just a test runner which saves you the time to install pytest in a virtual environment.

@hroemer
Copy link
Contributor Author

hroemer commented Apr 14, 2024

Thanks for your quick response and sorry for the delay. Github's device verification currently has a massive delay for emails. Login failed for 2 days now.

Actually I did use the double-dash, but I wasn't aware of tox automatic venv handling.
Thus, running tox "inside" another venv (PDM) didn't work out well.

Anyway, I got it working now and prepared snippets / examples.

@Anteru Anteru merged commit 5b0321e into pygments:master Apr 27, 2024
@Anteru
Copy link
Collaborator

Anteru commented Apr 27, 2024

Merged, thanks!

@Anteru Anteru added this to the 2.18.0 milestone Apr 27, 2024
@Anteru Anteru added the A-lexing area: changes to individual lexers label Apr 27, 2024
@Anteru Anteru linked an issue Apr 27, 2024 that may be closed by this pull request
@JonathonReinhart JonathonReinhart mentioned this pull request Apr 29, 2024
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.

Support Mojo

3 participants