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

New Language: Keepalived configure file #2417

Merged
merged 31 commits into from Oct 3, 2021
Merged

Conversation

dev-itsheng
Copy link
Contributor

@dev-itsheng dev-itsheng commented Jun 9, 2020

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
…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

Thank you for this language definition @dev-itsheng!

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

components/prism-keepalived.js Outdated Show resolved Hide resolved
components/prism-keepalived.js Outdated Show resolved Hide resolved
components/prism-keepalived.js Outdated Show resolved Hide resolved
components/prism-keepalived.js Outdated Show resolved Hide resolved
components/prism-keepalived.js Outdated Show resolved Hide resolved
components/prism-keepalived.js Outdated Show resolved Hide resolved
components/prism-keepalived.js Outdated Show resolved Hide resolved
components/prism-keepalived.js Outdated Show resolved Hide resolved
@dev-itsheng
Copy link
Contributor Author

@dev-itsheng dev-itsheng commented Jun 16, 2020

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

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?

components/prism-keepalived.js Outdated Show resolved Hide resolved
components/prism-keepalived.js Outdated Show resolved Hide resolved
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 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%).

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

@RunDevelopment RunDevelopment commented Oct 3, 2021

I quickly updated and finished the PR.

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

@RunDevelopment RunDevelopment commented Oct 3, 2021

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.

None yet

2 participants