Commit Graph

2 Commits

Author SHA1 Message Date
Serendipity caf17e16fc feat: for step 步长 — for i in 0 to 10 step 2 { ... }
Token(75): +TOK_STEP, desugar_for 增加 step_expr 参数, 默认 step=1

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-07 14:13:09 +08:00
Serendipity eaae0b1c62 refactor: 独立 desugar pass — match/guard/for/if-let/复合赋值去糖提取
5 种去糖逻辑从 parser.c/expr.c 内联代码提取到 desugar.c:
  desugar_match() — match → let + if-else 链
  desugar_guard() — guard → if !(cond)
  desugar_for()  — for-in-to → var + while
  desugar_if_let() — if let → let + if
  desugar_compound_assign() — +=/-= → assign + binary

parser.c 662→564 行, 新增 desugar.c 109 行, 管道+插值保留在 expr.c

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-06 20:20:33 +08:00