toolchain: banner purge + WHY-only comment sweep (rule 8)
selfhost/, cmd/, internal/ join the tree-wide sweep: every section banner dies (91 selfhost + the cmd C-style dividers -> 0); narration and stale contracts deleted (pre-#22 bundler notes, retired single-PT_LOAD and no-archive claims, superseded ABI tables); every ref/harec/qbe cite, task cite, encoding/ELF contract, and rule-10 twin pointer kept; lost lifetime/rationale lines restored where the sweep over-cut (elf_globals ownership, kwtab linear-scan). Comment- only proven: all five wwstage tool binaries byte-identical across the sweep; test-commit, test-byteid (161+1399, 0 pinned-divergent), and test-bootstrap (fixed point + 991-995 byte-id) all exit 0. The read-through banked 66 latent-bug leads (checkpoint).
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
/*
|
||||
* parse.c — line-oriented parser for the asm subset emitted by w6c.
|
||||
*
|
||||
* Grammar:
|
||||
* line := blank | comment | label | text | instr
|
||||
* blank := /^\s*$/
|
||||
@@ -52,7 +50,6 @@ a_intern(Asm *a, const char *name)
|
||||
return s;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* line iterator: returns the next line as a NUL-terminated buffer in
|
||||
* line/llen pointers, advances pos. Returns 0 on EOF.
|
||||
*/
|
||||
@@ -70,7 +67,6 @@ nextline(Asm *a, char **line, size_t *llen, char *buf, size_t bufsz)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* skip leading whitespace */
|
||||
static const char *
|
||||
skipws(const char *p)
|
||||
{
|
||||
@@ -168,7 +164,6 @@ parse_operand(Asm *a, const char *s, Aoperand *out)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* (REG) form */
|
||||
if (*s == '(') {
|
||||
s++;
|
||||
char rbuf[8] = {0};
|
||||
@@ -183,7 +178,6 @@ parse_operand(Asm *a, const char *s, Aoperand *out)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* number(REG) form, or label form, or REG */
|
||||
const char *p = s;
|
||||
int sign = 1;
|
||||
if (*p == '-') { sign = -1; p++; }
|
||||
@@ -208,7 +202,6 @@ parse_operand(Asm *a, const char *s, Aoperand *out)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* IDENT — register or symbol-or-label */
|
||||
if (a_isidstart((unsigned char)*s)) {
|
||||
char buf[256] = {0};
|
||||
int n = 0;
|
||||
@@ -226,7 +219,6 @@ parse_operand(Asm *a, const char *s, Aoperand *out)
|
||||
s = end;
|
||||
}
|
||||
|
||||
/* ID(SB) means external symbol */
|
||||
if (*s == '(') {
|
||||
char rbuf[8] = {0};
|
||||
int rn = 0;
|
||||
@@ -253,7 +245,6 @@ parse_operand(Asm *a, const char *s, Aoperand *out)
|
||||
out->type = r;
|
||||
return 0;
|
||||
}
|
||||
/* otherwise it's a branch target */
|
||||
out->type = D_BRANCH;
|
||||
out->sym = strdup(buf);
|
||||
return 0;
|
||||
@@ -281,7 +272,6 @@ a_parse(Asm *a)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* label? */
|
||||
if (a_isidstart((unsigned char)*p) && line[0] != '\t') {
|
||||
const char *q = p;
|
||||
while (a_isidcont((unsigned char)*q)) q++;
|
||||
@@ -308,7 +298,6 @@ a_parse(Asm *a)
|
||||
}
|
||||
}
|
||||
|
||||
/* TEXT or instruction */
|
||||
const char *m = p;
|
||||
char mnem[16] = {0};
|
||||
int n = 0;
|
||||
@@ -332,7 +321,6 @@ a_parse(Asm *a)
|
||||
const char *rest = m;
|
||||
|
||||
if (op == A_TEXT) {
|
||||
/* TEXT name,$framesize */
|
||||
char nbuf[256] = {0};
|
||||
int nn = 0;
|
||||
while (*m && *m != ',' && nn < 255) nbuf[nn++] = *m++;
|
||||
@@ -363,7 +351,6 @@ a_parse(Asm *a)
|
||||
prg->nbytes = 0;
|
||||
} else {
|
||||
m++;
|
||||
/* parse escapes into a fresh buffer */
|
||||
size_t cap = 32, len = 0;
|
||||
u8 *buf = malloc(cap);
|
||||
while (*m && *m != '"') {
|
||||
@@ -398,7 +385,6 @@ a_parse(Asm *a)
|
||||
prg->nbytes = len;
|
||||
}
|
||||
} else {
|
||||
/* split rest at top-level comma */
|
||||
const char *comma = NULL;
|
||||
for (const char *q = rest; *q; q++)
|
||||
if (*q == ',' && comma == NULL) comma = q;
|
||||
|
||||
Reference in New Issue
Block a user