Add Ldaprc lexer by bersace · Pull Request #2532 · pygments/pygments

@bersace

Hello,

Here is a new lexer to highlight ldaprc files.

Regards,
Étienne

jeanas

jeanas

Choose a reason for hiding this comment

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

Thanks.

While the lexer isn't very complicated, I do wonder if you can simplify it. It looks like all the lines have the form <keyword> <whitespace> <value>. Is it possible to use just a few rules like

(r'(\w+)(\s+)(\d+)', bygroups(Keyword, Whitespace, Keyword.Constant),
(r'(\w+)(\s+)(\w+)', bygroups(Keyword, Whitespace, Literal),
...

?

@bersace

Thanks for the review !

While the lexer isn't very complicated, I do wonder if you can simplify it. It looks like all the lines have the form <keyword> <whitespace> <value>. Is it possible to use just a few rules like

(r'(\w+)(\s+)(\d+)', bygroups(Keyword, Whitespace, Keyword.Constant),
(r'(\w+)(\s+)(\w+)', bygroups(Keyword, Whitespace, Literal),
...

?

That was my first attempt. I updated to match how DockerLexer is done.

(J'ai été longtemps Charentonnais 👋 )

@jeanas

I've fixed a few things, such as adding url and regenerating map files.

@bersace @jeanas

Co-Authored-By: Jean Abou Samra <jean@abou-samra.fr>

@jeanas