Skip to content

Possible to add support for CSS3 grammar in the CSS lexer and parser? #89

@yasoob

Description

@yasoob

Hi!

Wonderful job with the CSS lexer and parser. I was looking for something similar for Elixir/Erlang and I fortunately came across them in Zotonic. I was able to use the lexer and parser via Elixir just fine but there are some issues. It doesn't currently support CSS3. For instance, this CSS is not correctly parsed:

@media only screen and (max-width: 600px) {
  body {
    background-color: lightblue;
  }
}

This results in the following error:

iex(72)> css = ~S"""
...(72)> @media only screen and (max-width: 600px) {
...(72)>   body {
...(72)>     background-color: lightblue;
...(72)>   }
...(72)> }
...(72)> """
"@media only screen and (max-width: 600px) {\n  body {\n    background-color: lightblue;\n  }\n}\n"
iex(73)> :z_css.parse(css)
{:error, {1, :z_css_parser, [~c"syntax error before: ", [~c"\"screen\""]]}}

My regex is not good enough for me to go about supporting it myself. So I thought maybe I can ask you if this is something you guys ever thought about including? It would be amazing if this is supported.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions