refactor: rename DTree to DValue

This commit is contained in:
udo
2026-06-12 11:05:52 +00:00
parent 941f5aea08
commit 7066da3cde
157 changed files with 1203 additions and 1074 deletions
+7 -7
View File
@@ -1,5 +1,5 @@
:sig
String yaml_encode(DTree t)
String yaml_encode(DValue t)
:params
t : tree to serialize as YAML
@@ -10,10 +10,10 @@ return value : YAML string
yaml_decode
json_encode
xml_encode
0_DTree
0_DValue
:content
Serializes a `DTree` into a compact YAML string for configuration files.
Serializes a `DValue` into a compact YAML string for configuration files.
`yaml_encode()` focuses on the ordinary data shapes UCE apps use for config: nested maps, lists, strings, booleans, and numeric `f64` values. It does not emit YAML tags, anchors, aliases, or custom schema features.
@@ -22,12 +22,12 @@ Try the live example in the [YAML demo](../demo/yaml.uce).
Example:
```uce
DTree cfg;
DValue cfg;
cfg["app"]["name"] = "UCE Starter";
cfg["app"]["debug"].set_bool(true);
cfg["app"]["port"] = (f64)8080;
DTree path;
DValue path;
path = "site";
cfg["app"]["paths"].push(path);
path = "cache";
@@ -50,8 +50,8 @@ app:
Notes:
- Map keys are emitted in `DTree` map iteration order.
- Map keys are emitted in `DValue` map iteration order.
- Strings are left plain when safe and quoted when needed.
- Multiline strings are emitted as literal block scalars with `|`.
- Empty strings are emitted as `""` so they are not confused with YAML null.
- Decoded numeric-looking config values are strings unless the original `DTree` value was explicitly numeric.
- Decoded numeric-looking config values are strings unless the original `DValue` value was explicitly numeric.