Skip to content

Commit 2b61669

Browse files
authored
toml: fix for single \r occurence in multi-line """ strings (\r\n is still allowed) (#26029)
1 parent 1fb9c95 commit 2b61669

2 files changed

Lines changed: 1 addition & 4 deletions

File tree

‎vlib/toml/scanner/scanner.v‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ fn (mut s Scanner) extract_multiline_string() !string {
486486
c := u8(s.at())
487487
util.printdbg(@MOD + '.' + @STRUCT + '.' + @FN, 'c: `${c.ascii_str()}` / ${c} (quote type: ${quote}/${quote.ascii_str()})')
488488

489-
if c == `\r` {
489+
if c == `\r` && s.peek(1) == `\n` {
490490
continue
491491
}
492492
if c == `\n` {

‎vlib/toml/tests/burntsushi_toml_test.v‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// vtest flaky: true
2-
// vtest retry: 3
3-
41
// Instructions for developers:
52
// The actual tests and data can be obtained by doing:
63
// `git clone -n https://github.com/toml-lang/toml-test.git vlib/toml/tests/testdata/burntsushi`

0 commit comments

Comments
 (0)