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

[wgsl-in] implement block comments #1675

Merged
merged 1 commit into from
Jan 19, 2022
Merged

Conversation

kocsis1david
Copy link
Contributor

Fixes #1582

Implement block comments that support nesting.

@kocsis1david kocsis1david changed the title wgsl-in: implement block comments [wgsl-in] implement block comments Jan 19, 2022
Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Very nice, thank you for tackling this!
We may need to fix it a little bit better

let mut depth = 1;
while let Some(c) = chars.next() {
match c {
'*' if chars.next() == Some('/') => {
Copy link
Member

Choose a reason for hiding this comment

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

this will fail on a case like this: /* blabla **/

Copy link
Contributor Author

@kocsis1david kocsis1david Jan 19, 2022

Choose a reason for hiding this comment

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

hopefully it's fixed, there can be strange cases like /*/**/****/, which is a properly terminated block comment

@kvark
Copy link
Member

kvark commented Jan 19, 2022

Some tests would be nice to have

@kvark
Copy link
Member

kvark commented Jan 19, 2022

And clippy is unhappy

@kocsis1david kocsis1david force-pushed the block-comments branch 2 times, most recently from a2cd31a to e507d71 Compare January 19, 2022 19:41
Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

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

Thank you!

@kvark kvark enabled auto-merge (squash) January 19, 2022 19:44
@kvark kvark merged commit adc6821 into gfx-rs:master Jan 19, 2022
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.

error occurs in validating the block comment in WGSL
2 participants