From fd863fdf443720e5dff9ba6d18dd050364d36e18 Mon Sep 17 00:00:00 2001 From: Pierre van de Laar Date: Fri, 9 Oct 2026 10:56:16 +0200 Subject: [PATCH 1/2] Improved documentation - text segment can be any piece of text in the code --- src/renaissance/syntax_tree/text_segment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/renaissance/syntax_tree/text_segment.py b/src/renaissance/syntax_tree/text_segment.py index f9e34128..d273e21b 100644 --- a/src/renaissance/syntax_tree/text_segment.py +++ b/src/renaissance/syntax_tree/text_segment.py @@ -8,7 +8,8 @@ class TextSegment(Protocol): """Protocol for anything that represents a text segment. A text segment is a consecutive piece, a.k.a. a slice, within a text. - Instances include comments, whitespace (incl. empty lines), and syntax nodes. + Instances include comments, whitespace (incl. empty lines), syntax nodes, and + combinations thereof. Read-only access is enforced "as much as possible" by exposing only @property getters in the protocol. From 5a550ef59b5f12730643f50b3d09bedd97f8d1c4 Mon Sep 17 00:00:00 2001 From: Pierre van de Laar Date: Fri, 9 Oct 2026 11:08:06 +0200 Subject: [PATCH 2/2] Improved documentation of text segment --- src/renaissance/syntax_tree/text_segment.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/renaissance/syntax_tree/text_segment.py b/src/renaissance/syntax_tree/text_segment.py index d273e21b..38e9b49d 100644 --- a/src/renaissance/syntax_tree/text_segment.py +++ b/src/renaissance/syntax_tree/text_segment.py @@ -8,8 +8,11 @@ class TextSegment(Protocol): """Protocol for anything that represents a text segment. A text segment is a consecutive piece, a.k.a. a slice, within a text. - Instances include comments, whitespace (incl. empty lines), syntax nodes, and - combinations thereof. + Any consecutive piece of text qualifies; + it need not correspond to a single syntactic construct. + Instances include comments, whitespace (incl. empty lines), syntax nodes, + combinations thereof, such as a syntax node together with its associated trivia, + and even a regular expression match, which has no relation to a syntax tree at all. Read-only access is enforced "as much as possible" by exposing only @property getters in the protocol.