Skip to content

CSS parsing using PEGTL? #266

Answered by ColinH
vibraphone asked this question in Q&A
Jun 25, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi,

there probably isn't a publicly available CSS grammar or parser built with the PEGTL, or at least I don't know about it. There was #184 but I also don't know if anything ever came of it.

  1. We've never tried to solve the problem of using a single grammar to parse different Unicode encodings. What I would probably do to get started is (a) implement the grammar for UTF-8, (b) factor out the Unicode parts and "template over them" so that you can choose the Unicode encoding yielding 5 instantiations of the grammar, (c) come up with some auto-detect heuristic if there's not enough meta-data to decide which one to use.
  2. That's not really the PEG approach which explicitly and intentionally work…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@vibraphone
Comment options

@patlecat
Comment options

Answer selected by vibraphone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants