Skip to content

selfhost: canonicalize reference-span syntax in Stage-A parser - #773

Closed
godofecht wants to merge 1 commit into
selfhost/reference-span-metafrom
selfhost/reference-span-parser
Closed

godofecht wants to merge 1 commit into
selfhost/reference-span-metafrom
selfhost/reference-span-parser

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Final parser-facing #720 contract, stacked on #772.

Adds an end-to-end parser test for all four required forms: &[T], &mut [T], &[T; N], and &mut [T; N]. Each parsed parameter must become a synthetic span AST_TYPE, preserve mutability and optional extent, and normalize byte-for-byte to span_const_<elem> / span_mut_<elem>.

This is intentionally red against the current parser: unsized references currently discard &/mut and produce anonymous slice AST_TYPE nodes with no span identity, while sized [T; N] syntax is not accepted by the current slice branch at all.

The safe source splice in flowc_parse_type is now fully specified: retain whether the reference has mut; parse the bracketed element and optional ; INT extent; construct one AST_TYPE whose a is the element, ival is the extent (or 0), and call flowc_ast_type_set_synthetic_span with the retained mutability. Plain non-reference [T] behavior should remain unchanged unless deliberately migrated in a separate compatibility patch.

The large parser file is not whole-file-replaced through the current connector; this branch remains a red local contract until that bounded source splice is applied from a complete checkout.

All commits use [skip ci]; qualification is local only.

Related: #674 #677 #718 #720 #772

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant