lib: char-literals for ascii/fnmatch/shlex magic decimals (Wave-1)
Replace magic ASCII decimals with char literals in ascii/fnmatch/shlex predicates (e.g. `c < 48` → `c < '0'`). Byte-id-neutral: ascii params are rune, so rune<rune emission is unchanged; fnmatch/shlex compare u8 against value-preserving (<=126) rune constants. Range bounds (0/31/127), the ±32 case offset, the 128 high-bit mask, and fnmatch 0u8 sentinels stay decimal. Regenerate the three combined.ww that embed ascii (w6c, wwdump, smoke). Add functional rows pinning predicates reachable only via fnmatch ctype classes / shlex split: [[:space:]]/[[:print:]]/[[:graph:]] + the '\t' arm of [[:blank:]] (fnmatchtest), '\t'/'\n' split separators + issafe's special-char set (shlextest) — so a wrong substitution would be caught.
This commit is contained in:
@@ -149,6 +149,8 @@ fn checkquote(in: str, expected: str) void = {
|
||||
check3("with\\ backslashes 'single quoted' \"double quoted\"",
|
||||
"with backslashes", "single quoted", "double quoted");
|
||||
check2("'multiple spaces' 42", "multiple spaces", "42");
|
||||
// pin the '\t'/'\n' arms of split's whitespace test.
|
||||
check3("a\tb\nc", "a", "b", "c");
|
||||
|
||||
// Invalid
|
||||
checkerr("\"dangling double quote");
|
||||
@@ -172,6 +174,8 @@ fn checkquote(in: str, expected: str) void = {
|
||||
checkquote("'hello' \"world\"", "''\"'\"'hello'\"'\"' \"world\"'");
|
||||
checkquote("hello\\world", "'hello\\world'");
|
||||
checkquote("", "''");
|
||||
// pin issafe's special-char set: all safe → emitted raw, unquoted.
|
||||
checkquote("@%+=:,./-", "@%+=:,./-");
|
||||
};
|
||||
|
||||
// ---- quotestr ------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user