Skip to content

Conversation

@bersace
Copy link
Contributor

@bersace bersace commented Oct 5, 2023

Hello,

Here is a new lexer to highlight ldaprc files.

Regards,
Étienne

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.

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
Copy link
Contributor Author

bersace commented Oct 11, 2023

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
Copy link
Contributor

jeanas commented Oct 26, 2023

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

Co-Authored-By: Jean Abou Samra <[email protected]>
@jeanas jeanas merged commit 71de9cd into pygments:master Oct 26, 2023
@jeanas
Copy link
Contributor

jeanas commented Oct 26, 2023

Thank you!

@bersace bersace deleted the ldaprc branch October 26, 2023 11:45
@Anteru Anteru added this to the 2.17 milestone Nov 17, 2023
@Anteru Anteru added the A-lexing area: changes to individual lexers label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lexing area: changes to individual lexers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants