raffia icon indicating copy to clipboard operation
raffia copied to clipboard

Valid Less map syntax fails to parse

Open uncenter opened this issue 9 months ago • 0 comments

The following is valid Less syntax to define a map. Notably, this map includes a key:value pair (the first one) where the key starts with a digit/numeric character.

@foo: {
  01: #fff;
  _01: #fff;
  bar: #fff;
};

This valid syntax can be verified by the following playground instance that successfully compiles:

https://lesscss.org/less-preview/#eyJjb2RlIjoiLmZvbyB7XG4gICAgQGZvbzoge1xuICAgICAgMDE6ICNmZmY7XG4gICAgICBfMDE6ICMwMDA7XG4gICAgICBiYXI6ICNjY2M7XG4gICAgfTtcblxuICAgIGVhY2goQGZvbywge1xuICAgICAgLS1Ae2tleX06IEB2YWx1ZTtcbiAgICB9KTtcblxufSIsImFjdGl2ZVZlcnNpb24iOiI0LjMuMCIsIm1hdGgiOiJwYXJlbnMtZGl2aXNpb24iLCJzdHJpY3RVbml0cyI6ZmFsc2V9

However, in Raffia, keys of maps starting with digits cause a "CSS rule is expected" error. See the following playground instance for reference: https://raffia-play.vercel.app/?code=H4sIAAAAAAAAA02MsQ6CQBAFe7%2FiBXtPW2hMKC35AHPCHlxyd0tul4Ax%2Frso0djNFDNnx1zisQOMwYXuAnaIdhSI2qw%2B9Zi9Duh871XQ2kkIOhCKummQp0DwAlpGapW6ApQz58O2qzlGSmqm1G70CR2HwPN7HHxaXwyhbflrj6cSe%2BdctfL1X242f%2BVZvQDyc3JpuwAAAA%3D%3D&syntax=less.

uncenter avatar Apr 08 '25 23:04 uncenter