Phase 3a: spawn/record initializers use ':' (Rule A)
Comp = { f = v } -> Comp { f: v }. record() requires ':' and parse_spawn()
drops the '=' before the record; '=' is now assignment/binding only. Records
appear only in games, so the compiler seed is unaffected.
Migration: tools/ludic-tools/migrate_records.c (spawn-context aware). Verified
every golden byte-identical, old '=' form rejected, reseeded, test.sh 14/14.
Docs updated (LANGUAGE.md, BOOTSTRAP.md R2).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
eac8f8f335
commit
39bd430ce8
12 changed files with 2499 additions and 2425 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -116,12 +116,13 @@ fn p_or() -> Node {
|
|||
return l
|
||||
}
|
||||
|
||||
# a record literal `{ field = value, ... }` — used by spawn component inits
|
||||
# a record literal `{ field: value, ... }` — used by spawn component inits.
|
||||
# Rule A: a named part uses `:` (`=` is assignment/binding only).
|
||||
fn record() -> Node {
|
||||
eat_op("{")
|
||||
let r = node(E_REC)
|
||||
while true { skipnl(); if is_op("}") { break }
|
||||
let fi = node(E_FINIT); fi.s = eat_id(); eat_op("="); fi.a = expr(); push(r.kids, fi)
|
||||
let fi = node(E_FINIT); fi.s = eat_id(); eat_op(":"); fi.a = expr(); push(r.kids, fi)
|
||||
if is_op(",") { pi = pi + 1 } }
|
||||
eat_op("}"); return r
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ fn parse_spawn() -> Node {
|
|||
pi = pi + 1; let n = node(S_SPAWN); n.s = eat_id(); skipnl(); eat_op("{")
|
||||
while true {
|
||||
skipnl(); if is_op("}") { break }
|
||||
let ci = node(E_FINIT); ci.s = eat_id(); eat_op("=")
|
||||
ci.a = record() # { field = val, ... }
|
||||
let ci = node(E_FINIT); ci.s = eat_id()
|
||||
ci.a = record() # Comp { field: val, ... } — no `=` before the record
|
||||
push(n.kids, ci)
|
||||
if is_op(",") { pi = pi + 1 }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue