Skip to content

Commit 20c034e

Browse files
committed
rust: Add support for string continuation escape
Closes #2102
1 parent 55bd802 commit 20c034e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/rouge/lexers/rust.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def macro_closed?
253253
state :string do
254254
rule %r/"/, Str, :pop!
255255
rule escapes, Str::Escape
256-
rule %r/[^"\\]+/m, Str
256+
rule %r/([^"\\]+|\\\n[ \t\r\n]*)/m, Str
257257
end
258258
end
259259
end

spec/visual/samples/rust

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ println!(r###"r##"r#""#"##"###);
3838
println!(r#"
3939
"New line in a raw string"
4040
"#);
41+
println!("String continuation\
42+
43+
escape");
4144

4245
trait Iterable<A> {
4346
fn iterate(&self, blk: impl FnMut(&A) -> bool);

0 commit comments

Comments
 (0)