Tokenizing a property declaration with a space after property name resolves incorrectly to RuleSet instead of Declaration #11

Closed
opened 2024-01-04 13:46:43 +01:00 by ergunsh · 3 comments
ergunsh commented 2024-01-04 13:46:43 +01:00 (Migrated from github.com)

Hey @marijnh,

It seems like when there is a space betwen the property name and the colon, the tokenizing fails; see the following case:

div {
    color: blue;
    color : red;
}

color: blue resolves correctly to Declaration; however color : red resolves to RuleSet.

I have created a tree visualizer for @lezer/css and @lezer/javascript; you can take a look here as well: https://ergun.sh/lezer-viz.html?language=%40lezer%2Fcss&sourceText=*+%7B%0A++color%3A+red%3B%0A++color+%3A+blue%3B%0A%7D

Hey @marijnh, It seems like when there is a space betwen the property name and the colon, the tokenizing fails; see the following case: ``` div { color: blue; color : red; } ``` `color: blue` resolves correctly to `Declaration`; however `color : red` resolves to `RuleSet`. I have created a tree visualizer for `@lezer/css` and `@lezer/javascript`; you can take a look here as well: https://ergun.sh/lezer-viz.html?language=%40lezer%2Fcss&sourceText=*+%7B%0A++color%3A+red%3B%0A++color+%3A+blue%3B%0A%7D
marijnh commented 2024-01-04 14:51:27 +01:00 (Migrated from github.com)

This patch should help. It was getting confused because (since it supports nested rules) it was interpreting that colon as indicating some selector like p :pseudoclass was coming.

This patch should help. It was getting confused because (since it supports nested rules) it was interpreting that colon as indicating some selector like `p :pseudoclass` was coming.
ergunsh commented 2024-01-08 12:40:29 +01:00 (Migrated from github.com)

Ah perfect, thanks for the quick patch again! :)

Do you have a time when the fix would be published?

Ah perfect, thanks for the quick patch again! :) Do you have a time when the fix would be published?
marijnh commented 2024-01-08 13:17:03 +01:00 (Migrated from github.com)

I've tagged this in @lezer/css 1.1.7

I've tagged this in @lezer/css 1.1.7
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lezer/css#11
No description provided.