You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Parsers.jl
+23-6Lines changed: 23 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -283,30 +283,47 @@ end
283
283
Parsing on a `Parsers.Delimited` will first call `Parsers.parse!(d.next, io, result; kwargs...)`, then expect the next bytes to be one of the expected `delims` arguments.
284
284
If one of `delims` is not found, the result is `Parsers.INVALID`, but parsing will continue until a valid `delims` is found. An `eof(io)` is _always_ considered a valid termination state in place of a delimiter.
285
285
"""
286
-
struct Delimited{I, T <:Trie} <:Layer
286
+
struct Delimited{IR, I, T <:Trie} <:Layer
287
287
next::I
288
288
delims::T
289
289
end
290
-
Delimited(next, delims::Union{Char, String}...=',') =Delimited(next, Trie(String[string(d) for d in delims], DELIMITED))
291
-
Delimited(delims::Union{Char, String}...=',') =Delimited(defaultparser, Trie(String[string(d) for d in delims], DELIMITED))
290
+
Delimited(ignore_repeated::Bool, next::I, delims::T) where {I, T <:Trie} =Delimited{ignore_repeated, I, T}(next, delims)
291
+
Delimited(next::Union{Layer, Base.Callable}=defaultparser, delims::Union{Char, String}...; ignore_repeated::Bool=false) =Delimited(ignore_repeated, next, Trie(String[string(d) for d in (isempty(delims) ? (",",) : delims)], DELIMITED))
292
+
Delimited(delims::Union{Char, String}...; ignore_repeated::Bool=false) =Delimited(ignore_repeated, defaultparser, Trie(String[string(d) for d in (isempty(delims) ? (",",) : delims)], DELIMITED))
292
293
293
-
@inlinefunctionparse!(d::Delimited, io::IO, r::Result{T}; kwargs...) where {T}
294
+
@inlinefunctionparse!(d::Delimited{ignore_repeated}, io::IO, r::Result{T}; kwargs...) where {ignore_repeated, T}
0 commit comments