File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -164,22 +164,27 @@ function ConditionSet(spec::S) where {S <: AbstractString}
164164 elseif chr == ' \\ '
165165 escaped = true
166166 elseif chr == FILTER_SEPARATOR
167- str = SubString (spec, mark: prevind (spec, pos))
168- if ! isempty (dropbytes)
169- str = SubString (convert (S, String (deleteat! (collect (codeunits (str)), dropbytes))))
167+ str = if isempty (dropbytes)
168+ SubString (spec, mark: prevind (spec, pos))
169+ else
170+ subbytes = deleteat! (codeunits (spec)[mark: pos- 1 ], dropbytes)
170171 empty! (dropbytes)
172+ SubString (convert (S, String (subbytes)))
171173 end
172174 addcond! (cset, lstrip (str))
173175 mark = pos + 1
174176 end
175177 pos = nextind (spec, pos)
176178 end
177179 if mark <= lastind
178- str = SubString (spec, mark: prevind (spec, pos))
179- if ! isempty (dropbytes)
180- str = SubString (convert (S, String (deleteat! (collect (codeunits (str)), dropbytes))))
180+ str = if isempty (dropbytes)
181+ SubString (spec, mark)
182+ else
183+ subbytes = deleteat! (codeunits (spec)[mark: end ], dropbytes)
184+ empty! (dropbytes)
185+ SubString (convert (S, String (subbytes)))
181186 end
182- addcond! (cset, lstrip (SubString (spec, mark : lastind) ))
187+ addcond! (cset, lstrip (str ))
183188 end
184189 cset
185190end
Original file line number Diff line number Diff line change 231231 cset = ConditionSet (" hello\\ ;world;=exact" )
232232 @test cset. words == [SubString (" hello;world" )]
233233 @test cset. exacts == [SubString (" exact" )]
234+ cset = ConditionSet (" 1 \\ ; 2" )
235+ @test cset. words == [SubString (" 1 ; 2" )]
234236 end
235237 @testset " Complex query" begin
236238 cset = ConditionSet (" some = words ;; !error ; julia> ;/^def.*;" )
You can’t perform that action at this time.
0 commit comments