Fix highlighting of byte escape sequences

Currently non-UTF8 escape sequences in byte strings and any escape
sequences in byte literals are ignored.
This commit is contained in:
oxalica 2023-07-17 22:28:57 +08:00
parent 37f84c101b
commit de1f766820
No known key found for this signature in database
GPG key ID: D425CB23CADE82D9
5 changed files with 48 additions and 10 deletions

View file

@ -451,6 +451,8 @@ fn main() {
let a = '\x65';
let a = '\x00';
let a = b'\xFF';
println!("Hello {{Hello}}");
// from https://doc.rust-lang.org/std/fmt/index.html
println!("Hello"); // => "Hello"
@ -505,8 +507,8 @@ fn main() {
println!("Hello\nWorld");
println!("\u{48}\x65\x6C\x6C\x6F World");
let _ = "\x28\x28\x00\x63\n";
let _ = b"\x28\x28\x00\x63\n";
let _ = "\x28\x28\x00\x63\xFF\n"; // invalid non-UTF8 escape sequences
let _ = b"\x28\x28\x00\x63\xFF\n"; // valid bytes
let backslash = r"\\";
println!("{\x41}", A = 92);