From 765feed4ae5041987ac10d8be9ac56b81960541c Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Sun, 4 Nov 2018 13:39:52 -0500 Subject: [PATCH] Update Parser.jl --- src/Parser.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Parser.jl b/src/Parser.jl index f73a912..731711d 100644 --- a/src/Parser.jl +++ b/src/Parser.jl @@ -24,9 +24,9 @@ mutable struct MemoryParserState <: ParserState s::Int utf8array::PushVector{UInt8, Vector{UInt8}} end +MemoryParserState(str::AbstractString) = MemoryParserState(str, 1, PushVector{UInt8}()) # it is convenient to access MemoryParserState like a Vector{UInt8} to avoid copies -MemoryParserState(str::AbstractString) = MemoryParserState(str, 1, PushVector{UInt8}()) Base.@propagate_inbounds Base.getindex(state::MemoryParserState, i::Int) = codeunit(state.utf8, i) Base.length(state::MemoryParserState) = sizeof(state.utf8) Base.unsafe_convert(::Type{Ptr{UInt8}}, state::MemoryParserState) = unsafe_convert(Ptr{UInt8}, state.utf8)