Skip to content

Commit

Permalink
Modify each.jl to use parse instead of tryparse in the `iterate…
Browse files Browse the repository at this point in the history
…` function for `EachParsed`

There is no possibility when iterating it will return a `nothing` in the current implementation. And

```julia
Base.eltype(::Type{EachParsed{T}}) where {T} = T
```

does not let it to return a `Nothing`. Also, using `parse` is more aligned with the name `EachParsed`.
  • Loading branch information
singularitti committed Oct 30, 2023
1 parent 74d9a0b commit 04cf8b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PWscf/output/each.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Base.iterate(regexmatchiterator::EachParsed{T}) where {T}
return nothing
else
matched, state = iterated
return tryparse(T, matched.match), state
return parse(T, matched.match), state
end
end
function Base.iterate(regexmatchiterator::EachParsed{T}, state) where {T}
Expand All @@ -97,7 +97,7 @@ function Base.iterate(regexmatchiterator::EachParsed{T}, state) where {T}
return nothing
else
matched, state = iterated
return tryparse(T, matched.match), state
return parse(T, matched.match), state
end
end

Expand Down

0 comments on commit 04cf8b8

Please sign in to comment.