Skip to content

Import Luau lexer - #1209

Merged
alecthomas merged 1 commit into
alecthomas:masterfrom
JakobDev:luau
Mar 11, 2026
Merged

Import Luau lexer#1209
alecthomas merged 1 commit into
alecthomas:masterfrom
JakobDev:luau

Conversation

@JakobDev

Copy link
Copy Markdown
Contributor

This imports pygments.lexers.scripting.LuauLexer from Pygments.

Some notes:

  • The generated XML file is not 100% valid as as some elements have 2 state attributes, but it does work
  • I needed to tweak the import script to correctly convert the RegEx
  • I needed to add OperatorReserved as a TokenType
  • .luaurc is added as a filename to the JSON Lexer, as it's used by Luau

Implements #1062

Comment thread _tools/pygments2chroma_xml.py

@alecthomas alecthomas left a comment

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.

Would it make more sense to integrate this into the Lua lexer?

@JakobDev

JakobDev commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

Would it make more sense to integrate this into the Lua lexer?

Luau is based on Lua but it's a separate Language. See the documentation for more details.

Also Pygments has this as a separate lexer. It would be to much work to integrate this into the existing Lua lexer.

@JakobDev

Copy link
Copy Markdown
Contributor Author

Ping @alecthomas

@alecthomas
alecthomas merged commit 83b5491 into alecthomas:master Mar 11, 2026
2 checks passed
@JakobDev
JakobDev deleted the luau branch March 11, 2026 10:35
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