test: banner purge + WHY-only comment sweep (rule 8)
Every section banner dies (103 -> 0) across test/lang, the observer suites, the C carriers, and the five comment-heavy corpus fixtures; banner provenance (#N cites, carrier numbers, repair-cluster labels) folded into headers or adjacent WHY comments. Narration deleted; row provenance, ref cites, divergence pins, and layout contracts kept (fwd-ref decl-order guards and bootstrap-gate corpus rationale restored where the sweep over-cut). Comment-only proven: all 3742 wwbuild workdir .s byte-identical before/after; test-commit and test-byteid (161 lang + 1399 data, 0 pinned-divergent) green.
This commit is contained in:
@@ -1,13 +1,3 @@
|
||||
/*
|
||||
* 100_lex — table-driven lexer tests.
|
||||
*
|
||||
* Each row is a (src, expected) pair. The expected string is the
|
||||
* concatenation of token names, space-separated. For literals we
|
||||
* also encode the value: e.g. INT(42), STR("hi"), IDENT(foo).
|
||||
*
|
||||
* EOF is implicit: the harness checks that lexnext returns TK_EOF
|
||||
* after the last expected token.
|
||||
*/
|
||||
#include "ww.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -75,7 +65,6 @@ static const struct row rows[] = {
|
||||
{ "// comment\n", "" },
|
||||
{ "/* a /b/ c */", "" },
|
||||
|
||||
/* identifiers + keywords */
|
||||
{ "foo", "IDENT(foo)" },
|
||||
{ "fn", "fn" },
|
||||
{ "fn main", "fn IDENT(main)" },
|
||||
@@ -84,7 +73,6 @@ static const struct row rows[] = {
|
||||
{ "if else for switch case return import type struct defer break continue proc chan nil true false package",
|
||||
"if else for switch case return import type struct defer break continue proc chan nil true false package" },
|
||||
|
||||
/* numbers */
|
||||
{ "0", "INT(0)" },
|
||||
{ "42", "INT(42)" },
|
||||
{ "1_000_000", "INT(1000000)" },
|
||||
@@ -95,7 +83,6 @@ static const struct row rows[] = {
|
||||
{ "3.14", "FLOAT(3.14)" },
|
||||
{ "1.5e3", "FLOAT(1500)" },
|
||||
|
||||
/* strings & runes */
|
||||
{ "\"hello\"", "STR(hello)" },
|
||||
{ "\"a\\nb\"", "STR(a\nb)" },
|
||||
{ "'A'", "RUNE(65)" },
|
||||
@@ -122,7 +109,6 @@ static const struct row rows[] = {
|
||||
{ "'\\uD7FF'", "RUNE(55295)" },
|
||||
{ "'\\uE000'", "RUNE(57344)" },
|
||||
|
||||
/* operators & punct */
|
||||
{ "+ - * / % == != < > <= >= && || !",
|
||||
"+ - * / % == != < > <= >= && || !" },
|
||||
{ "= += -= *= /= %= &= |= ^= <<= >>=",
|
||||
@@ -136,15 +122,14 @@ static const struct row rows[] = {
|
||||
{ "@symbol(\"malloc\")",
|
||||
"@ IDENT(symbol) ( STR(malloc) )" },
|
||||
|
||||
/* mixed */
|
||||
{ "fn add(a: i32, b: i32) i32 = { return a + b; };",
|
||||
"fn IDENT(add) ( IDENT(a) : IDENT(i32) , IDENT(b) : IDENT(i32) ) IDENT(i32) = { return IDENT(a) + IDENT(b) ; } ;" },
|
||||
};
|
||||
|
||||
/* Escape error cases. A bad escape sets l.errs (the string/rune still
|
||||
* lexes with the offending codepoint zeroed), so detection is via the
|
||||
* error counter, not the token stream. The verbatim Hare messages live
|
||||
* at lexunicode in cmd/wcc/lex.c. */
|
||||
/* A bad escape sets l.errs (the string/rune still lexes with the
|
||||
* offending codepoint zeroed), so detection is via the error counter,
|
||||
* not the token stream. The verbatim Hare messages live at lexunicode
|
||||
* in cmd/wcc/lex.c. */
|
||||
static int
|
||||
runerr(const char *src)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user