Commit Graph
11 Commits
Author SHA1 Message Date
Karoy Lorentey b50fb5aab5 _BString.resolve: Don’t crash when resolving indices in the empty string 2023-03-20 13:12:14 -07:00
Karoy Lorentey b355480eb7 _BString: Make unicodeScalars properties mutable 2023-03-20 13:12:13 -07:00
Karoy Lorentey d79a752fc8 _BString: Review views & add missing functionality/shortcuts 2023-03-20 13:12:13 -07:00
Karoy Lorentey 033bf17f9d _BString: Add UTF-8 and UTF-16 index rounding tests
UTF-16 index rounding is a semantic mess; the behavior is emulating
the stdlib, and it seems far more useful than if we went with a
semantically consistent definition.
2023-03-20 13:12:13 -07:00
Karoy Lorentey 22113290f1 _BString: Adjust substring mutation test to actually exercise Unicode weirdness 2023-03-20 13:12:13 -07:00
Karoy Lorentey 05f8f9b887 _BString: Modernize tests 2023-03-20 13:12:12 -07:00
Karoy Lorentey a10439bc32 _BString, _BSubstring: Merge character views into top-level types. Add RangeReplaceableCollection conformances.
This emulates the standard String.
2023-03-20 13:12:12 -07:00
Karoy Lorentey eda72e344f _BString: Fix character index rounding; use it when accessing character data
Oops, `_BString.subscript(character:)` failed to round down to a character boundary before trying to access the addressed character. It also resolved the index with `preferEnd` set to true, which isn’t what we actually want.
2023-03-20 13:12:12 -07:00
Karoy Lorentey 8c1740ad28 _Rope.Index: Merge height into UInt64 storage.
This leaves 56 bits for path data, which should still be plenty.
(We want to allow big strings to grow to 2^48 UTF-8 code units, to
match the standard String; however, there is no practical need to
support any more, and even that is a stretch.)

Add tests to verify that the tree capacity matches expectations
in Release builds. (In Debug builds, we limit the maximum node size,
which drastically reduces capacity. This is okay.)
2023-03-20 13:12:09 -07:00
Karoy Lorentey 18aa309f75 Generalize some _BString iterators 2023-03-20 13:12:07 -07:00
Karoy Lorentey 150a165d73 Add experimental rope implementation 2023-03-20 13:11:21 -07:00