Skip to content
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

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

Parser render module #530

wants to merge 27 commits into from

Conversation

zakybilfagih
Copy link
Collaborator

No description provided.

Copy link

vercel bot commented Dec 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
styled-ppx ⬜️ Ignored (Inspect) Visit Preview Jan 15, 2025 10:03am

@zakybilfagih zakybilfagih requested a review from davesnx December 26, 2024 15:26
packages/css-property-parser/lib/Standard.re Outdated Show resolved Hide resolved
packages/css-property-parser/lib/Standard.re Outdated Show resolved Hide resolved
@@ -542,22 +532,28 @@ let handle_tokenizer_error = lexbuf => {
};

let skip_whitespace = ref(false);
let prev_skip_whitespace = ref(false);
Copy link
Owner

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

Copy link
Owner

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..

Copy link
Collaborator Author

@zakybilfagih zakybilfagih Dec 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof forgot to refactor this specific hack hehe.
when we are inside a brace, the skip_whitespace is set to true and the whitespace inside values (<property>: <values>) is skipped. i want to enable whitespace when we are seeing : and bring skip_whitespace to its previous value when we are seeing ;

i like the variant idea though, will try to implement it!

packages/parser/test/Render_test.t Outdated Show resolved Hide resolved
packages/parser/test/Render_test.t Outdated Show resolved Hide resolved
packages/ppx/src/Css_to_runtime.re Show resolved Hide resolved
Comment on lines +130 to +133
Styled_ppx_css_parser.Parser_location.update_pos_lnum(
at_rule_prelude_loc,
loc,
),
Copy link
Owner

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? ^^

Copy link
Collaborator Author

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.

packages/ppx/test/native/At_rule_test.re Show resolved Hide resolved
@zakybilfagih zakybilfagih marked this pull request as ready for review January 29, 2025 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants