@@ -4,7 +4,7 @@ module Printf
4
4
5
5
using . Base. Ryu
6
6
7
- export @printf , @sprintf
7
+ export @printf , @sprintf , Format, format, @format
8
8
9
9
const Ints = Union{Val{' d' }, Val{' i' }, Val{' u' }, Val{' x' }, Val{' X' }, Val{' o' }}
10
10
const Floats = Union{Val{' e' }, Val{' E' }, Val{' f' }, Val{' F' }, Val{' g' }, Val{' G' }, Val{' a' }, Val{' A' }}
@@ -118,7 +118,7 @@ function Format(f::AbstractString)
118
118
pos += 1
119
119
end
120
120
# parse type
121
- ! (b in b " diouxXDOUeEfFgGaAcCsSpn" ) && throw (ArgumentError (" invalid format string: '$f '" ))
121
+ ! (b in b " diouxXDOUeEfFgGaAcCsSpn" ) && throw (ArgumentError (" invalid format string: '$f ', invalid type specifier: ' $( Char (b)) ' " ))
122
122
type = Val{Char (b)}
123
123
if type <: Ints && precision > 0
124
124
zero = false
@@ -428,17 +428,17 @@ macro printf(io_or_fmt, fmt_or_first_arg, args...)
428
428
if io_or_fmt isa String
429
429
io = stdout
430
430
fmt = Format (io_or_fmt)
431
- return esc (:(Printf. format ($ io, $ fmt, $ fmt_or_first_arg, $ (args... ))))
431
+ return esc (:(Base . Printf. format ($ io, $ fmt, $ fmt_or_first_arg, $ (args... ))))
432
432
else
433
433
io = io_or_fmt
434
434
fmt = Format (fmt_or_first_arg)
435
- return esc (:(Printf. format ($ io, $ fmt, $ (args... ))))
435
+ return esc (:(Base . Printf. format ($ io, $ fmt, $ (args... ))))
436
436
end
437
437
end
438
438
439
439
macro sprintf (fmt, args... )
440
440
f = Format (fmt)
441
- return esc (:(Printf. format ($ f, $ (args... ))))
441
+ return esc (:(Base . Printf. format ($ f, $ (args... ))))
442
442
end
443
443
444
444
end # module
0 commit comments