Skip to content

Commit

Permalink
change(eval): use saphyr-parser to parse YAML and support anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardosm committed Aug 5, 2024
1 parent ee58d96 commit b446e34
Show file tree
Hide file tree
Showing 44 changed files with 543 additions and 180 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

### Breaking

- Change how some plain YAML scalars are parsed in `std.parseYaml`:
- Some semantics of `std.parseYaml` have changed:
- Empty YAML documents are now parsed as `null` instead of an empty string.
- Anchors and aliases are now supported.
- `Null`, `NULL` and `~` are now parsed as `null`.
- `True` and `TRUE` are now parsed as `true` .
- `False` and `FALSE` are now parsed as `false`.
Expand All @@ -21,6 +23,7 @@
- Avoid panic when encountering an array or object as object key in
`std.parseYaml`.
- Avoid panic when encountering a YAML alias in `std.parseYaml`.
- Avoid some panics in `std.parseYaml` with some inputs found with fuzzing.

## 0.1.2 (2024-07-20)

Expand Down
33 changes: 26 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rsjsonnet-lang/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ publish.workspace = true

[dependencies]
hashbrown = "0.14.5"
libyaml-safer = "0.1.1"
md-5 = { version = "0.10.6", default-features = false }
saphyr-parser = "0.0.2"
2 changes: 1 addition & 1 deletion rsjsonnet-lang/src/program/eval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,7 @@ impl<'a> Evaluator<'a> {
State::StdParseYaml => {
let arg = self.value_stack.pop().unwrap();
let s = self.expect_std_func_arg_string(arg, "parseYaml", 0)?;
match parse_yaml::parse_yaml(self.program, &s, true) {
match parse_yaml::parse_yaml(self.program, &s) {
Ok(value) => {
self.value_stack.push(value);
}
Expand Down
Loading

0 comments on commit b446e34

Please sign in to comment.