added \r and \0 escape sequences

This commit is contained in:
mark 2023-05-23 20:24:32 +02:00
parent 07a443a60b
commit 22b4ace81b

View File

@ -501,16 +501,20 @@ pub mod implementation {
match file.next() { match file.next() {
Some('\\') => { Some('\\') => {
if let Some(ch) = file.next() { if let Some(ch) = file.next() {
buf.push(match ch { buf.push(
match ch {
'\\' => '\\', '\\' => '\\',
'r' => '\r',
'n' => '\n', 'n' => '\n',
't' => '\t', 't' => '\t',
'0' => '\0',
'"' => '"', '"' => '"',
ch => { ch => {
eprintln!("Warn: Weird char escape \"\\{ch}\", will be replaced with \"{ch}\"."); eprintln!("Warn: Weird char escape \"\\{ch}\", will be replaced with \"{ch}\".");
ch ch
}, },
}) }
)
} }
} }
Some('"') => break, Some('"') => break,