Skip to content

Commit e438608

Browse files
committed
Update for new iteration protocol
1 parent 2eb464e commit e438608

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

src/StrFormat.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Licensed under MIT License, see LICENSE.md
88
module StrFormat
99

1010
using APITools, Format
11-
@api init
1211

1312
@api extend StrAPI, CharSetEncodings, Chars, StrBase, StrLiterals
1413

@@ -25,7 +24,7 @@ end
2524
function _parse_fmt(sx::Vector{Any}, s::AbstractString, unescape::Function,
2625
i::Integer, j::Integer, k::Integer)
2726
# Move past \\, k should point to '%'
28-
c, k = next(s, k)
27+
c, k = str_next(s, k)
2928
check_done(s, k, "Incomplete % expression")
3029
# Handle interpolation
3130
isempty(s[i:j-1]) || push!(sx, unescape(s[i:j-1]))
@@ -36,7 +35,7 @@ function _parse_fmt(sx::Vector{Any}, s::AbstractString, unescape::Function,
3635
# Move past %, c should point to letter
3736
beg = k
3837
while true
39-
c, k = next(s, k)
38+
c, k = str_next(s, k)
4039
check_done(s, k, "Incomplete % expression")
4140
s[k] == '(' && break
4241
end
@@ -50,18 +49,18 @@ end
5049
function _parse_pyfmt(sx::Vector{Any}, s::AbstractString, unescape::Function,
5150
i::Integer, j::Integer, k::Integer)
5251
# Move past \\, k should point to '{'
53-
c, k = next(s, k)
52+
c, k = str_next(s, k)
5453
check_done(s, k, "Incomplete {...} Python format expression")
5554
# Handle interpolation
5655
isempty(s[i:j-1]) || push!(sx, unescape(s[i:j-1]))
5756
beg = k # start location
58-
c, k = next(s, k)
57+
c, k = str_next(s, k)
5958
while c != '}'
6059
check_done(s, k, string("\\{ missing closing } in ", c))
61-
c, k = next(s, k)
60+
c, k = str_next(s, k)
6261
end
6362
check_done(s, k, "Missing (expr) in Python format expression")
64-
c, k = next(s, k)
63+
c, k = str_next(s, k)
6564
c == '(' || parse_error(string("Missing (expr) in Python format expression: ", c))
6665
# Need to find end to parse to
6766
ex, j = _parse_format(s, k-1, Format.pyfmt)

0 commit comments

Comments
 (0)