{ x = 2, y = 4, z = 8 } ] ]=] toml>
] unit-test
+{ H{ { "a" { } } } } [ "a=[]" toml> ] unit-test
+{ H{ { "a" { 1 } } } } [ "a=[1]" toml> ] unit-test
+{ H{ { "a" { 1 2 3 } } } } [ "a=[1,2,3]" toml> ] unit-test
+
! unreleased
! Clarify Unicode and UTF-8 references.
! Copyright (C) 2019 John Benediktsson
! See https://factorcode.org/license.txt for BSD license
-USING: accessors ascii assocs hashtables kernel make math.parser
-peg peg.parsers regexp sequences splitting strings.parser ;
+USING: accessors ascii assocs hashtables io.encodings.utf8
+io.files kernel make math.parser peg peg.parsers regexp
+sequences splitting strings.parser ;
! https://github.com/toml-lang/toml/blob/main/toml.abnf
: value-parser ( -- parser )
[
[
+ array-parser ,
boolean-parser ,
datetime-parser ,
date-parser ,
float-parser ,
integer-parser ,
string-parser ,
- array-parser ,
inline-table-parser ,
] choice*
] delay ;
: toml> ( string -- assoc )
[ H{ } clone dup ] dip parse-toml [ update-toml ] each drop ;
+
+: path>toml ( path -- assoc )
+ utf8 file-contents toml> ;