This breaks out the pattern matching/unification algorithm from cl-interpret/interpret.rs to cl-interpret/pattern.rs
TODO: pattern destructuring in const, static :^)
- Patterns are no longer parsed with the highest precedence
- Function calls with just a path and a tuple of args can now be transformed into a Pattern
- Deny arbitrary paths in patterns (only one non-keyword identifier allowed!)
- Allow patterns in for-loop binders (literally useless atm, but it's a step toward making patterns the only way to bind names.)
Next: Functions, Tuple Struct Patterns... And solving the stupid syntactic ambiguity of structors.
- Integrate the Match and Pattern nodes into the AST
- TODO: `let x: T` is ambiguous with `let x: {}`. Currently the latter takes precedence in the parser.
- Implement pattern matching through unification in the interpreter.
- It's not fast, but it works!
- Refactor destructuring assignments to use the new pattern functionality
- Smuggle floats as integers to maintain `eq`
- This is bad, but not terrible for spec-compliant floats. Might have issues with NaN.
cl_parser: Smuggle floats
cl_interpret: unpack smuggled floats in float literal node
grammar:
- Improve specification of `Path`
- Add `Use` and `UseTree` rules
- Add `Use` as a variant of ItemKind
cl-token:
- Add new keywords `use` and `as`
cl-ast:
- Add nodes for Use and UseTree
- Add new ItemKind for Use
- Implement traversal in Visit and Fold
cl-interpret:
- Mark ItemKind::Use with a todo
cl-parser:
- Update to match grammar
cl-typeck:
- Update to match changes in AST
- Mark UseTrees as NameCollectable and TypeResolvable, but leave as todos