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

Handle block comments /* */ #81

Merged
merged 10 commits into from
Aug 1, 2024
Merged

Handle block comments /* */ #81

merged 10 commits into from
Aug 1, 2024

Conversation

ldemailly
Copy link
Member

@ldemailly ldemailly commented Jul 30, 2024

The difficulty is in the -format output to keep the block comment where they were (same line or new line etc)

This was harder to get right than... I wanted

fixes #14

@ldemailly ldemailly marked this pull request as draft July 30, 2024 03:38
@ldemailly ldemailly marked this pull request as ready for review July 31, 2024 23:36
@ldemailly ldemailly requested a review from ccoVeille July 31, 2024 23:37
Copy link
Contributor

@ccoVeille ccoVeille left a comment

Choose a reason for hiding this comment

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

The code is indeed not fun.

At least, you seem to have added enough test to handle it

{"5 + 5 + 5 + 5 - 10 /* some block comment */", 10},
/* These don't work, we need to make comment a identity operator or prune them entirely from the AST. */
// {"5 + /* block comment in middle of expression */ 2", 7},
// {" - /* inline of prefix */ 5", -5},
Copy link
Member Author

Choose a reason for hiding this comment

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

@ccoVeille also this ^ ie the block/inline comments currently do break expressions, basically act as a ; or \n and making them not do that requires more surgery (like 2 passes, one for -format/pretty print and one for nuking the comments... which seems not ideal)

@ldemailly ldemailly merged commit aa14201 into main Aug 1, 2024
1 check passed
@ldemailly ldemailly deleted the slash_star_comments branch August 1, 2024 17:03
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.

/* */ style comments
2 participants