Initial commit

This commit is contained in:
Yura Dupyn 2026-04-06 15:33:41 +02:00
commit aa7ce6e064
4 changed files with 253 additions and 0 deletions

12
README.md Normal file
View file

@ -0,0 +1,12 @@
TypeScript library for handling source code strings.
It has its own String type that deals with unicode in a saner than JS's UTF16 strings.
This take in JS string, and makes it into a fat string `SourceText` that handles all the insanity of UTF16 in JS (like JS leaking UTF16 internals so that there are code-points spanning multiple indices in the string array).
- it handles NFC Normalization
- makes the original string easy to traverse in error-free way by introducing a character abstraction - type `CodePoint` and its position within the SourceText called `CodePointIndex`
- It also tracks where line start (handling various platform specific weirdness like `\r\n`)
It also allows for Spatial Tracking or verious sub-regions within the source. It introduces
- point-like `SourceLocation` abstraction (basically where a cursor could be)
- and interval-like `Span` abstraction (basically what a mouse selection could span)