JuliaLang / TOML.jl

A fast TOML parser for TOML 1.0 written in Julia
MIT License
34 stars 15 forks source link

Custom associative type to use when parsing TOML objects #45

Open gryumov opened 1 year ago

gryumov commented 1 year ago
using TOML, OrderedCollections

TOML.parse(toml, dicttype = OrderedDict{String,Any})
OmegaLambda1998 commented 1 year ago

Could you do this by changing:

mutable struct Parser
    ...
    root::AbstractDict
    ...
end

So that you could do, for instance:

parser = TOML.Parser()
parser.root = OrderedDict{String, Any}()
TOML.parse(parser, toml)
OmegaLambda1998 commented 1 year ago

It's a bit more complicated then I suspected, but I think I got it working in the above pull request