@@ -25,7 +25,7 @@ module Internals
25
25
end
26
26
27
27
# https://github.com/JuliaLang/julia/issues/36605
28
- readstring (f:: AbstractString ) = isfile (f) ? read (f, String) : error (repr (f), " : No such file" )
28
+ _readstring (f:: AbstractString ) = isfile (f) ? read (f, String) : error (repr (f), " : No such file" )
29
29
30
30
"""
31
31
Parser()
@@ -55,9 +55,9 @@ Parse file `f` and return the resulting table (dictionary). Throw a
55
55
See also [`TOML.tryparsefile`](@ref).
56
56
"""
57
57
parsefile (f:: AbstractString ) =
58
- Internals. parse (Internals. Parser {Dates} (readstring (f); filepath= abspath (f)))
58
+ Internals. parse (Internals. Parser {Dates} (_readstring (f); filepath= abspath (f)))
59
59
parsefile (p:: Parser , f:: AbstractString ) =
60
- Internals. parse (Internals. reinit! (p. _p, readstring (f); filepath= abspath (f)))
60
+ Internals. parse (Internals. reinit! (p. _p, _readstring (f); filepath= abspath (f)))
61
61
62
62
"""
63
63
tryparsefile(f::AbstractString)
@@ -69,9 +69,9 @@ Parse file `f` and return the resulting table (dictionary). Return a
69
69
See also [`TOML.parsefile`](@ref).
70
70
"""
71
71
tryparsefile (f:: AbstractString ) =
72
- Internals. tryparse (Internals. Parser {Dates} (readstring (f); filepath= abspath (f)))
72
+ Internals. tryparse (Internals. Parser {Dates} (_readstring (f); filepath= abspath (f)))
73
73
tryparsefile (p:: Parser , f:: AbstractString ) =
74
- Internals. tryparse (Internals. reinit! (p. _p, readstring (f); filepath= abspath (f)))
74
+ Internals. tryparse (Internals. reinit! (p. _p, _readstring (f); filepath= abspath (f)))
75
75
76
76
"""
77
77
parse(x::Union{AbstractString, IO})
@@ -135,4 +135,17 @@ supported type.
135
135
"""
136
136
const print = Internals. Printer. print
137
137
138
+ public Parser, parsefile, tryparsefile, parse, tryparse, ParserError, print
139
+
140
+ # These methods are private Base interfaces, but we do our best to support them over
141
+ # the TOML stdlib types anyway to minimize downstream breakage.
142
+ Base. TOMLCache (p:: Parser ) = Base. TOMLCache (p. _p, Dict {String, Base.CachedTOMLDict} ())
143
+ Base. TOMLCache (p:: Parser , d:: Base.CachedTOMLDict ) = Base. TOMLCache (p. _p, d)
144
+ Base. TOMLCache (p:: Parser , d:: Dict{String, Dict{String, Any}} ) = Base. TOMLCache (p. _p, d)
145
+
146
+ Internals. reinit! (p:: Parser , str:: String ; filepath:: Union{Nothing, String} = nothing ) =
147
+ Internals. reinit! (p. _p, str; filepath)
148
+ Internals. parse (p:: Parser ) = Internals. parse (p. _p)
149
+ Internals. tryparse (p:: Parser ) = Internals. tryparse (p. _p)
150
+
138
151
end
0 commit comments