Skip to content

Commit

Permalink
Support raw strings in Rust lexer
Browse files Browse the repository at this point in the history
Fixes #1398
  • Loading branch information
KamilaBorowska committed Jan 20, 2020
1 parent a821e3f commit aea9c87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rouge/lexers/rust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def macro_closed?
)x, Str::Char

rule %r/"/, Str, :string
rule %r/r(#*)".*?"\1/, Str

# numbers
dot = /[.][0-9_]+/
Expand Down
5 changes: 5 additions & 0 deletions spec/visual/samples/rust
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ println!("a\\");
println!("a\n");
println!("a\"b");
println!("a\'");
println!(r"");
println!(r"\n\");
println!(r#"a"b\"#);
println!(r##"r#""#"##);
println!(r###"r##"r#""#"##"###);

debug!("test %?", a.b);
debug!("test %u", a.c);
Expand Down

0 comments on commit aea9c87

Please sign in to comment.