From 7707b8b046aff330efabd1ad158a5e898a918b54 Mon Sep 17 00:00:00 2001 From: Gregor Kappler Date: Wed, 19 Aug 2020 11:05:30 +0200 Subject: [PATCH] fix #9 _iterate(::Bytes,sequence,till,...) check whether number of bytes available --- src/CombinedParsers.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CombinedParsers.jl b/src/CombinedParsers.jl index dfb200f..bd23e3f 100644 --- a/src/CombinedParsers.jl +++ b/src/CombinedParsers.jl @@ -485,7 +485,7 @@ struct Bytes{T} <: CombinedParser{MatchState,T} end Bytes(N::Integer, T::Type=Char) = Bytes{T}(N) _iterate(parser::Bytes, sequence, till, posi, next_i, state::Nothing) = - nextind(sequence,posi,parser.N), MatchState() + posi+parser.N <= till ? (nextind(sequence,posi,parser.N), MatchState()) : nothing _iterate(parser::Bytes, sequence, till, posi, next_i, state::MatchState) = nothing regex_string_(x::Bytes{N}) where N = ".{$(N)}"