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:
2026-08-08 19:19:27 +09:00
parent b52f30a894
commit 241f28c96b
6 changed files with 87 additions and 18 deletions

View File

@@ -1,13 +1,13 @@
package wwfixture;
def protocolversion: i32 = 1;
def corpuscount: i32 = 1741;
def errorcount: i32 = 345;
def corpuscount: i32 = 1745;
def errorcount: i32 = 346;
def compilecount: i32 = 21;
def runcount: i32 = 209;
def runexitcount: i32 = 1166;
def nativecount: i32 = 3482;
def corpushash: str = "bad5b37d555f3f4d742f7a6fcfa857ff46315757233819a19eb9bc1da2800ce7";
def runexitcount: i32 = 1169;
def nativecount: i32 = 3490;
def corpushash: str = "472974a00552c6b3f5db1fc6b0c1ed128d7554e134880196c833f11f99370f21";
type directive = enum i32 {
ERROR = 0,