Recognize when a block comment has been ended inside a string literal (#4312)
This commit is contained in:
parent
58157bb4b7
commit
dac2423f3f
@ -1311,6 +1311,9 @@ where
|
||||
char_kind = FullCodeCharKind::InStringCommented;
|
||||
if chr == '"' {
|
||||
CharClassesStatus::BlockComment(deepness)
|
||||
} else if chr == '*' && self.base.peek().map(RichChar::get_char) == Some('/') {
|
||||
char_kind = FullCodeCharKind::InComment;
|
||||
CharClassesStatus::BlockCommentClosing(deepness - 1)
|
||||
} else {
|
||||
CharClassesStatus::StringInBlockComment(deepness)
|
||||
}
|
||||
|
8
tests/source/issue-4312.rs
Normal file
8
tests/source/issue-4312.rs
Normal file
@ -0,0 +1,8 @@
|
||||
fn main() {
|
||||
/* " */
|
||||
println!("Hello, world!");
|
||||
/* abc " */
|
||||
println!("Hello, world!");
|
||||
/* " abc */
|
||||
println!("Hello, world!");
|
||||
}
|
8
tests/target/issue-4312.rs
Normal file
8
tests/target/issue-4312.rs
Normal file
@ -0,0 +1,8 @@
|
||||
fn main() {
|
||||
/* " */
|
||||
println!("Hello, world!");
|
||||
/* abc " */
|
||||
println!("Hello, world!");
|
||||
/* " abc */
|
||||
println!("Hello, world!");
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user