Tomlyn icon indicating copy to clipboard operation
Tomlyn copied to clipboard

Newlines in inline tables appear not to work

Open dwilliamson opened this issue 11 months ago • 1 comments

This is the test file:

a = {
   b = 3 }

The error Unexpected token `NewLine` while parsing inline table is emitted.

ParseKeyValue sets _hideNewLine = false. It then goes into ParseValue, which calls ParseInlineTable and inherits the value of _hideNewLine. It looks like ParseInlineTable should explicitly set it to true.

This isn't caught by any tests as #b2377a1 only added tests for inline arrays.

dwilliamson avatar Jan 21 '25 17:01 dwilliamson

As per the 1.0 specs here

Inline tables are intended to appear on a single line. A terminating comma (also called trailing comma) is not permitted after the last key/value pair in an inline table. No newlines are allowed between the curly braces unless they are valid within a value.

So while they might change it for 1.1, this is currently not supported.

xoofx avatar Mar 11 '25 10:03 xoofx