Skip to content

Array of Tables Whitespace Syntax Clarification Query ("[[" vs "[ [") #1008

Closed Answered by eksortso
TommyJC asked this question in Q&A
Discussion options

You must be logged in to vote

The section that you link to is right, but the devil's in the details. The standard specifies in its formal grammar, toml.abnf (linked to at the bottom of the page), that the double brackets in an array table must be adjacent; no whitespace is permitted between the left brackets or between the right brackets. So [[ThisIsValid]] and [[ "So's This." ]] But the whitespace between the same brackets in your examples makes those invalid.

I posit that it's a lot more obvious and minimal if the brackets are constrained this way, not to mention simpler for parsers to work with. For a simple array key, just look for the next pair of right brackets. For quoted array keys, look for them after the key…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TommyJC
Comment options

Answer selected by TommyJC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants