Skip to content

Conversation

@jlchmura
Copy link

@jlchmura jlchmura commented Dec 24, 2024

Description

This PR adds syntax highlighting for the LPC language, a C-like language used in MUD drivers such as LDMud and FluffOS.

Checklist:

@jlchmura
Copy link
Author

Note to the maintainers: I was not able to write a heuristic that could handle samples/c/nightmare.h since C and LPC are so similar in that regard. Do you recommend removing LPC from the .h extension, and let the user override via gitattributes linguist-language?

@jlchmura jlchmura marked this pull request as ready for review December 26, 2024 19:26
@jlchmura jlchmura requested a review from a team as a code owner December 26, 2024 19:26
@jlchmura
Copy link
Author

This PR will close #7178

@jlchmura
Copy link
Author

jlchmura commented Jan 5, 2025

@Alhadis @lildude Can you add this PR to your to-do list to review?

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

Please review your regexes to ensure they run linearly and do not suffer from ReDoS... your lpc pattern definitely suffers from ReDoS.

Please also update your sample to only include real-world examples. Several of your samples are contrived just to validate the syntax highlighter. Additionally, the sample that is suppressed in the diff indicates it's too big for our needs so will need removing or reducing.

@lildude lildude added the Stale label Apr 25, 2025
Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

This PR is being held back by the fact you have not addressed the feedback about the vulnerable regexes in the heuristics.

@jlchmura
Copy link
Author

ReDos has been addressed. Also replaced samples as requested.

@lildude I still need advice on samples/c/nightmare.h. Remove LPC from the .h extension?

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

Your regexes are still vulnerable to ReDoS.

@lildude I still need advice on samples/c/nightmare.h. Remove LPC from the .h extension?

Whooops. Sorry I missed that. If you can't write a heuristic that only matches LPC, then it's best to leave it off. We fought for years trying to find the compromise we currently have, and even have it documented in our troubleshooting guide.

The same applies for your .c heuristic - it need to 100% only match LPC as I don't want to get into a similar battle with C.

The regexes also need to be safe from ReDos and RE2 compatible.

@lildude lildude removed the Stale label Jan 13, 2026
@jlchmura
Copy link
Author

Thanks @lildude.
I reworked the LPC named pattern to make it even more LPC-specific, and removed the ReDoS-vulnerable negative patterns in the heuristic, which I don't believe are needed anymore.

Let me know...

@jlchmura jlchmura requested a review from lildude January 18, 2026 15:19
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