davesnx / styled-ppx

Type-safe styled components for ReScript, Melange and native with type-safe CSS
https://styled-ppx.vercel.app
BSD 2-Clause "Simplified" License
399 stars 32 forks source link

Fix escapes y numerics on the parsing/lexing #416

Closed davesnx closed 5 months ago

davesnx commented 7 months ago

They are treated as "DIMENSIONS" but should be treated as strings

"div {   quotes: "\201C" "\201D" "\2018" "\2019" "\201C" "\201D" "\2018" "\2019";
WS
TAG('div')
WS
LEFT_BRACE
IDENT('quotes')
COLON
DIMENSION('201, C')
DIMENSION('201, D')
NUMBER('2018')
NUMBER('2019')
DIMENSION('201, C')
DIMENSION('201, D')
NUMBER('2018')
NUMBER('2019')
SEMI_COLON
RIGHT_BRACE
yokurang commented 5 months ago

Hi @davesnx, can I clarify what the expected output should be then for

"div {   quotes: "\201C" "\201D" "\2018" "\2019" "\201C" "\201D" "\2018" "\2019";

Is it:

WS
TAG('div')
WS
LEFT_BRACE
IDENT('quotes')
COLON
STRING("201C")
STRING("201D")
NUMBER('2018')
NUMBER('2019')
STRING("201C")
STRING("201D")
NUMBER('2018')
NUMBER('2019')
SEMI_COLON
RIGHT_BRACE

Once I established the expected behaviour, I'll try to implement a bug fix for this issue.

Thanks, yokurang

davesnx commented 5 months ago

Hi @yokurang

I believe the antiquotation should be part of the STRING payload: STRING("\201C") because later (when we generate the CSS code) we need to output with it.

Let me know if you find any blocker!

davesnx commented 5 months ago

Hey @yokurang

I just checked with the latest version of the lexer (this issue was a bit old) and it's already treated as a string.

Sorry for not updating the issue, let me know if you want to contribute in any other

yokurang commented 5 months ago

Hey @yokurang

I just checked with the latest version of the lexer (this issue was a bit old) and it's already treated as a string.

Sorry for not updating the issue, let me know if you want to contribute in any other

Hi @davesnx, that would be great! If you have any good first issues, I'd really appreciate it!

davesnx commented 5 months ago

Let me cleanup issues today and will ping you or mark a few as "good first issue". What are you areas of expertee? ppx/react/css/parsing?

yokurang commented 5 months ago

I'm a third-year computer science student based in Singapore, but I have taken classes in OCaml and a programming language design class. I am familiar with parsing, etc, and react. Thanks!