syntax: align for-header grammar to cstage (Go's three forms)
The bbdd8bed residue, ruled by the Go derivation (ww's for IS the Go
for; the cstage grammar is the language definition and already the
Go-shaped one):
- bare `for { }` accepted (align UP to parse.c:1023, incl. for-else);
- 3-clause cond and post each omissible — `for (init;; post)`,
`for (init; cond)`, `for (init;)` (align UP, parse.c:1092-1097);
- 2-clause `for (cond; post)` REJECTED (align DOWN): the form exists
in neither Go nor cstage (parse.c:1101 eats a stray ';' then
requires ')'), so the old wwstage accept was a parser bug. The
reject wording mirrors cstage's failure mode per stage.
forhdr_{brace,emptymid,partial} run fixtures pin the accepted forms
byte-identically; forhdr_twoclause_reject pins both reject fragments.
Corpus pin 1745/346/21/209/1169/3490.
This commit is contained in:
10
test/wcc/data/forhdr_brace/case.ww
Normal file
10
test/wcc/data/forhdr_brace/case.ww
Normal file
@@ -0,0 +1,10 @@
|
||||
//ww:run-exit 5
|
||||
package main;
|
||||
export fn main() i32 = {
|
||||
let i: i32 = 0;
|
||||
for {
|
||||
i += 1;
|
||||
if (i >= 5) { break; };
|
||||
};
|
||||
return i;
|
||||
};
|
||||
Reference in New Issue
Block a user