1
Fork 0
mirror of https://github.com/RGBCube/cstree synced 2025-07-29 18:17:44 +00:00

Add derive macro for Syntax (used to be Language) (#51)

This commit is contained in:
DQ 2023-04-18 20:10:35 +02:00 committed by GitHub
parent 2aa543036f
commit c5279bae7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
70 changed files with 1459 additions and 899 deletions

View file

@ -3,10 +3,13 @@
## `v0.12.0`
* Documentation has been improved in most areas, together with a switch to a more principled module structure that allows explicitly documenting submodules.
* The `Language` trait has been deprecated in favour of a new `Syntax` trait. `Syntax` provides the same methods that `Language` did before, but is implemented directly on the syntax kind enum instead of an additional type representing the language.
* The supertrait requirements on `PartialOrd`, `Ord`, and `Hash` have been dropped.
* TODO: this allows to optionally provide derive. To enable, add feature flag
* The `interning` module has been rewritten. It now provides fuctions for obtaining a default interner (`new_interner` and `new_threaded_interner`) and provides a small, dependency-free interner implementation.
* Compatibility with other interners can be enable via feature flags.
* **Note** that compatibilty with `lasso` is not enabled by default. Use the `lasso_compat` feature to match the previous default.
* Introduced `Language::static_text` to optimize tokens that always appear with the same text (estimated 10-15% faster tree building when used, depending on the ratio of static to dynamic tokens).
* Introduced `Syntax::static_text` to optimize tokens that always appear with the same text (estimated 10-15% faster tree building when used, depending on the ratio of static to dynamic tokens).
* Since `cstree`s are lossless, `GreenNodeBuilder::token` must still be passed the source text even for static tokens.
* Internal performance improvements for up to 10% faster tree building by avoiding unnecessary duplication of elements.
* Use `NonNull` for the internal representation of `SyntaxNode`, meaning it now benefits from niche optimizations (`Option<SyntaxNode>` is now the same size as `SyntaxNode` itself: the size of a pointer).
@ -14,7 +17,7 @@
* `RawSyntaxKind` has been changed to use a 32-bit index internally, which means existing `Language` implementations and syntax kind `enum`s need to be adjusted to `#[repr(u32)]` and the corresponding conversions.
* The crate's export module structure has been reorganized to give different groups of definitions their own submodules. A `cstree::prelude` module is available, containing the most commonly needed types that were previously accessible via `use cstree::*`. Otherwise, the module structure is now as follows:
* `cstree`
* `Language`
* `Syntax`
* `RawSyntaxKind`
* `build`
* `GreenNodeBuilder`