Remove some underscores from wasm schema to match elisp.
This commit is contained in:
parent
adcd0de7e4
commit
5d31db39a4
@ -63,6 +63,7 @@ use super::WasmStandardProperties;
|
|||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct WasmAstNodeWrapper<I> {
|
pub struct WasmAstNodeWrapper<I> {
|
||||||
|
#[serde(rename = "ast-node")]
|
||||||
pub(crate) ast_node: String,
|
pub(crate) ast_node: String,
|
||||||
#[serde(rename = "standard-properties")]
|
#[serde(rename = "standard-properties")]
|
||||||
pub(crate) standard_properties: WasmStandardProperties,
|
pub(crate) standard_properties: WasmStandardProperties,
|
||||||
|
@ -10,8 +10,11 @@ use crate::types::StandardProperties;
|
|||||||
pub(crate) struct WasmStandardProperties {
|
pub(crate) struct WasmStandardProperties {
|
||||||
pub(crate) begin: usize,
|
pub(crate) begin: usize,
|
||||||
pub(crate) end: usize,
|
pub(crate) end: usize,
|
||||||
|
#[serde(rename = "contents-begin")]
|
||||||
pub(crate) contents_begin: Option<usize>,
|
pub(crate) contents_begin: Option<usize>,
|
||||||
|
#[serde(rename = "contents-end")]
|
||||||
pub(crate) contents_end: Option<usize>,
|
pub(crate) contents_end: Option<usize>,
|
||||||
|
#[serde(rename = "post-blank")]
|
||||||
pub(crate) post_blank: PostBlank,
|
pub(crate) post_blank: PostBlank,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ fn compare_json_value<'b, 's>(
|
|||||||
emacs: &'b Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||||
match (value, emacs) {
|
match (value, emacs) {
|
||||||
(serde_json::Value::Object(wasm), Token::List(el)) if wasm.contains_key("ast_node") => {
|
(serde_json::Value::Object(wasm), Token::List(el)) if wasm.contains_key("ast-node") => {
|
||||||
// We hit a regular ast node.
|
// We hit a regular ast node.
|
||||||
compare_ast_node(source, el, wasm)
|
compare_ast_node(source, el, wasm)
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ fn compare_ast_node<'b, 's, 'p>(
|
|||||||
.ok_or("Should have a name as the first child.")?
|
.ok_or("Should have a name as the first child.")?
|
||||||
.as_atom()?;
|
.as_atom()?;
|
||||||
let wasm_name = wasm
|
let wasm_name = wasm
|
||||||
.get("ast_node")
|
.get("ast-node")
|
||||||
.ok_or("Should have a ast node type.")?
|
.ok_or("Should have a ast node type.")?
|
||||||
.as_str()
|
.as_str()
|
||||||
.ok_or("Ast node type should be a string.")?;
|
.ok_or("Ast node type should be a string.")?;
|
||||||
@ -248,9 +248,9 @@ fn compare_ast_node<'b, 's, 'p>(
|
|||||||
for (emacs_value, wasm_name) in [
|
for (emacs_value, wasm_name) in [
|
||||||
(emacs_standard_properties.begin, "begin"),
|
(emacs_standard_properties.begin, "begin"),
|
||||||
(emacs_standard_properties.end, "end"),
|
(emacs_standard_properties.end, "end"),
|
||||||
(emacs_standard_properties.contents_begin, "contents_begin"),
|
(emacs_standard_properties.contents_begin, "contents-begin"),
|
||||||
(emacs_standard_properties.contents_end, "contents_end"),
|
(emacs_standard_properties.contents_end, "contents-end"),
|
||||||
(emacs_standard_properties.post_blank, "post_blank"),
|
(emacs_standard_properties.post_blank, "post-blank"),
|
||||||
] {
|
] {
|
||||||
match (emacs_value, wasm_standard_properties.get(wasm_name)) {
|
match (emacs_value, wasm_standard_properties.get(wasm_name)) {
|
||||||
(None, None) => {}
|
(None, None) => {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user