Skip to content

Commit cc4f7ac

Browse files
committed
feat(toml): Multi-line inline tables with trailing commas
1 parent 539f8c1 commit cc4f7ac

33 files changed

+40
-230
lines changed

crates/toml/src/de/parser/inline_table.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::map::Entry;
1313
/// ```abnf
1414
/// ;; Inline Table
1515
///
16-
/// inline-table = inline-table-open inline-table-keyvals inline-table-close
16+
/// inline-table = inline-table-open [ inline-table-keyvals ] ws-comment-newline inline-table-close
1717
/// ```
1818
pub(crate) fn on_inline_table<'i>(
1919
open_event: &toml_parser::parser::Event,

crates/toml/tests/decoder_compliance.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ fn main() {
2828
"invalid/datetime/no-secs.toml",
2929
"invalid/local-datetime/no-secs.toml",
3030
"invalid/local-time/no-secs.toml",
31+
"invalid/inline-table/linebreak-01.toml",
32+
"invalid/inline-table/linebreak-02.toml",
33+
"invalid/inline-table/linebreak-03.toml",
34+
"invalid/inline-table/linebreak-04.toml",
35+
"invalid/inline-table/trailing-comma.toml",
3136
])
3237
.unwrap();
3338
harness.snapshot_root("tests/snapshots");

crates/toml/tests/snapshots/invalid/array/no-close-04.stderr

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
TOML parse error at line 1, column 26
2-
|
3-
1 | no-close-04 = [{ key = 42
4-
| ^
5-
newlines are unsupported in inline tables, expected nothing
6-
7-
---
81
TOML parse error at line 1, column 27
92
|
103
1 | no-close-04 = [{ key = 42

crates/toml/tests/snapshots/invalid/array/no-close-06.stderr

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
TOML parse error at line 1, column 27
2-
|
3-
1 | no-close-06 = [{ key = 42 #}]
4-
| ^^^
5-
comments are unsupported in inline tables, expected nothing
6-
7-
---
81
TOML parse error at line 1, column 31
92
|
103
1 | no-close-06 = [{ key = 42 #}]

crates/toml/tests/snapshots/invalid/array/no-close-table-01.stderr

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
TOML parse error at line 1, column 16
2-
|
3-
1 | x = [{ key = 42
4-
| ^
5-
newlines are unsupported in inline tables, expected nothing
6-
7-
---
81
TOML parse error at line 1, column 17
92
|
103
1 | x = [{ key = 42

crates/toml/tests/snapshots/invalid/array/no-close-table-02.stderr

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
TOML parse error at line 1, column 17
2-
|
3-
1 | x = [{ key = 42 #
4-
| ^
5-
comments are unsupported in inline tables, expected nothing
6-
7-
---
81
TOML parse error at line 1, column 19
92
|
103
1 | x = [{ key = 42 #

crates/toml/tests/snapshots/invalid/inline-table/bad-key-syntax.stderr

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,3 @@ TOML parse error at line 1, column 16
33
1 | tbl = { a = 1, [b] }
44
| ^
55
missing key for inline table element, expected key
6-
7-
---
8-
TOML parse error at line 1, column 14
9-
|
10-
1 | tbl = { a = 1, [b] }
11-
| ^
12-
trailing commas are not supported in inline tables, expected nothing

crates/toml/tests/snapshots/invalid/inline-table/empty-02.stderr

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,3 @@ TOML parse error at line 1, column 6
33
1 | t = {,
44
| ^
55
extra comma in inline table, expected key
6-
7-
---
8-
TOML parse error at line 1, column 7
9-
|
10-
1 | t = {,
11-
| ^
12-
newlines are unsupported in inline tables, expected nothing
Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
1-
TOML parse error at line 1, column 6
2-
|
3-
1 | t = {
4-
| ^
5-
newlines are unsupported in inline tables, expected nothing
6-
7-
---
81
TOML parse error at line 2, column 1
92
|
103
2 | ,
114
| ^
125
extra comma in inline table, expected key
13-
14-
---
15-
TOML parse error at line 2, column 2
16-
|
17-
2 | ,
18-
| ^
19-
newlines are unsupported in inline tables, expected nothing

crates/toml/tests/snapshots/invalid/inline-table/linebreak-01.stderr

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)