mdevils/css-selector-parser

What is the reason for not using an existing parser?

Closed this issue · 3 comments

gajus commented

Hi @mdevils !

I am working on https://github.com/gajus/surgeon and I am looking for extendable CSS parser that would enable some of the syntactic sugar that the project requires.

node-css-selector-parser looks awesome. However, I am surprised that you choose to implement the entire parsing logic from the ground up. Is there a reason for not using https://pegjs.org, http://jison.org or https://github.com/Hardmath123/nearley?

gajus commented

@mdevils I have written a CSS selector parser using Earley algorithm.

https://github.com/gajus/scalpel

If you'd like to collaborate it, I am most up for it!

Hello, @gajus.

Would would be a benefit of using those parser generators?

I like to have this parser as an example of a clean Finite State Machine implementation.

gajus commented

Thank you for your response.

There is no need to do it. It was just a suggestion to use a higher level abstraction that is more broadly recognized and likely easier to maintain.