Skip to content

feat: implement pattern matching through is/match expressions and destructuring - #14

Merged
Dutch-Raptor merged 12 commits into
masterfrom
feature/patterns
Jan 29, 2026
Merged

feat: implement pattern matching through is/match expressions and destructuring#14
Dutch-Raptor merged 12 commits into
masterfrom
feature/patterns

Conversation

@Dutch-Raptor

Copy link
Copy Markdown
Owner

No description provided.

- Add parsing, representation, and evaluation support for `match` expressions.
- Implement the `enumerate` iterator combinator for enhanced iteration capabilities.
- Replace identifiers for keywords with `KW` suffix for consistency in `SyntaxKind`.
- Update `STMT`, `PATTERN`, and related sets to reflect changes in syntax representation.
- Refactor destructuring logic to handle `match` patterns, with support for guards.
- Extend test coverage and add examples showcasing `match` expression functionality.
…teral parsing

- Replace `block_or_lambda` with `expr_with_braces` to simplify brace-handling logic.
- Update brace-handling to support blocks, lambdas, map literals, and destructuring assignments.
- Refactor `map` parsing to handle empty map literals explicitly and improve shorthand syntax.
- Deprecate `Hash` prefix for map literals (`#{}` → `{}`) for consistency with other syntax.
- Introduce `E0311` diagnostic for mismatched bindings within `match` arm patterns.
- Extend parser and test coverage for new brace-handling capabilities and error scenarios.
…ling

- Introduce `is` expressions with support for type-based pattern matching and typed bindings.
- Add support for flow scopes to handle temporary variables within expressions.
- Refactor conditional expression parsing to allow omitting parentheses in conditions.
- Deprecate parentheses in conditions with a warning for compatibility.
- Extend parser, evaluator, and syntax definitions to support new features and improve error diagnostics.
- Update test cases and examples to demonstrate `is` expressions and scope improvements.
…in conditions

- Refactor delimiter error reporting for better accuracy and cleaner code.
- Deprecate parentheses in conditions (`if`, `while`, `for`) with warnings for compatibility.
- Update test cases, examples, and error diagnostics to reflect new behaviour.
- Implement map destructuring in bindings, including support for spread (`..`) and binding of remaining keys.
- Add error handling for unmatched or missing keys in map destructuring with `E0302` diagnostics.
- Enhance pattern matching to support named and unnamed map destructuring patterns.
…iagnostics

- Add `E0303` diagnostic for missing keys in map patterns and integrate it into destructuring logic.
- Refactor destructuring to provide detailed error messages with hints for unmatched keys and pattern paths.
- Improve diagnostics for destructuring nested patterns and guards.
Comment thread compose-eval/src/expression/closure.rs Outdated
refactor: implement compose_doc! tests with doctests instead of compile time tests.

require parens around conditions and for expressions
@Dutch-Raptor
Dutch-Raptor merged commit 47b0440 into master Jan 29, 2026
1 check passed
@Dutch-Raptor
Dutch-Raptor deleted the feature/patterns branch January 30, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant