@@ -213,7 +213,6 @@ function _base_parse(::Type{FD{T, f}}, source::AbstractString, mode::RoundingMod
213
213
throw (ArgumentError (" Unhandled rounding mode $mode " ))
214
214
end
215
215
216
- isempty (source) && throw ((" Empty input is not allowed" ))
217
216
bytes = codeunits (source)
218
217
options = mode === RoundNearest ? OPTIONS_ROUND_NEAREST :
219
218
mode === RoundToZero ? OPTIONS_ROUND_TO_ZERO :
@@ -223,12 +222,14 @@ function _base_parse(::Type{FD{T, f}}, source::AbstractString, mode::RoundingMod
223
222
end
224
223
225
224
function Base. tryparse (:: Type{FD{T, f}} , source:: AbstractString , mode:: RoundingMode = RoundNearest) where {T, f}
225
+ isempty (source) && return nothing
226
226
res = _base_parse (FD{T, f}, source, mode)
227
227
# If we didn't reach eof, there was some garbage at the end of the string after something that looked like a number
228
228
return (Parsers. eof (res. code) && Parsers. ok (res. code)) ? res. val : nothing
229
229
end
230
230
231
231
function Base. parse (:: Type{FD{T, f}} , source:: AbstractString , mode:: RoundingMode = RoundNearest) where {T, f}
232
+ isempty (source) && throw (ArgumentError (" Empty input is not allowed" ))
232
233
res = _base_parse (FD{T, f}, source, mode)
233
234
Parsers. inexact (res. code) && throw (InexactError (:parse , FD{T, f}, source))
234
235
Parsers. overflow (res. code) && throw (OverflowError (" overflow parsing $(repr (source)) as $(FD{T, f}) " ))
0 commit comments