Commit f51504d
feat(parser): record-update spread at start
Adds the Rust-style record-update form to `expr_record_body`: a leading
`..spread` followed by COMMA and one or more fields, all inside `#{ ... }`.
The existing grammar accepted:
- empty record `#{}`
- spread-only `#{ ..s }`
- fields with optional trailing spread `#{ f: v, ..s }`
But the Rust-style `Record #{ ..base, override: x }` (spread captures the
source-of-defaults, subsequent fields override) was a parse error.
Required by sustainabot hand-port (gitbot-fleet#148):
- `Model #{ ..model, totalProcessed: n }` in Oikos.affine
- `Router #{ ..router, routes: rs }` in Router.affine
LR(1)-safe: after parsing `expr_record_spread`, the lookahead is either
RBRACE (the existing spread-only rule reduces) or COMMA (this new rule
shifts); the choice is unambiguous on one-token lookahead. Parser builds
with 21 shift/reduce + 1 reduce/reduce, identical to the pre-patch
baseline.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>#{ ..base, f: v } (Refs gitbot-fleet#148)1 parent 4b83c1a commit f51504d
1 file changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
928 | 928 | | |
929 | 929 | | |
930 | 930 | | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
931 | 943 | | |
932 | 944 | | |
933 | 945 | | |
| |||
0 commit comments