Add optional regex constraints
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# Features
|
||||
|
||||
Decodal keeps the embedded core small by making heavy functionality opt-in.
|
||||
|
||||
## Core defaults
|
||||
|
||||
`decodal-core` defaults to `std` only.
|
||||
|
||||
```toml
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = []
|
||||
regex = ["std", "dep:regex"]
|
||||
```
|
||||
|
||||
Building `decodal-core` with `--no-default-features` keeps the core in `no_std + alloc` mode and avoids optional dependencies.
|
||||
|
||||
## Regex
|
||||
|
||||
Regex constraints are implemented behind the `regex` feature.
|
||||
When the feature is disabled, regex constraints parse and compose, but validating a concrete value against them returns an unsupported feature diagnostic.
|
||||
|
||||
```sh
|
||||
cargo run -q -p decodal --features regex -- examples/regex/main.dcdl
|
||||
```
|
||||
|
||||
Regex constraints are accumulated during `&` composition.
|
||||
The implementation does not try to prove whether the intersection of two regex constraints is empty.
|
||||
Concrete strings must match every regex constraint attached to the abstract value.
|
||||
|
||||
## CLI features
|
||||
|
||||
`decodal-cli` exposes a matching `regex` feature that enables `decodal-core/regex`.
|
||||
The feature is not enabled by default so the default CLI binary remains small.
|
||||
@@ -16,3 +16,4 @@ bytecode VM や JIT ではなく、AST を demand-driven に評価すること
|
||||
4. [Composition and Materialization](./composition-and-materialization.md)
|
||||
5. [Diagnostics and Fallback](./diagnostics-and-fallback.md)
|
||||
6. [Embedding API](./embedding-api.md)
|
||||
7. [Features](./features.md)
|
||||
|
||||
@@ -42,4 +42,5 @@ Decodal は Deferred Constraint Data Language、略称 DCDL のプロジェク
|
||||
4. [Composition and Materialization](./design/composition-and-materialization.md)
|
||||
5. [Diagnostics and Fallback](./design/diagnostics-and-fallback.md)
|
||||
6. [Embedding API](./design/embedding-api.md)
|
||||
7. [Features](./design/features.md)
|
||||
4. [Open Issues](./open-issues.md)
|
||||
|
||||
Reference in New Issue
Block a user