toml: fix crlf escape check (fix #24328) (#24329)

This commit is contained in:
kbkpbot 2025-04-27 00:50:32 +08:00 committed by GitHub
parent fc640f7ce0
commit d9b808cdc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -491,7 +491,7 @@ fn (c &Checker) check_quoted_escapes(q ast.Quoted) ! {
}
}
}
if next_ch in [`\t`, `\n`, ` `] {
if next_ch in [`\t`, `\r`, `\n`, ` `] {
s.next()
continue
}

View File

@ -0,0 +1,9 @@
import toml
fn test_quoted_string_crlf() {
toml_txt := 'str1 = """tcc \\\r\nabc \\\r\n123"""'
toml_doc := toml.parse_text(toml_txt) or { panic(err) }
value := toml_doc.value('str1').string()
assert value == 'tcc abc 123'
}