-
-
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
base: main
Are you sure you want to change the base?
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
| "or" | ||
| "layer" => | ||
Error([ | ||
"'only', 'not', 'and', 'or', and 'layer' are invalid media types", |
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.
yo, give me a proper error message.
can you do a as used
and Printf.sprintf "%s is not a valid media type" used?
let value = { | ||
switch (name) { | ||
| "none" | ||
| "and" | ||
| "not" | ||
| "or" => | ||
Error(["'none', 'and', 'not', and 'or' are invalid container names"]) |
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.
How's possible that we don't catch those at parse time?
@@ -542,22 +532,28 @@ let handle_tokenizer_error = lexbuf => { | |||
}; | |||
|
|||
let skip_whitespace = ref(false); | |||
let prev_skip_whitespace = ref(false); |
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.
whoa, I would need an explanation on why previous is needed, when we have skip_ws
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.
If both booleans are needed, I would go with a single ref and a few variants, wdyt?
Inside_media | Inside_selector | Outside_x | etc..
$ alias run='./Render_test.exe' | ||
|
||
$ cat ./test.css | run |
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 the alias?
$ alias run='./Render_test.exe' | ||
|
||
$ cat ./test.css | run | ||
.some-grid{grid:[line1] minmax(20em, max-content) / auto-flow dense 40%;}.a,href > h1,h3[data-foo*=bar]{&::after,href > h1,&:is(h1),&:has(+ :is(h3)){padding:20px 30px calc(20px+30px*(20 * 400/2));}background-image:radial-gradient(circle, #0000 45%, #000f 48%), radial-gradient(ellipse farthest-corner, #fc1c14 20%, #cf15cf 80%);grid-template-columns:[line-name1] 100px [line-name2] repeat(auto-fit, [line-name3 line-name4] 300px) ;}abbr{color:chocolate;}@media (hover: hover) {abbr:hover{color:limegreen;transition-duration:1s;}}@media not all and (hover: hover) {abbr::after{content:" (" attr(title) ")";}} |
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 have those tests as "idempotent" and parse-print-parse and compare?
I would prefer to keep separate "features" as separate tests, but a big one is also cool
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.
maybe the "big" one can be a small tailwind generated file?
Css_property_parser.Parser.parse( | ||
Css_property_parser.Parser.media_query_list, | ||
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.
Oh, I like this parsing
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? ^^
[%expr [%cx "@media (screen and (color)) {}"]], | ||
[%expr CSS.style([|CSS.media({js|(screen and (color))|js}, [||])|])], | ||
"((screen) and (color))", | ||
[%expr [%cx "@media ((screen) and (color)) {}"]], |
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 looks incorrect, the right way would be
@media screen and (color) {
color: blue;
}
Parsing is: @media [media-type] and ([media-feature]) { }
No description provided.