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

Fix lexing of empty comments continuing till next line #1309

Merged
merged 1 commit into from Jun 13, 2022

Conversation

nirmal-j-patel
Copy link
Contributor

@nirmal-j-patel nirmal-j-patel commented Jun 13, 2022

Empty comments (comments without any characters including spaces after //) had a bug during lexing. The lexer did not recheck the current character after skipping / characters. When there was no character after //, the lexer skipped the next newline character. This caused lexer to count the next line as a part of the comment to. This commit fixes this bug by rechecking current character after skipping two / characters.

Fixes #1306

Signed-off-by: Nirmal Patel nirmal@nirmal.dev

Empty comments (comments without any characters including spaces after
//) had a bug during lexing. The lexer did not recheck the current
character after skipping / characters. When there was no character after
//, the lexer skipped the next newline character. This caused lexer to
count the next line as a part of the comment to. This commit fixes this
bug by rechecking current character after skipping two / characters.

Signed-off-by: Nirmal Patel <nirmal@nirmal.dev>
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

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

Good find :D Nice little bugfix and thank you for adding the test case.

@CohenArthur
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 13, 2022

Build succeeded:

@bors bors bot merged commit 5a62eb2 into Rust-GCC:master Jun 13, 2022
@nirmal-j-patel nirmal-j-patel deleted the empty_comment_lexing branch July 3, 2022 20:22
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.

Empty comment before match causes parse error
2 participants