Skip to content

Commit dffbbd7

Browse files
authored
Merge pull request #53 from JuliaString/spj/printfparse
Use Printf.Format instead of Printf.parse
2 parents 4bbf367 + 665f447 commit dffbbd7

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ keywords = ["Strings", "Formatting"]
2323
license = "MIT"
2424
name = "Format"
2525
uuid = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8"
26-
version = "1.1.0"
26+
version = "1.2.0"
2727

2828
[deps]
2929
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"

src/cformat.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ formatters = Dict{ ASCIIStr, Function }()
33
cfmt( fmt::ASCIIStr, x ) = m_eval(Expr(:call, generate_formatter( fmt ), x))
44

55
function checkfmt(fmt)
6-
test = Printf.parse( fmt )
7-
(length( test ) == 1 && typeof( test[1] ) <: Tuple) ||
8-
error( "Only one AND undecorated format string is allowed")
6+
@static if VERSION > v"1.6.0-DEV.854"
7+
test = Printf.Format(fmt)
8+
length(test.formats) == 1 ||
9+
error( "Only one AND undecorated format string is allowed")
10+
else
11+
test = @static VERSION >= v"1.4.0-DEV.180" ? Printf.parse(fmt) : Base.Printf.parse( fmt )
12+
(length( test ) == 1 && typeof( test[1] ) <: Tuple) ||
13+
error( "Only one AND undecorated format string is allowed")
14+
end
915
end
1016

1117
function generate_formatter( fmt::ASCIIStr )

0 commit comments

Comments
 (0)