From 11493cccd7e7fc5ea31e37581323f85eca58ca0c Mon Sep 17 00:00:00 2001 From: Nirmal Patel Date: Sun, 12 Jun 2022 19:23:30 -0400 Subject: Fix lexing of empty comments continuing till next line 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 --- gcc/rust/lex/rust-lex.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/rust') diff --git a/gcc/rust/lex/rust-lex.cc b/gcc/rust/lex/rust-lex.cc index 023b676..9e0595b 100644 --- a/gcc/rust/lex/rust-lex.cc +++ b/gcc/rust/lex/rust-lex.cc @@ -489,6 +489,7 @@ Lexer::build_token () // (but not an inner or outer doc comment) skip_input (); current_column += 2; + current_char = peek_input (); // basically ignore until line finishes while (current_char != '\n' && current_char != EOF) -- cgit v1.1