Skip to content

Commit

Permalink
Switch to toml-edit for spanned deserialization (#2074)
Browse files Browse the repository at this point in the history
* Switch to toml_edit for spanned toml parsing

* Add a regression test

* Get back to good toml snapshots

* Remove the spanned-deser features

* Review comments

* Fix faulty rebase

* doc lint
  • Loading branch information
jneem authored Oct 25, 2024
1 parent aaa04ab commit 0101a76
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 207 deletions.
29 changes: 1 addition & 28 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ serde_json = "1.0.96"
serde_repr = "0.1"
serde-wasm-bindgen = "0.5.0"
serde_yaml = "0.9.19"
serde-untagged = "0.1"
sha-1 = "0.10.0"
sha2 = "0.10.6"
similar = "2.2.1"
Expand All @@ -95,6 +94,7 @@ termimad = "0.23.1"
test-generator = "0.3.1"
thiserror = "1.0.44"
toml = "0.8"
toml_edit = "0.22"
typed-arena = "2.0.2"
unicode-segmentation = "1.10.1"
void = "1"
Expand Down
1 change: 0 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ default = ["repl", "doc", "format"]
repl = ["nickel-lang-core/repl"]
doc = ["nickel-lang-core/doc", "comrak"]
format = ["nickel-lang-core/format", "dep:tempfile"]
spanned-deser = ["nickel-lang-core/spanned-deser"]
metrics = ["dep:metrics", "dep:metrics-util", "nickel-lang-core/metrics"]

[dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ error: contract broken by the value of `name`
5package.name | String,
------ expected type
┌─ <unknown> (generated by evaluation):1:1
┌─ [IMPORTS_PATH]/package.toml:2:8
1 │ 5
- evaluated to this value
2name = 5
^ applied to this expression
5 changes: 2 additions & 3 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ format = ["dep:topiary-core", "dep:topiary-queries", "dep:tree-sitter-nickel"]
metrics = ["dep:metrics"]
nix-experimental = [ "dep:cxx", "dep:cxx-build", "dep:pkg-config" ]
bytecode-experimental = ["dep:bumpalo"]
spanned-deser = ["dep:serde-untagged"]
benchmark-ci = []

[build-dependencies]
Expand All @@ -50,8 +49,8 @@ smallvec.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
serde_yaml.workspace = true
serde-untagged = { workspace = true, optional = true }
toml = { workspace = true, features = ["parse"] }
toml_edit = { workspace = true, features = ["parse"] }
toml = { workspace = true }
void.workspace = true
sha-1.workspace = true
sha2.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion core/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ impl ParseError {
)
}

pub fn from_toml(error: toml::de::Error, file_id: FileId) -> Self {
pub fn from_toml(error: toml_edit::TomlError, file_id: FileId) -> Self {
use codespan::{ByteIndex, ByteOffset};

let span = error.span();
Expand Down
Loading

0 comments on commit 0101a76

Please sign in to comment.