-
Notifications
You must be signed in to change notification settings - Fork 428
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
Add support for line comments of the form //
#243
Conversation
6a7b8ed
to
cbf37c2
Compare
//
This is ready for review, sorry for the delay. |
There is currently a failing test on master, i think a result of the docstring issue #308 . This PR does not commit the new expected output of all the tests for fear that broken tests get changed accidentally. |
9adc474
to
d1a2070
Compare
I realized that failing test is blocking other tests. I'll update the |
No problem, this can wait. I'm still looking at #308 right now, it's been giving me a bit of trouble. |
1a0d7c7
to
9ee9901
Compare
I've updated this review with the new test output, since a lot of comments were converted into single line comments |
This rebase is failing a few tests due to an issue with empty line comments of the form I was thinking about extending the current lexer token COMMENT structure to include a boolean indicating whether or not it's a line comment, so that we can differentiate when printing it - if the developer specified comments of the form Is this something that would be useful/is there a better way to address this? |
3e562cd
to
a6ee21d
Compare
This is ready for review. I cleaned up the code a bit, and also added the extra boolean to the |
Cool, I'll take a look tonight! I greatly simplified the comment interleaving code (will submit a diff) but it looks like the rebase conflicts won't be too bad with this one. |
Sorry for the delay, I'll take a look as soon as I land the other launch blocking comment diff (Yunxing can feel free to accept/comment). |
No worries, take your time! |
I'll be getting back to this. I think we should open source with support for these. |
This is nice to have |
rebased, but i noticed that there are a few ml tests that are failing, also on master.
|
Makes it easier to find out what's wrong when you change `reason_parser.mly`.
comments for lists that break `IfNeed`ed
Did this ever land? This page says that Reason supports line comments in the form |
This unfortunately was never landed, and I think not fully reviewed. There was another issue regarding the comment interleaving logic introduced by another commit that is referenced above, which was causing issues at the time (#302). Due to some other responsibilities that cropped up in my personal life, I haven't gotten a chance to look at or address either in a while, so I'm not whether or not it's been fixed. Also, this hasn't been rebased (as is apparent from the garbled history), but this PR also became bugged when the repo changed its name from facebook/Reason to facebook/reason (it caused my previous repo, dxu/Reason, to no longer be recognized as a fork), so there's a slightly more up-to-date fork at https://github.com/dxu/reason/tree/comments. It still isn't rebased with the most recent commits, but Sorry for the delay! @yunxing, let me know if you wanted to take this over, otherwise I might not be able to get to this until a few weeks from now. This pull request should also be closed and replaced with one from a repository that is detected as a fork. |
@dxu Thanks for the update. I will take over this diff as soon as I get a cycle next Thursday. |
bump! This would be super nice |
We have the necessary support in our comment interleaving logic now. Should be pretty easy, gimme some more days. |
@yunxing any update on this? |
Nooooooooo |
Does this work now? |
Nope |
cc @let-def :D |
:D |
This adds support for line comments of the form
// comment
.//
, by maintaining asingle_line_comment
bool
indicating whether we're currently parsing a single line comment. this differentiation prevents cases like// */ let x = 10
from executing, so that the*/
does not get parsed as an end of comment. It also maintains a separateline_comment_start_loc
to keep track of the line comment locations to separate the logic for checking for unmatched comments, so that newlines and nested*/
comment endings can be differentiated. It also updates the pretty printer to handle these cases accordingly.For example, in the
wrappingTest.re
cases in facebook/Reason,must be compiled into
as opposed to
to fix this, I check if the listConfig every defines its
break
attribute to beNever
orIfNeed
, it will force a multiline comment.Unterminated_nested_comments
that get thrown when a nested comment is detected to not have been matched.There are a few open questions that aren't answered by this pull request, both of which can be found in greater detail in the discussion on facebook/reasonsyntax#41:
/*
or(*
converting from one to the other, it could potentially cause issues.