@@ -17,6 +17,9 @@ module Internals
17
17
end
18
18
end
19
19
20
+ # https://github.com/JuliaLang/julia/issues/36605
21
+ readstring (f:: AbstractString ) = isfile (f) ? read (f, String) : error (repr (f), " : No such file" )
22
+
20
23
"""
21
24
Parser()
22
25
@@ -38,9 +41,9 @@ Parse file `f` and return the resulting table (dictionary). Throw a
38
41
See also: [`TOML.tryparsefile`](@ref)
39
42
"""
40
43
parsefile (f:: AbstractString ) =
41
- Internals. parse (Parser (read (f, String ); filepath= abspath (f)))
44
+ Internals. parse (Parser (readstring (f ); filepath= abspath (f)))
42
45
parsefile (p:: Parser , f:: AbstractString ) =
43
- Internals. parse (Internals. reinit! (p, read (f, String ); filepath= abspath (f)))
46
+ Internals. parse (Internals. reinit! (p, readstring (f ); filepath= abspath (f)))
44
47
45
48
"""
46
49
tryparsefile(f::AbstractString)
@@ -52,9 +55,9 @@ Parse file `f` and return the resulting table (dictionary). Return a
52
55
See also: [`TOML.parsefile`](@ref)
53
56
"""
54
57
tryparsefile (f:: AbstractString ) =
55
- Internals. tryparse (Parser (read (f, String ); filepath= abspath (f)))
58
+ Internals. tryparse (Parser (readstring (f ); filepath= abspath (f)))
56
59
tryparsefile (p:: Parser , f:: AbstractString ) =
57
- Internals. tryparse (Internals. reinit! (p, read (f, String ); filepath= abspath (f)))
60
+ Internals. tryparse (Internals. reinit! (p, readstring (f ); filepath= abspath (f)))
58
61
59
62
"""
60
63
parse(x::Union{AbstractString, IO})
0 commit comments