- `[a, b, c]` list literals (E_LIST → emit_list); static_type learns slice-element, `new T`, list, string and literal kinds - `x op= y` lowers through the same path as `x = x op y` (emit_bin_vals): fixed `*=`/`/=` use the Q16.16 64-bit paths, string `+=` concatenates, int→long widens; unary `-` keeps a fixed operand's type (arith_ty) - one `unescape()` table for "strings", 'chars' and `interpolation`; `'\''`, `'\\'`, `'\"'` no longer read as 0; unterminated char literals and unexpected characters are errors instead of silently skipped - every diagnostic is `file:line: error: msg` (g_parse_file / g_err_file, Node.file + Node.line set by node()); tok_desc() in expectation errors; duplicate `function` names and unknown `phase` names are reported in source terms (phase_id used to default unknown phases to Overlay) - interpolation holes skip braces inside string literals - hand-IR preludes move from the user `@fn_` prefix to `@lp_` so a user `is_ws` / `str_eq` / `path_join` no longer collides at link time - `@ClearColor(expr)` accepts any constant expression; `Os.pid()` added (docs page + inventory); `str_starts()` in support/str - main.ludic: `else if` flag ladder, char literals, stale script comments - examples/lang/operators.ludic covers all of the above; os.ludic covers Os.pid; docs pages for Os.pid and the Overlay phase; ten changesets - reseeded: selfhost/ludicc.seed.ll is the new compiler's own fixpoint Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
34 lines
1.4 KiB
Text
34 lines
1.4 KiB
Text
# emit_key.ludic — `Key.Name` -> the key code the input layer delivers, folded at
|
|
# compile time (like Color.*). Letters are the lowercase character (what the held-key
|
|
# set stores), digits their ASCII, plus the specials. Arrow keys alias WASD because the
|
|
# platform layer maps them that way; Escape is 27 (0.3, #88).
|
|
function key_lookup(name: pointer) -> int {
|
|
if (name == "Space") { return 32 }
|
|
if (name == "Enter") { return 10 }
|
|
if (name == "Return") { return 10 }
|
|
if (name == "Escape") { return 27 }
|
|
if (name == "Esc") { return 27 }
|
|
if (name == "Shift") { return 16 }
|
|
if (name == "Tab") { return 9 }
|
|
if (name == "Backspace") { return 8 }
|
|
if (name == "Up") { return 119 }
|
|
if (name == "Down") { return 115 }
|
|
if (name == "Left") { return 97 }
|
|
if (name == "Right") { return 100 }
|
|
if (name == "Digit0") { return 48 }
|
|
if (name == "Digit1") { return 49 }
|
|
if (name == "Digit2") { return 50 }
|
|
if (name == "Digit3") { return 51 }
|
|
if (name == "Digit4") { return 52 }
|
|
if (name == "Digit5") { return 53 }
|
|
if (name == "Digit6") { return 54 }
|
|
if (name == "Digit7") { return 55 }
|
|
if (name == "Digit8") { return 56 }
|
|
if (name == "Digit9") { return 57 }
|
|
# a single capital letter names that letter key: Key.A .. Key.Z
|
|
if (name[1] == 0) {
|
|
let c = name[0]
|
|
if (c >= 'A') and (c <= 'Z') { return c + 32 }
|
|
}
|
|
return -1
|
|
}
|