Commit Graph
7 Commits
Author SHA1 Message Date
petrbalvin 373ec51061 fix(format): treat a selector-folded label as naming its macro
The lexer folds NAME.selector into one identifier, and an object macro
reached through the selector expands with it travelling along, so a
label spelled NAME.selector: restructures exactly like the bare name
would.  The macro-name checks now resolve the prefix before the first
period, and the crashing input joins the corpus.

Assisted-by: GLM 5.3
2026-10-07 13:54:42 +02:00
petrbalvin f932c5811c fix(format): never peel a stacked label that names a macro
Peeling a stacked label whose name is a macro moves it onto a line of
its own, where its expansion decides the line's shape: an empty body
leaves a bare colon behind, a line the parser rejects.  The peel loops
now hold such labels back with the rest of the line, and the crashing
input joins the corpus.

Assisted-by: GLM 5.3
2026-10-07 13:54:42 +02:00
petrbalvin b54d2b4520 fix(format): keep macro content behind a label on its line
The canonical form splits a label from the instruction that follows it,
but an identifier naming a macro may expand into any token at all: moved
to a line of its own it no longer parses, because the parser accepts a
non-mnemonic first token only behind a label.  The names #define'd in
the file now hold such content back, conservatively across the whole
file, and the crashing input joins the corpus.

Assisted-by: GLM 5.3
2026-10-07 13:54:42 +02:00
petrbalvin f452b8a995 fix(format): keep a macro-named label line whole
A label whose name is a macro expands into whatever the body is, so the
line's statement structure exists only after expansion; splitting the
label off changed clean input into a different statement sequence.  The
formatter now records the names #define'd above each line and renders
such a label line unsplit, and the crashing input joins the corpus.

Assisted-by: GLM 5.3
2026-10-07 13:54:42 +02:00
petrbalvin 715298ed23 test(format): keep the expansion signature off the EOF comment newline
An unterminated block comment at the end of a file swallows the
formatter's mandatory final newline, an artifact the token view already
documents as layout; the preproc signature entry now trims it so the
invariant stays about tokens.  The triggering input joins the corpus.

Assisted-by: GLM 5.3
2026-10-07 13:54:42 +02:00
petrbalvin bbe14dd1ab fix(parser): diagnose GLOBL and DATA without a symbol name
A bare GLOBL or DATA parsed without a single diagnostic while leaving a
nil Name in the tree, a pointer every downstream tool dereferences; TEXT
keeps a placeholder beside its error for exactly that reason, and GLOBL
and DATA now do the same.  The crashing input enters the corpus.

Assisted-by: GLM 5.3
2026-10-07 13:54:42 +02:00
petrbalvin 05de774c0a test(format): pin the macro-layout crashers as corpus seeds
The two inputs the expansion round-trip target was built for, the object
macro with a parenthesised body and the continuation-only macro body,
enter the seed corpus so every plain go test run replays them.

Assisted-by: GLM 5.3
2026-10-07 13:54:42 +02:00