Files
regex-tools/docs/EXTRACTION_MODEL.md

40 lines
1.7 KiB
Markdown

# Extraction model
Extraction nodes contain actual engine match/capture values and ranges. The
syntax tree supplies capture names and parent relationships; engine results
supply participation, value and offsets.
Statuses distinguish:
- participated with non-empty text;
- participated and matched empty;
- did not participate;
- unavailable range;
- preview-truncated value.
Exact match and capture ranges are retained even when a displayed value exceeds
the 64 Ki UTF-16 per-value preview limit or the shared 8 Mi-unit preview
budget. Consumers must inspect the preview status rather than treating a
preview as complete. In particular, list export is disabled if its template
would consume an incomplete value.
Repeated captures expose only the final retained value in all twelve v0.4.2
profiles. This includes .NET even though its native API can retain capture
history: the current adapter deliberately normalizes only the final record and
reports `captureHistory: false`. The UI labels the limitation and does not
invent or silently discard advertised history.
The partial syntactic hierarchy remains useful when the active provider found
capture relationships, even if actual spans overlap or fall outside a parent's
geometry. For C++ alternate grammars or suppressed submatches, capture
discovery can be explicitly unavailable. Runtime records remain authoritative.
Native and normalized ranges are preserved rather than “fixed”:
- JavaScript, Java, Scala compatibility and .NET use UTF-16 code units;
- standalone PCRE2, PHP, Go and Rust use UTF-8 bytes; and
- Python, Ruby, C++ and legacy Perl use Unicode code points.
All editor ranges are normalized to UTF-16 only after the adapter verifies
valid boundaries. The native unit and original range remain available.