You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apply confirmed language features to the self-hosted tools for readability
while preserving parity (556/556 on all three corpora, 0 mismatches) and the
SH-022 elision perf win (44.0x native, unchanged).
- SH-016 char literals replace code-point magic numbers in scan.rss
(is_ident_start/cont, escape, scan_line_comment/char/string/multiline/interp,
scan_number dot check, tokenize dispatch, line/col advance).
- SH-017 operator continuation wraps the 30-way is_kw and 25-way
is_known_symbol `||` chains across lines.
- is_known_symbol now takes `c: read Char` (char-literal chain) instead of an
Int code point.
Char extractions in the hot `read List<Char>` scanners flow only into compares
/ List.get, so the DeepCopy elision still fires. OOB-capable lookaheads keep
`code_at` (Int) as before.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
// SH-022: string building uses StringBuilder (O(n)); the hot per-char scanners
22
+
// keep `chars: read List<Char>` DIRECT so the DeepCopy-elision holds (extracted
23
+
// Chars flow only into `Char.*` intrinsics / compares / `List.get`).
21
24
22
25
features: local
23
26
@@ -36,21 +39,32 @@ struct Tok {
36
39
// (await, native) and builtin constants (true false Ok Err Some None Unit)
37
40
// are NOT here — they lex as Ident.
38
41
fn is_kw(word: read String) -> Bool {
39
-
return word == "if" || word == "else" || word == "for" || word == "in" || word == "match" || word == "loop" || word == "while" || word == "break" || word == "continue" || word == "return" || word == "features" || word == "class" || word == "struct" || word == "resource" || word == "handle" || word == "fn" || word == "let" || word == "pub" || word == "async" || word == "effects" || word == "drop" || word == "with" || word == "as" || word == "read" || word == "mut" || word == "take" || word == "fresh" || word == "manage" || word == "weak" || word == "local"
42
+
return word == "if" || word == "else" || word == "for" || word == "in"
43
+
|| word == "match" || word == "loop" || word == "while" || word == "break"
44
+
|| word == "continue" || word == "return" || word == "features" || word == "class"
45
+
|| word == "struct" || word == "resource" || word == "handle" || word == "fn"
46
+
|| word == "let" || word == "pub" || word == "async" || word == "effects"
47
+
|| word == "drop" || word == "with" || word == "as" || word == "read"
48
+
|| word == "mut" || word == "take" || word == "fresh" || word == "manage"
49
+
|| word == "weak" || word == "local"
40
50
}
41
51
42
52
// Single-char symbols the oracle recognizes (crate::lexer push_one). Any other
0 commit comments