Created
November 7, 2019 16:33
-
-
Save JRaspass/3ad55f144740237b4aaa04bbc4631de2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- a/lib/TOML/Tiny.pm6 | |
| +++ b/lib/TOML/Tiny.pm6 | |
| @@ -23,7 +23,8 @@ grammar Grammar { | |
| proto token value {*} | |
| + rule value:sym<array> { '[' <value>* % ',' ']' } | |
| token value:sym<datetime> { \d\d [\d\d] ** 3 % '-' T <value:time> Z } | |
| token value:sym<date> { \d\d [\d\d] ** 3 % '-' } | |
| token value:sym<false> { <sym> } | |
| @@ -41,6 +42,7 @@ class Actions { | |
| method key-value ($/) { make $<key>.made => $<value>.made } | |
| method table ($/) { make $<key>.made => $<key-value>».made.Hash } | |
| + method value:sym<array> ($/) { make $<value>».made } | |
| method value:sym<datetime> ($/) { make DateTime.new(~$/) } | |
| method value:sym<date> ($/) { make Date.new(~$/) } | |
| method value:sym<false> ($/) { make False } | |
| diff --git a/t/values.t b/t/values.t | |
| index 43f088d..a9e1324 100644 | |
| --- a/t/values.t | |
| +++ b/t/values.t | |
| @@ -49,6 +49,13 @@ is-deeply from-toml("[foo]\nbar = {.key}"), %(:foo(%(:bar(.value)))), .key for | |
| # Local Time | |
| '07:32:01' => TOML::Tiny::Time.new(7, 32, 1), | |
| + | |
| +# Array | |
| +'[]' => [], | |
| +'[ 123 ]' => [ 123 ], | |
| +'[ 123, 456 ]' => [ 123, 456 ], | |
| +'[ "foo" ]' => [<foo>], | |
| +'[ "foo", "bar" ]' => [<foo bar>], | |
| ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment