Skip to content

Conversation

@dev-itsheng
Copy link
Contributor

Keepalived is a load balancing tools, it has a configure grammar which like Nginx but not same:

  1. Semicolons are not used to delimit directives.
  2. Its keywords (In fact, I prefer to say it 'property' like CSS.) are different from Nginx.

So I collect all of properties from its document and write some token like ip, path which has alias pattern of commonly token name.

But the rule could not exactly right, because its document has also bug. In fact, I have made some PR to its GitHub repo with the wrong I found, There are still some errors that I did not find. Once found, I will update this language syntax and send PR to the that repo.

By the way, I think the nginx language could be rewrite like this. It is not C-Like grammar and could make lot of bugs in display. Maybe in next PR I will do it.

dev-itsheng added 25 commits May 3, 2020 17:27
…g detection, and added corresponding unit test.
… in `inside` object, Fix relational tests.
…ass` token (3) add `tag`, `selector-list`, `combinator` token
…`tag` behind the `n-th` token to avoid problem.
Copy link
Member

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

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

Thank you for this language definition @dev-itsheng!

I left you a few comments. Do you plan to include booleans as well?

@dev-itsheng
Copy link
Contributor Author

I accepted all the suggestions and fixed them.

In addition, I also did:

  1. Add support for IPv6 and subnet mask (in ip token).
  2. According to the latest documentation of keepalived, add supoprt for variable, conditional-configuration, boolean and operator.
  3. Make property token to two alphabetical sorting arrays, because the too long regex will make a error.
  4. According to the latest documentation of keepalived, update property, constant.
  5. Add more complete and detailed unit tests.

Copy link
Member

@RunDevelopment RunDevelopment left a comment

Choose a reason for hiding this comment

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

Thanks for the great work @dev-itsheng!

I looked over it again and left you some comments.

Make property token to two alphabetical sorting arrays, because the too long regex will make a error.

What do mean you by that? What error did you get?

Now our regex tooling can work its magic. This will make it easier to
maintain the regex in the long run.
@github-actions
Copy link

github-actions bot commented Oct 3, 2021

JS File Size Changes (gzipped)

A total of 2 files have changed, with a combined diff of +2.25 KB (+91.0%).

Details
file master pull size diff % diff
components/prism-keepalived.min.js 0 Bytes 2.23 KB +2.23 KB +100.0%
plugins/show-language/prism-show-language.min.js 2.47 KB 2.48 KB +17 B +0.7%

Generated by 🚫 dangerJS against e8194b1

@RunDevelopment
Copy link
Member

I quickly updated and finished the PR.

@RunDevelopment RunDevelopment merged commit d908e45 into PrismJS:master Oct 3, 2021
@RunDevelopment
Copy link
Member

Thank you for contributing @dev-itsheng!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants