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 lexer for Promela #2620

Merged
merged 8 commits into from
Jan 23, 2024
Merged

Add lexer for Promela #2620

merged 8 commits into from
Jan 23, 2024

Conversation

lmarzen
Copy link
Contributor

@lmarzen lmarzen commented Jan 2, 2024

This pull request adds a lexer for Promela. (https://spinroot.com/spin/whatispin.html)

Promela (Process Meta Language) is a C-like language used by SPIN to formally model software and hardware systems. SPIN (Simple Promela Interpreter) was originally developed in the 1980s at Bell Labs and since 1991 has been open-source and is a popular formal methods tool.

Pygments already supports other popular formal methods languages, including Isabelle, Coq, and NuSmv. Promela would be a fitting addition.

I have not included test snippets since PromelaLexer is derived from CLexer, though I have tested that it produces correct highlighting on a few of my own Promela files. Edit: I added snippets and examplefiles and ran tox -e check and tox -e mapfiles which both succeeded.

@cmarqu
Copy link
Contributor

cmarqu commented Jan 9, 2024

(Another potential pygments contributor here...)
You might want to add a line to the CHANGES file also.

@jeanas
Copy link
Contributor

jeanas commented Jan 13, 2024

You might want to add a line to the CHANGES file also.

Well, we (maintainers) update it ourselves; we don't ask contributors to do this. (But thank you for taking a look at the PR.)

pygments/lexers/c_like.py Outdated Show resolved Hide resolved
Co-authored-by: Jean Abou-Samra <jean@abou-samra.fr>
pygments/lexers/c_like.py Outdated Show resolved Hide resolved
pygments/lexers/_mapping.py Outdated Show resolved Hide resolved
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.

Looks OK. Since it seems this language can contain embedded C, shouldn't 'types' and 'keywords' have an inherit at the end to also highlight C types/keywords?

@lmarzen
Copy link
Contributor Author

lmarzen commented Jan 13, 2024

Promela does not have all the types and keywords of C. Only the ones I specified, so inherit, was initentially left out.

pygments/lexers/c_like.py Outdated Show resolved Hide resolved
pygments/lexers/c_like.py Outdated Show resolved Hide resolved
@jeanas jeanas merged commit 6b7e401 into pygments:master Jan 23, 2024
13 checks passed
@jeanas
Copy link
Contributor

jeanas commented Jan 23, 2024

Sorry for the delay. Thanks for your contribution!

@Anteru Anteru added this to the 2.18.0 milestone Apr 28, 2024
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

4 participants