Skip to content

Add AMPL lexer - #1219

Merged
alecthomas merged 4 commits into
alecthomas:masterfrom
nunnsy:nunnsy/add-ampl
Feb 21, 2026
Merged

alecthomas merged 4 commits into
alecthomas:masterfrom
nunnsy:nunnsy/add-ampl

Conversation

@nunnsy

@nunnsy nunnsy commented Feb 21, 2026 •

Copy link
Copy Markdown
Contributor

Add support for AMPL.

Largely based on pygments.lexers.ampl.AmplLexer from Pygments.

Add AMPL

Initial expected

Use record

Remove some context
@nunnsy
nunnsy marked this pull request as ready for review February 21, 2026 19:20
@nunnsy nunnsy changed the title Initial commit to add AMPL Add AMPL syntax Feb 21, 2026
@nunnsy nunnsy changed the title Add AMPL syntax Add AMPL lexer Feb 21, 2026
@nunnsy

nunnsy commented Feb 21, 2026

Copy link
Copy Markdown
Contributor Author

Happy to manually squash these sorry - had a few passes at this given the Pygments implementation isn't 100% true to the syntax.

Comment thread lexers/embedded/ampl.xml
<name>AMPL</name>
<alias>ampl</alias>
<filename>*.mod</filename>
<filename>*.run</filename>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What unfortunate file extensions...very common

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I'm happy to remove them here considering how niche the syntax is if you believe that's prudent.

@alecthomas
alecthomas merged commit dccba78 into alecthomas:master Feb 21, 2026
2 checks passed
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.

2 participants

⌂ 换网址