Replies: 2 comments 1 reply
-
I do find many of these parsing libraries very interesting, and your parser there quite elegant. However, in my view, including a parser library is not something I want to do for this library. I agree that our style sheet parser is not the prettiest thing. But on the plus side, I find it quite easy to understand the current state, and to make local changes for a given state. I haven't felt like it's given me too much trouble when adding features, or making changes. When I look at your screenshot, I get the feeling that it's easier to write, but harder to read, and probably much harder to debug. Or maybe I just have a weird preference for hand-written parsers. In any case, my main reservation is that the parser works well right now. Let's not fix what ain't broken. I don't expect that we need to make any large, sweeping changes to our CSS parsing behavior. And we can always adapt it to the changes we do need to make, even if that takes some more effort. I have been bitten too many times by having an additional library that now needs to be maintained, adding one is very rarely free. |
Beta Was this translation helpful? Give feedback.
-
Yeah i agree with your points and im happy to leave things as is, just wanted your input more or less. |
Beta Was this translation helpful? Give feedback.
-
So we talked a bit about SCSS-ifying RmlUi or rather supporting more and more advanced CSS features on Gitter. The issue when i started looking into it was that the current StyleSheetParser is very unorthodox implementation of a language parser, limiting the ability to extend valid inputs apart from new properties. When i added the @media feature, this already was a pain to refactor.
As i then decided to give the SCSS-parsing a shot on my application side, i used https://github.com/taocpp/PEGTL , a template-based grammar parser which i also use for some internals in my application.
About 100 lines of template magic gives you a pretty competent parser that is also quite fast.
Small excerpt of the templates to define the grammar rules.
PEGTL requires C++17, which i know is not RmlUi's current support level, and also its of course another dependency on the stack.
So i'd just like to talk about if this is something we want to pursue or rather not.
Beta Was this translation helpful? Give feedback.
All reactions