From 1f0a5df43c2f0f7b2bf52700c26187cf0f2d5e15 Mon Sep 17 00:00:00 2001 From: Christian Siefkes Date: Sun, 3 Nov 2019 21:54:35 +0100 Subject: [PATCH 1/6] Allow heterogeneous arrays --- README.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6700b95b..017fc029 100644 --- a/README.md +++ b/README.md @@ -579,18 +579,22 @@ Array ----- Arrays are square brackets with values inside. Whitespace is ignored. Elements -are separated by commas. Data types may not be mixed (different ways to define -strings should be considered the same type, and so should arrays with different -element types). +are separated by commas. Arrays can contain values of the same data types as +allowed in key/value pairs. Values of different types may be mixed. ```toml -arr1 = [ 1, 2, 3 ] -arr2 = [ "red", "yellow", "green" ] -arr3 = [ [ 1, 2 ], [3, 4, 5] ] -arr4 = [ "all", 'strings', """are the same""", '''type'''] -arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] +integers = [ 1, 2, 3 ] +colors = [ "red", "yellow", "green" ] +nested_array_of_int = [ [ 1, 2 ], [3, 4, 5] ] +nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ] +string_array = [ "all", 'strings', """are the same""", '''type'''] -arr6 = [ 1, 2.0 ] # INVALID +# Mixed-type arrays are allowed +numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ] +contributors = [ + "Foo bar ", + { name = "Baz Qux", email = "baz@qux.com", url = "baz.qux.com"} +] ``` Arrays can also be multiline. A terminating comma (also called trailing comma) @@ -598,11 +602,11 @@ is ok after the last value of the array. There can be an arbitrary number of newlines and comments before a value and before the closing bracket. ```toml -arr7 = [ +integers2 = [ 1, 2, 3 ] -arr8 = [ +integers3 = [ 1, 2, # this is ok ] From 4f0027704f8efd461f78810883b0cedd88868306 Mon Sep 17 00:00:00 2001 From: Christian Siefkes Date: Sun, 3 Nov 2019 21:59:53 +0100 Subject: [PATCH 2/6] Add space. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 017fc029..a22fe2be 100644 --- a/README.md +++ b/README.md @@ -593,7 +593,7 @@ string_array = [ "all", 'strings', """are the same""", '''type'''] numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ] contributors = [ "Foo bar ", - { name = "Baz Qux", email = "baz@qux.com", url = "baz.qux.com"} + { name = "Baz Qux", email = "baz@qux.com", url = "baz.qux.com" } ] ``` From d4c4f93e200b4b720d63af3cdee6a5db8fbb8439 Mon Sep 17 00:00:00 2001 From: Christian Siefkes Date: Sun, 3 Nov 2019 22:03:16 +0100 Subject: [PATCH 3/6] Use example doman for addresses. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a22fe2be..c142048e 100644 --- a/README.md +++ b/README.md @@ -592,8 +592,8 @@ string_array = [ "all", 'strings', """are the same""", '''type'''] # Mixed-type arrays are allowed numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ] contributors = [ - "Foo bar ", - { name = "Baz Qux", email = "baz@qux.com", url = "baz.qux.com" } + "Foo bar ", + { name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" } ] ``` From 3604b7374cc5979334732a9bd26ae7ef9b1ba72a Mon Sep 17 00:00:00 2001 From: Christian Siefkes Date: Sun, 3 Nov 2019 22:06:27 +0100 Subject: [PATCH 4/6] Adjust wording since an example of a multiline array was already given --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c142048e..1cb6b870 100644 --- a/README.md +++ b/README.md @@ -597,7 +597,7 @@ contributors = [ ] ``` -Arrays can also be multiline. A terminating comma (also called trailing comma) +Arrays can span multiple lines. A terminating comma (also called trailing comma) is ok after the last value of the array. There can be an arbitrary number of newlines and comments before a value and before the closing bracket. From 77c59b76528c1323bd8bbf14cb9d7556ce296d26 Mon Sep 17 00:00:00 2001 From: Christian Siefkes Date: Sun, 3 Nov 2019 22:14:40 +0100 Subject: [PATCH 5/6] Add another space --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1cb6b870..e37a0259 100644 --- a/README.md +++ b/README.md @@ -587,7 +587,7 @@ integers = [ 1, 2, 3 ] colors = [ "red", "yellow", "green" ] nested_array_of_int = [ [ 1, 2 ], [3, 4, 5] ] nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ] -string_array = [ "all", 'strings', """are the same""", '''type'''] +string_array = [ "all", 'strings', """are the same""", '''type''' ] # Mixed-type arrays are allowed numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ] From 0d7570753d85be5f962bec4dbc8bb059434862be Mon Sep 17 00:00:00 2001 From: Christian Siefkes Date: Sun, 3 Nov 2019 22:16:15 +0100 Subject: [PATCH 6/6] Fix case --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e37a0259..5eb1306b 100644 --- a/README.md +++ b/README.md @@ -592,7 +592,7 @@ string_array = [ "all", 'strings', """are the same""", '''type''' ] # Mixed-type arrays are allowed numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ] contributors = [ - "Foo bar ", + "Foo Bar ", { name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" } ] ```