-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Parser render module #530
Parser render module #530
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
…de on parser since the ast is bonkers
…perty grammar definition
…t the test passes
Styled_ppx_css_parser.Parser_location.update_pos_lnum( | ||
at_rule_prelude_loc, | ||
loc, | ||
), |
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.
When have you seen this to be needed? Can add a test for it? ^^
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.
this keeps the cnum of the first location but offset the lnum with the second loc. i've tried using intersection but this seems to work well to highlight the correct error location.
| "<=" => Ok(IDENT("<=")) | ||
| ">=" => Ok(IDENT(">=")) |
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.
why are those idents?
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.
Since we filter out the whitespace, there is no way of telling if there is a whitespace between gt and lt with eq. So I changed the property spec from this
<mf-lt> = '<' '='?
<mf-gt> = '>' '='?
to this
and mf_gt = [%value.rec "'>=' | '>'"]
and mf_lt = [%value.rec "'<=' | '<'"]
So need to handle >= and <= on the lexer
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.
right, but why as ident and not OPERATOR? or maybe a token by itself?
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.
huh i see what u mean, we can create another token and change the keyword functon on Standard.re
open Ast; | ||
|
||
let rec contains_ampersand = (selector: selector) => { | ||
switch (selector) { | ||
| SimpleSelector(Ampersand) => true | ||
| ComplexSelector(Selector(selector)) => contains_ampersand(selector) | ||
| ComplexSelector(Combinator({left: selector_left, right})) => | ||
contains_ampersand(selector_left) |
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.
did we migrate tests for all of this?
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.
yup, should be on Render_test.t, condensed some of them though
/* space between < and = is invalid */ | ||
"@media (width < = 33px) {}", | ||
"Parse error while reading token '=' on line 1 at position 15", | ||
"Parse error while reading token '' on line 1 at position 7", |
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.
weird error message; it should at least render the $
.
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.
huh yeah, dunno why this is the case
), | ||
//( |
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.
what's the reason for those comments?
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.
since we handle the prelude parsing with the property parser, all of this should pass the first parse
Css_property_parser.Parser.media_query_list, | ||
prelude, | ||
) | ||
|> Result.map(_ => prelude); |
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.
can we do something better with this error here?
…make any-value work
No description provided.