Abstractions for working over raw Source Code of typical Programming Languages in TypeScript
Find a file
2026-04-06 18:06:45 +02:00
src eof helpers 2026-04-06 18:06:45 +02:00
tmp_repl Initial commit 2026-04-06 15:33:41 +02:00
.gitignore Initial commit 2026-04-06 15:33:41 +02:00
LICENSE Make it into library 2026-04-06 16:05:09 +02:00
package-lock.json Make it into library 2026-04-06 16:05:09 +02:00
package.json Make it into library 2026-04-06 16:05:09 +02:00
README.md Initial commit 2026-04-06 15:33:41 +02:00
tsconfig.json Make it into library 2026-04-06 16:05:09 +02:00

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)