]> gitweb.factorcode.org Git - factor.git/commitdiff
toml: handle "[,,,,,,]" array values
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 25 Oct 2023 18:01:09 +0000 (11:01 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 25 Oct 2023 18:01:09 +0000 (11:01 -0700)
basis/toml/toml-tests.factor
basis/toml/toml.factor

index 0b9c483f5616ec0112ae4d3cc7bc68885c950595..b3423c68d53d16663468a895898a826dbea586fa 100644 (file)
@@ -512,6 +512,8 @@ animal = { type.name = "pug" }]=] toml>
 { 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
+{ H{ { "a" { 1 2 3 } } } } [ "a=[,1,,,,2,,3,,]" toml> ] unit-test
+{ H{ { "a" { 1 2 3 } } } } [ "a=[ # this\n,1,, # is\n,,2, #a\n,3,, # comment \n]" toml> ] unit-test
 
 ! unreleased
 
index 8250097188c697e85187c3e1553fff17878831de..4697b81cf42b2bf6a38fa812f2c422fc2f13a6d9 100644 (file)
@@ -211,15 +211,13 @@ DEFER: value-parser
 
 : array-value-parser ( -- parser )
     ws-comment-newline hide
-    value-parser
+    value-parser optional
     ws-comment-newline hide 3seq [ first ] action ;
 
 : array-parser ( -- parser )
     [
         "[" token hide ,
-        array-value-parser separator list-of optional ,
-        separator optional hide ,
-        ws-comment-newline hide ,
+        array-value-parser separator list-of [ sift ] action ,
         "]" token hide ,
     ] seq* [ first { } like ] action ;