textLength property

int get textLength

Total source-character length of this subtree, in O(1).

Leaves (GreenToken, GreenMissing) compute it directly; interior nodes (GreenTree, GreenUnexpected) store it, summed once from their children's lengths at construction. This keeps offset computation in RedTree linear in tree depth rather than quadratic — descending N levels reads N cached lengths instead of re-walking N subtrees. Matches Rowan's stored-width design.

Implementation

int get textLength;