Skip to content

Conversation

@Earlopain
Copy link
Collaborator

There appear to be a bunch of rules, changing behaviour for inline comments, multiple comments after another, etc.

This seems to line up with reality pretty closely, token differences for RuboCop tests go from 1129 to 619 which seems pretty impressive.

Arguably most of this behaviour is a bug (whitequark/parser#1025) but I don't think it'll be changed now.

@Earlopain
Copy link
Collaborator Author

I disabled sorbet typechecking for the lexer file. sorbet is not good enough to properly analyse the code without T.let/T.must etc. which obviously won't work here.

There appear to be a bunch of rules, changing behaviour for
inline comments, multiple comments after another, etc.

This seems to line up with reality pretty closely, token differences for RuboCop tests go from 1129 to 619 which seems pretty impressive
The whole while switch/case construct makes typechecking difficult because
sorbet does not recognize that outside variables
may change their value in individual switches.
@Earlopain Earlopain force-pushed the parser-translator-better-comments branch from 88d7305 to 2bcc494 Compare January 11, 2025 17:49
@kddnewton kddnewton merged commit 1d22424 into ruby:main Jan 11, 2025
56 of 58 checks passed
@Earlopain Earlopain deleted the parser-translator-better-comments branch January 11, 2025 21:29
Earlopain added a commit to Earlopain/prism that referenced this pull request Jan 12, 2025
In ruby#3393 I made a mistake.
When there is no previous token, it wraps around to -1. Oops
Earlopain added a commit to Earlopain/prism that referenced this pull request Jan 12, 2025
In ruby#3393 I made a mistake.
When there is no previous token, it wraps around to -1. Oops

Additionally, if a comment has no newline then the offset should be kept as is
matzbot pushed a commit to ruby/ruby that referenced this pull request Jan 12, 2025
In ruby/prism#3393 I made a mistake.
When there is no previous token, it wraps around to -1. Oops

Additionally, if a comment has no newline then the offset should be kept as is

ruby/prism@3c266f1de4
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