Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ldaprc lexer #2532

Merged
merged 1 commit into from
Oct 26, 2023
Merged

Add Ldaprc lexer #2532

merged 1 commit into from
Oct 26, 2023

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),
...

?

pygments/lexers/ldap.py Outdated Show resolved Hide resolved
pygments/lexers/ldap.py Outdated Show resolved Hide resolved
@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
15 checks passed
@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