|
163 | 163 | function check_prefix_chars(chars) |
164 | 164 | result = Set{Char}() |
165 | 165 | for c in chars |
166 | | - if isalpha(c) || isnumeric(c) || c == '-' |
| 166 | + if isletter(c) || isnumeric(c) || c == '-' |
167 | 167 | throw(ArgParseError("‘$(c)’ is not allowed as prefix character")) |
168 | 168 | end |
169 | 169 | push!(result, c) |
@@ -1663,6 +1663,7 @@ function usage_string(settings::ArgParseSettings) |
1663 | 1663 | str_wrapped = wrap(str_nonwrapped, break_long_words = false, break_on_hyphens = false, |
1664 | 1664 | subsequent_indent = min(usage_len, lc_len_limit)) |
1665 | 1665 |
|
| 1666 | + |
1666 | 1667 | out_str = replace(str_wrapped, nbspc => ' ') |
1667 | 1668 | return out_str |
1668 | 1669 | end |
@@ -1938,7 +1939,7 @@ function preparse(c::Channel, state::ParserState, settings::ArgParseSettings) |
1938 | 1939 | popfirst!(args_list) |
1939 | 1940 | continue |
1940 | 1941 | elseif startswith(arg, "--") |
1941 | | - eq = coalesce(findfirst(isequal('='), arg), 0) |
| 1942 | + eq = something(findfirst(isequal('='), arg), 0) |
1942 | 1943 | if eq ≠ 0 |
1943 | 1944 | opt_name = arg[3:prevind(arg,eq)] |
1944 | 1945 | arg_after_eq = arg[nextind(arg,eq):end] |
@@ -2237,16 +2238,21 @@ function parse_long_opt(state::ParserState, settings::ArgParseSettings) |
2237 | 2238 | end |
2238 | 2239 | #}}} |
2239 | 2240 |
|
| 2241 | +if VERSION < v"0.7.0-DEV.5126" # TODO: remove after 0.6 support is dropped |
| 2242 | + # very crude hack to avoid deprecation warning |
| 2243 | + const iterate = next |
| 2244 | +end |
| 2245 | + |
2240 | 2246 | # parse short opts |
2241 | 2247 | #{{{ |
2242 | 2248 | function parse_short_opt(state::ParserState, settings::ArgParseSettings) |
2243 | 2249 | shopts_lst = state.token |
2244 | 2250 | rest_as_arg = nothing |
2245 | | - sind = start(shopts_lst) |
2246 | | - while !done(shopts_lst, sind) |
2247 | | - opt_char, next_sind = next(shopts_lst, sind) |
2248 | | - if !done(shopts_lst, next_sind) |
2249 | | - next_opt_char, next2_sind = next(shopts_lst, next_sind) |
| 2251 | + sind = firstindex(shopts_lst) |
| 2252 | + while sind ≤ ncodeunits(shopts_lst) |
| 2253 | + opt_char, next_sind = iterate(shopts_lst, sind) |
| 2254 | + if next_sind ≤ ncodeunits(shopts_lst) |
| 2255 | + next_opt_char, next2_sind = iterate(shopts_lst, next_sind) |
2250 | 2256 | if next_opt_char == '=' |
2251 | 2257 | next_is_eq = true |
2252 | 2258 | rest_as_arg = shopts_lst[next2_sind:end] |
|
0 commit comments