Summary
Implement closure parsing. |x| x + 1 currently fails ("expected expression"); move closures are unsupported.
Part of the v0.6.x parser-completeness work (see crates/AGENTS.md "Implemented subset"). Surfaced during PR #57 verification.
Spec
- §7 closures / §16
closure_expr. Capture modes (Fn/FnMut/FnOnce) are inferred, not syntax; move is already a reserved keyword.
Scope
Notes
The | / || disambiguation in prefix is the main subtlety. A bare || in prefix position is a zero-arg closure, not logical-or.
Summary
Implement closure parsing.
|x| x + 1currently fails ("expected expression");moveclosures are unsupported.Part of the v0.6.x parser-completeness work (see
crates/AGENTS.md"Implemented subset"). Surfaced during PR #57 verification.Spec
closure_expr. Capture modes (Fn/FnMut/FnOnce) are inferred, not syntax;moveis already a reserved keyword.Scope
|params| exprand|params| { block }, with typed params|x: T|and optional-> Treturn type.move |…| ….|from bitwise-or|/ logical-or||(the lexer emitsPipe/PipePipe): a|in expression-prefix position starts a closure; elsewhere it is an operator. Handle the empty parameter list|| expr.Notes
The
|/||disambiguation inprefixis the main subtlety. A bare||in prefix position is a zero-arg closure, not logical-or.