raffia icon indicating copy to clipboard operation
raffia copied to clipboard

SCSS/SASS syntax trees differ for interchangeable code

Open yiffyrusdev opened this issue 1 year ago • 5 comments

Hello! Thanks for the amazing crate!

I'm exploring the Raffia Playground, looking forward to use the raffia for stylesheet parsing.

I'm not really into sass tabbed syntax, however, as I get it from here, the following SASS code should be parsed as 3 top-level QualifiedRules:

.rule1
  color: red
  &-smth
    color: blue
.rule2
  color: blue
.rule3
  color: red

At the mean time, it does seem to be parsed as a single one:

Stylesheet
> statements : [ 1 element ]
  > QualifiedRule
    > selector : SelectorList
      > selectors : [ 1 element ]
    > block : SimpleBlock
      >statements : [ 4 elements ]

Where the block does contain the declaration and rest of QualifiedRule.

The analogical code in SCSS syntax is parsed as expected:

.rule1{
  color: red;
  &-smth {
    color: blue;
  }
}
.rule2{
  color: blue;
}
.rule3{
  color: red;
}

Stylesheet
> statements : [ 3 elements ]
  > QualifiedRule
  > QualifiedRule
  > QualifiedRule

As far as I can tell, those code samples should form ~~identical syntax trees (*except of spans)~~ identical by structure syntax trees, aren't they?

yiffyrusdev avatar Oct 27 '24 19:10 yiffyrusdev