Skip to content

Commit

Permalink
Add a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Aug 2, 2022
1 parent abfd86b commit c435c83
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ character_ranges text =

## PRIVATE
batch_resolve_indices_or_ranges text descriptors = Panic.recover [Index_Out_Of_Bounds_Error, Illegal_Argument_Error] <|
## This is pre-computing the ranges for all characters in the string, which
may be much more than necessary, for example if all ranges reference only
the beginning of the string. In the future we may want to replace this
with a lazy data structure which advances the break iterator only on
demand, using a Vector.Builder to cache any prior ranges for random
access.
characters = character_ranges text
ranges = Vector.new_builder
descriptors.each descriptor->
Expand Down

0 comments on commit c435c83

Please sign in to comment.