@@ -1847,6 +1847,15 @@ parse_inline_table(location& loc, const std::size_t n_rec)
18471847
18481848 // check if the inline table is an empty table = { }
18491849 maybe<lex_ws>::invoke (loc);
1850+ #ifdef TOML11_USE_UNRELEASED_TOML_FEATURES
1851+ // TOML 1.1.0: allow newlines in inline tables
1852+ while (loc.iter () != loc.end () &&
1853+ (*loc.iter () == ' \r ' || *loc.iter () == ' \n ' ))
1854+ {
1855+ loc.advance ();
1856+ }
1857+ maybe<lex_ws>::invoke (loc); // skip whitespace after newlines
1858+ #endif
18501859 if (loc.iter () != loc.end () && *loc.iter () == ' }' )
18511860 {
18521861 loc.advance (); // skip `}`
@@ -1914,13 +1923,28 @@ parse_inline_table(location& loc, const std::size_t n_rec)
19141923 else // `,` is found
19151924 {
19161925 maybe<lex_ws>::invoke (loc);
1926+ #ifdef TOML11_USE_UNRELEASED_TOML_FEATURES
1927+ // TOML 1.1.0: allow newlines after commas in inline tables
1928+ while (loc.iter () != loc.end () &&
1929+ (*loc.iter () == ' \r ' || *loc.iter () == ' \n ' ))
1930+ {
1931+ loc.advance ();
1932+ }
1933+ maybe<lex_ws>::invoke (loc); // skip whitespace after newlines
1934+ #endif
19171935 if (loc.iter () != loc.end () && *loc.iter () == ' }' )
19181936 {
1937+ #ifdef TOML11_USE_UNRELEASED_TOML_FEATURES
1938+ // TOML 1.1.0: trailing comma is allowed in inline tables
1939+ loc.advance (); // skip `}`
1940+ return ok (std::make_pair (retval, region (loc, first, loc.iter ())));
1941+ #else
19191942 throw syntax_error (format_underline (
19201943 " toml::parse_inline_table: trailing comma is not allowed in"
19211944 " an inline table" ,
19221945 {{source_location (loc), " should be `}`" }}),
19231946 source_location (loc));
1947+ #endif
19241948 }
19251949 }
19261950 }
0 commit comments