Skip to content

Commit

Permalink
Allow multiple comments or newlines in arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Nov 14, 2017
1 parent f431d48 commit deb40eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,10 @@ arr5 = [ [ 1, 2 ], ["a", "b", "c"] ]
arr6 = [ 1, 2.0 ] # INVALID
```

Arrays can also be multiline. So in addition to ignoring whitespace, arrays also
ignore newlines, and comments before those newlines, between the brackets.
Terminating commas (also called trailing commas) are ok before the closing bracket.
Arrays can also be multiline. Terminating commas (also called trailing commas)
are ok after the last value of the array. Multiline arrays ignore whitespace
everywhere between the brackets. There can be an arbitary number of newlines and
comments before a value and before the closing bracket.

```toml
arr7 = [
Expand Down
15 changes: 7 additions & 8 deletions toml.abnf
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,17 @@ local-time = partial-time

;; Array

array = array-open array-values array-close
array = array-open ws-comment-newline [ array-values ] array-close

array-open = %x5B ws-newline ; [
array-close = ws-newline %x5D ; ]
array-open = %x5B ; [
array-close = %x5D ; ]

array-values = [ ( val array-sep [ ( ws-newline comment ws-newlines) / ws-newlines ] array-values ) /
( val [ array-sep ] [ ( ws-newline comment ws-newlines ) ] ) ]
array-values = val ws array-sep ws-comment-newline array-values
array-values =/ val ws [ array-sep ] ws-comment-newline

array-sep = ws %x2C ws ; , Comma
array-sep = %x2C ; , Comma

ws-newline = *( wschar / newline )
ws-newlines = newline *( wschar / newline )
ws-comment-newline = *( wschar / [ comment ] newline )

;; Inline Table

Expand Down

0 comments on commit deb40eb

Please sign in to comment.