Good CSS grammar in Antlr v4 -


are there css grammars out there antlr4? know there grammars antlr3, turns out css not trivial parse without "lexer modes", added in v4. why?

consider following css selectors:

.hello.world { /* ... */ } .hello .world { /* ... */ } 

in grammars, whitespace ignored. if ignore whitespace, becomes impossible distinguish between 2 selectors above @ parser level.

then again, if don't ignore whitespace, grammar becomes pretty noisy ws? or ws* patterns everywhere, since whitespace mostly meaningless unless occurs within selector.

which modes antlr4 come in, because support lexer modes can define new rules lexer whenever enter different contexts (i.e. don't ignore whitespace within "selector" context).

that said, i'll accept grammar antlr3 long handles whitespaces properly, that's version we're using anyway ;-)

i imagine you've found answer question posted long ago. still:

a antlr v4 grammar css3 can found on antlr github here:

antlr v4 css3 grammar

as stated in readme, works on number of css files - however, doesn't handle full syntax of @import or @include.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -