Open NatElkins opened 8 years ago
^^ Just realized I forgot to say that I was running this in Script.fsx.
Well I've noticed
[package]
author = [ 10, 10 ]
works
author = [ 10 ]
fails
author = [ ]
fails
The best way to diagnose these issues is to break it down into component parts
let prun psr str = run psr str |> printfn "%A"
prun pArray_toml "[ 10 ]"
;;
> Success: [Float 10.0]
val it : unit = ()
prun toml_item "a = []"
;;
>Success: ("a", Array [])
val it : unit = ()
You can get all the threading stuff out of the stack trace by changing
let parse_toml_table =
(toml_section .>>. (section_splitter |>> fun ls ->
Array.ofList ls |> Array.Parallel.map parse_block))
|>> construct_toml
let parse_to_print =
toml_section .>>. (section_splitter |>> fun ls ->
Array.ofList ls |> Array.Parallel.map parse_block)
|>> sprint_parse_array
// Array.Parallel.map -> Array.map
let parse_toml_table =
(toml_section .>>. (section_splitter |>> fun ls ->
Array.ofList ls |> Array.map parse_block))
|>> construct_toml
let parse_to_print =
toml_section .>>. (section_splitter |>> fun ls ->
Array.ofList ls |> Array.map parse_block)
|>> sprint_parse_array
By adding a print statement in
let parse_toml_table =
(toml_section .>>. (section_splitter |>> fun ls ->
ls |> List.iter (fun (a,b)-> printfn "%A\n%A" a b )
Array.ofList ls |> Array.map parse_block))
|>> construct_toml
while running on
let test = TomlFSharp.Read.readTomlString """
[package]
a = [ 10, 10 ]
b = [ 10 ]
"""
It printed
"[package]"
"
a = [ 10, 10 ]
b = "
which explains why there'd be an EOF error there, the section splitter is prematurely truncating the section.
@NatElkins if you want to take a stab at fixing this I've gotten you most of the way there ;P I've got a bunch of other stuff to work on so I probably won't get back to this for a while
Issue Parser fails on the following:
with this error
Steps to reproduce Send the required dependencies to FSI (the first couple of lines at the top of the file), and then send the snippet above to FSI.
The same error will occur if the text is saved in a file and
readFromTomlFile
is used