-
-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(css_parser): fix is at unicode range check #3745
Conversation
CodSpeed Performance ReportMerging #3745 will not alter performanceComparing Summary
|
const UNICODE: TokenSet<CssSyntaxKind> = token_set![ | ||
// u+; | ||
T![+], | ||
// u+000; | ||
CSS_NUMBER_LITERAL, | ||
// u+00ff?; | ||
CSS_DIMENSION_VALUE, | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dummy question: does not this reveal an issue in our lexer? If I understand correctly our lexer can output three different token sequences that are all Unicode range: id(u) token(+)
, id(u) number(_)
and id(u) dimension(_)
. Should we output a dedicated token UnicodeRange
?
Note: this can be left for a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon observing the lexer code, I found that the corresponding T![U+] as start, CSS_UNICODE_RANGE_WILDCARD_LITERAL CSS_UNICODE_CODEPOINT_LITERAL represents a numeric value, but we need to pass a Context to get the corresponding Token.I don't see an example of using context in other is_at methods, I'm not sure it's right to just default to set Unicode_Range_Context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@togami2864 @denbezrukov any opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix! I think we can merge the fix and decide later if we need to move some logics to the lexer.
Summary
fix unicode_range check #3743
Test Plan
add snapshot test