WIP §32 header recovery — DO NOT MERGE: half-finished; a fuzz test loops without advancing and exhausts memory (crashed the machine 2026-09-03)

Checkpoint of the interrupted dev work (rate limit) so master stays
clean. Known state: a_half_typed_instantiation_is_one_error_node
(expected to invert) and tolerant_parse_equals_strict_parse_on_valid_
sources FAIL; the error_recovery test binary exceeds 6 GB under
tools/guard.sh (a non-advancing recovery loop under the delete-any-
character / truncate fuzzers). Resume in a worktree of this branch,
under tools/guard.sh, fixing the advance guarantee first.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5 committed 2026-09-03 17:48:28 -07:00
1 parent 4d70de1976
commit 6a15594ae8
50 files changed
+1135 -430

No files matched your search

+17
View File
@@ -15,6 +15,14 @@ pub struct Expr {
pub span: TextRange,
}
impl Expr {
/// True for the leaf a tolerant parse leaves where a statement header's
/// condition did not parse; see [`ExprKind::Error`].
pub fn is_error(&self) -> bool {
matches!(self.kind, ExprKind::Error(_))
}
}
#[derive(Debug, Clone)]
pub enum ExprKind {
Ident(String),
@@ -235,6 +243,15 @@ pub enum ExprKind {
/// the whole *item* became [`ItemKind::Verbatim`]. The region itself
/// records nothing and is re-emitted exactly as written.
Verbatim(RawText),
/// Text a **tolerant** parse could not read as an expression, kept
/// verbatim: the `i <` of a half-typed `for (int i = 0; i <` header.
///
/// Built only inside a statement header's brackets, and only by
/// [`crate::parse_tolerant`] — the strict parser fails on the typo
/// instead, exactly as it does for [`ItemKind::Error`] — so the statement
/// keeps its shape and its body while the broken condition is one leaf.
/// See `docs/features/header-recovery/README.md`.
Error(RawText),
/// A type used in expression position (`parameter type T = logic [7:0]`).
Type(DataType),
/// `(min : typ : max)` delay expression.