From 77e0dbb42e815bd02ac2b36372c554bb00f69911 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 11:37:30 -0500 Subject: [PATCH 01/15] Start working on a version of compare based on json values. This will be a better test because it will be testing that what we export to json is equivalent to the elisp AST generated from emacs. Because of these tests, we could also confidently use the wasm structure to elisp. --- src/lib.rs | 1 + src/wasm/document.rs | 5 +- src/wasm_test/compare.rs | 169 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 174 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 3a791a2..4924228 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,7 @@ #![feature(path_file_prefix)] #![feature(is_sorted)] #![feature(test)] +#![feature(iter_intersperse)] // TODO: #![warn(missing_docs)] #![allow(clippy::bool_assert_comparison)] // Sometimes you want the long form because its easier to see at a glance. diff --git a/src/wasm/document.rs b/src/wasm/document.rs index df49157..9e812c7 100644 --- a/src/wasm/document.rs +++ b/src/wasm/document.rs @@ -14,13 +14,16 @@ use crate::types::Document; use crate::wasm::to_wasm::ToWasmStandardProperties; #[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] +#[serde(tag = "__ast_node")] #[serde(rename = "org-data")] pub struct WasmDocument<'s, 'p> { + #[serde(rename = "standard-properties")] pub(crate) standard_properties: WasmStandardProperties, #[serde(flatten)] pub(crate) additional_properties: AdditionalProperties<'s, 'p>, + #[serde(rename = "__children")] pub(crate) children: Vec>, + #[serde(rename = "CATEGORY")] pub(crate) category: Option<&'p str>, pub(crate) path: Option, } diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index dc5d67b..a5033fd 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -1,3 +1,5 @@ +use std::borrow::Cow; + use super::diff::WasmDiffResult; use super::diff::WasmDiffStatus; use super::elisp_compare::WasmElispCompare; @@ -73,6 +75,173 @@ pub fn wasm_compare_document<'b, 's, 'p>( source: &'s str, emacs: &'b Token<'s>, wasm: WasmDocument<'s, 'p>, +) -> Result, Box> { + let wasm_json = serde_json::to_string(&wasm)?; + let wasm_json_parsed = serde_json::from_str(&wasm_json)?; + compare_json_value(&wasm_json_parsed, source, emacs) +} + +fn compare_json_value<'b, 's>( + value: &serde_json::Value, + source: &'s str, + emacs: &'b Token<'s>, +) -> Result, Box> { + match (value, emacs) { + (serde_json::Value::Object(wasm), Token::List(el)) if wasm.contains_key("__ast_node") => { + // We hit a regular ast node. + compare_ast_node(source, el, wasm) + } + (serde_json::Value::Null, Token::Atom(_)) => todo!(), + (serde_json::Value::Null, Token::List(_)) => todo!(), + (serde_json::Value::Null, Token::TextWithProperties(_)) => todo!(), + (serde_json::Value::Null, Token::Vector(_)) => todo!(), + (serde_json::Value::Bool(_), Token::Atom(_)) => todo!(), + (serde_json::Value::Bool(_), Token::List(_)) => todo!(), + (serde_json::Value::Bool(_), Token::TextWithProperties(_)) => todo!(), + (serde_json::Value::Bool(_), Token::Vector(_)) => todo!(), + (serde_json::Value::Number(_), Token::Atom(_)) => todo!(), + (serde_json::Value::Number(_), Token::List(_)) => todo!(), + (serde_json::Value::Number(_), Token::TextWithProperties(_)) => todo!(), + (serde_json::Value::Number(_), Token::Vector(_)) => todo!(), + (serde_json::Value::String(_), Token::Atom(_)) => todo!(), + (serde_json::Value::String(_), Token::List(_)) => todo!(), + (serde_json::Value::String(_), Token::TextWithProperties(_)) => todo!(), + (serde_json::Value::String(_), Token::Vector(_)) => todo!(), + (serde_json::Value::Array(_), Token::Atom(_)) => todo!(), + (serde_json::Value::Array(_), Token::List(_)) => todo!(), + (serde_json::Value::Array(_), Token::TextWithProperties(_)) => todo!(), + (serde_json::Value::Array(_), Token::Vector(_)) => todo!(), + (serde_json::Value::Object(_), Token::Atom(_)) => todo!(), + (serde_json::Value::Object(_), Token::List(_)) => todo!(), + (serde_json::Value::Object(_), Token::TextWithProperties(_)) => todo!(), + (serde_json::Value::Object(_), Token::Vector(_)) => todo!(), + } +} + +fn compare_ast_node<'b, 's, 'p>( + source: &'s str, + emacs: &'b Vec>, + wasm: &serde_json::Map, +) -> Result, Box> { + let mut result = WasmDiffResult::default(); + let mut emacs_list_iter = emacs.iter(); + + { + // Compare ast node type. + let emacs_name = emacs_list_iter + .next() + .ok_or("Should have a name as the first child.")? + .as_atom()?; + let wasm_name = wasm + .get("__ast_node") + .ok_or("Should have a ast node type.")? + .as_str() + .ok_or("Ast node type should be a string.")?; + result.name = emacs_name.into(); + if emacs_name != wasm_name { + result.status.push(WasmDiffStatus::Bad( + format!( + "AST node name mismatch. Emacs=({emacs}) Wasm=({wasm}).", + emacs = emacs_name, + wasm = wasm_name, + ) + .into(), + )); + } + } + + if result.is_bad() { + return Ok(result); + } + + let emacs_attributes_map = emacs_list_iter + .next() + .ok_or("Should have an attributes child.")? + .as_map()?; + + { + // Compare attribute names. + let emacs_keys: std::collections::BTreeSet = emacs_attributes_map + .keys() + .map(|s| (*s).to_owned()) + .collect(); + let wasm_keys: std::collections::BTreeSet = wasm + .keys() + .filter(|k| !k.starts_with("__")) + .map(wasm_key_to_emacs_key) + .collect(); + let emacs_only_attributes: Vec<&String> = emacs_keys.difference(&wasm_keys).collect(); + let wasm_only_attributes: Vec<&String> = wasm_keys.difference(&emacs_keys).collect(); + if !emacs_only_attributes.is_empty() { + result.status.push(WasmDiffStatus::Bad( + format!( + "Wasm node lacked field present in elisp node ({name}).", + name = emacs_only_attributes + .iter() + .map(|s| s.as_str()) + .intersperse(", ") + .collect::(), + ) + .into(), + )); + } + if !wasm_only_attributes.is_empty() { + result.status.push(WasmDiffStatus::Bad( + format!( + "Elisp node lacked field present in wasm node ({name}).", + name = wasm_only_attributes + .iter() + .map(|s| s.as_str()) + .intersperse(", ") + .collect::(), + ) + .into(), + )); + } + } + + if result.is_bad() { + return Ok(result); + } + + { + // Compare attributes. + for attribute_name in wasm + .keys() + .filter(|k| !k.starts_with("__") && k.as_str() != "standard-properties") + { + let mut layer = WasmDiffResult::default(); + layer.name = Cow::Owned(attribute_name.clone()); + let wasm_attribute_value = wasm + .get(attribute_name) + .ok_or("Key should exist in both wasm and elisp at this point.")?; + let emacs_key = wasm_key_to_emacs_key(attribute_name); + let emacs_attribute_value = *emacs_attributes_map + .get(emacs_key.as_str()) + .ok_or("Key should exist in both wasm and elisp at this point.")?; + layer.extend(compare_json_value( + wasm_attribute_value, + source, + emacs_attribute_value, + )?)?; + result.children.push(layer); + } + } + + // TODO: compare standard-properties. + // TODO: compare children + + Ok(result) +} + +fn wasm_key_to_emacs_key(wasm_key: WK) -> String { + format!(":{key}", key = wasm_key) +} + +pub fn old_wasm_compare_document<'b, 's, 'p>( + source: &'s str, + emacs: &'b Token<'s>, + wasm: WasmDocument<'s, 'p>, ) -> Result, Box> { wasm.compare_ast_node(source, emacs) } From 9f4f8e79ce33b7edb7ba65c459365778eb28b350 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 11:56:28 -0500 Subject: [PATCH 02/15] Implement a wrapper type for AST nodes. This is to make it impossible to have a collision for attribute names that are real attributes vs attributes I've added for structure (like children and ast_node). --- src/wasm/ast_node.rs | 30 ++++++++++++++++++++++++++++++ src/wasm/document.rs | 16 +++++++++++++++- src/wasm_test/compare.rs | 4 ++-- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/src/wasm/ast_node.rs b/src/wasm/ast_node.rs index 8545b42..5dd7196 100644 --- a/src/wasm/ast_node.rs +++ b/src/wasm/ast_node.rs @@ -1,3 +1,5 @@ +use std::borrow::Cow; + use serde::Serialize; use super::angle_link::WasmAngleLink; @@ -58,6 +60,34 @@ use super::timestamp::WasmTimestamp; use super::underline::WasmUnderline; use super::verbatim::WasmVerbatim; use super::verse_block::WasmVerseBlock; +use super::WasmStandardProperties; + +#[derive(Debug, Serialize)] +pub(crate) struct WasmAstWrapper<'b, 's, 'p, I> { + #[serde(rename = "ast-node")] + pub(crate) ast_node: Cow<'s, str>, + #[serde(rename = "standard-properties")] + pub(crate) standard_properties: &'b WasmStandardProperties, + #[serde(rename = "properties")] + pub(crate) inner: I, + pub(crate) children: &'b Vec>, +} + +impl<'b, 's, 'p, I> WasmAstWrapper<'b, 's, 'p, I> { + pub(crate) fn new( + ast_node: Cow<'s, str>, + standard_properties: &'b WasmStandardProperties, + inner: I, + children: &'b Vec>, + ) -> WasmAstWrapper<'b, 's, 'p, I> { + WasmAstWrapper { + ast_node, + standard_properties, + inner, + children, + } + } +} #[derive(Debug, Serialize)] #[serde(untagged)] diff --git a/src/wasm/document.rs b/src/wasm/document.rs index 9e812c7..e7a006f 100644 --- a/src/wasm/document.rs +++ b/src/wasm/document.rs @@ -5,6 +5,7 @@ use serde::Serialize; use super::additional_property::AdditionalProperties; use super::additional_property::AdditionalPropertyValue; use super::ast_node::WasmAstNode; +use super::ast_node::WasmAstWrapper; use super::macros::to_wasm; use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; @@ -14,7 +15,7 @@ use crate::types::Document; use crate::wasm::to_wasm::ToWasmStandardProperties; #[derive(Debug, Serialize)] -#[serde(tag = "__ast_node")] +#[serde(tag = "ast_node")] #[serde(rename = "org-data")] pub struct WasmDocument<'s, 'p> { #[serde(rename = "standard-properties")] @@ -85,3 +86,16 @@ impl<'s, 'p> ElispFact<'s> for WasmDocument<'s, 'p> { "org-data".into() } } + +impl<'b, 's, 'p> Into>> + for &'b WasmDocument<'s, 'p> +{ + fn into(self) -> WasmAstWrapper<'b, 's, 'p, &'b WasmDocument<'s, 'p>> { + WasmAstWrapper::new( + self.get_elisp_name(), + &self.standard_properties, + self, + &self.children, + ) + } +} diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index a5033fd..a7f62b8 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -87,7 +87,7 @@ fn compare_json_value<'b, 's>( emacs: &'b Token<'s>, ) -> Result, Box> { 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. compare_ast_node(source, el, wasm) } @@ -133,7 +133,7 @@ fn compare_ast_node<'b, 's, 'p>( .ok_or("Should have a name as the first child.")? .as_atom()?; let wasm_name = wasm - .get("__ast_node") + .get("ast_node") .ok_or("Should have a ast node type.")? .as_str() .ok_or("Ast node type should be a string.")?; From a0a4f0eb901e076168015be4be255c264a865106 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 12:49:43 -0500 Subject: [PATCH 03/15] Remove lifetimes from wasm ast nodes. --- src/wasm/additional_property.rs | 36 +- src/wasm/angle_link.rs | 10 +- src/wasm/ast_node.rs | 173 +- src/wasm/babel_call.rs | 10 +- src/wasm/bold.rs | 10 +- src/wasm/center_block.rs | 10 +- src/wasm/citation.rs | 10 +- src/wasm/citation_reference.rs | 10 +- src/wasm/clock.rs | 10 +- src/wasm/code.rs | 10 +- src/wasm/comment.rs | 10 +- src/wasm/comment_block.rs | 10 +- src/wasm/diary_sexp.rs | 10 +- src/wasm/document.rs | 40 +- src/wasm/drawer.rs | 10 +- src/wasm/dynamic_block.rs | 10 +- src/wasm/entity.rs | 10 +- src/wasm/example_block.rs | 10 +- src/wasm/export_block.rs | 10 +- src/wasm/export_snippet.rs | 10 +- src/wasm/fixed_width_area.rs | 10 +- src/wasm/footnote_definition.rs | 10 +- src/wasm/footnote_reference.rs | 10 +- src/wasm/headline.rs | 10 +- src/wasm/horizontal_rule.rs | 10 +- src/wasm/inline_babel_call.rs | 10 +- src/wasm/inline_source_block.rs | 10 +- src/wasm/italic.rs | 10 +- src/wasm/keyword.rs | 10 +- src/wasm/latex_environment.rs | 10 +- src/wasm/latex_fragment.rs | 10 +- src/wasm/line_break.rs | 10 +- src/wasm/macros.rs | 8 +- src/wasm/node_property.rs | 6 +- src/wasm/org_macro.rs | 10 +- src/wasm/paragraph.rs | 16 +- src/wasm/parse_result.rs | 4 +- src/wasm/plain_link.rs | 10 +- src/wasm/plain_list.rs | 10 +- src/wasm/plain_list_item.rs | 6 +- src/wasm/plain_text.rs | 10 +- src/wasm/planning.rs | 10 +- src/wasm/property_drawer.rs | 10 +- src/wasm/quote_block.rs | 10 +- src/wasm/radio_link.rs | 10 +- src/wasm/radio_target.rs | 10 +- src/wasm/regular_link.rs | 10 +- src/wasm/section.rs | 16 +- src/wasm/special_block.rs | 10 +- src/wasm/src_block.rs | 10 +- src/wasm/statistics_cookie.rs | 10 +- src/wasm/strike_through.rs | 10 +- src/wasm/subscript.rs | 10 +- src/wasm/superscript.rs | 10 +- src/wasm/table.rs | 10 +- src/wasm/table_cell.rs | 6 +- src/wasm/table_row.rs | 6 +- src/wasm/target.rs | 10 +- src/wasm/timestamp.rs | 10 +- src/wasm/to_wasm.rs | 8 +- src/wasm/underline.rs | 10 +- src/wasm/verbatim.rs | 10 +- src/wasm/verse_block.rs | 10 +- src/wasm_test/compare.rs | 3331 +++++++++++++++---------------- src/wasm_test/elisp_compare.rs | 10 - src/wasm_test/logic.rs | 729 ++++--- src/wasm_test/mod.rs | 1 - src/wasm_test/runner.rs | 4 +- 68 files changed, 2438 insertions(+), 2472 deletions(-) delete mode 100644 src/wasm_test/elisp_compare.rs diff --git a/src/wasm/additional_property.rs b/src/wasm/additional_property.rs index 9680c6a..d5b1305 100644 --- a/src/wasm/additional_property.rs +++ b/src/wasm/additional_property.rs @@ -1,3 +1,4 @@ +use std::borrow::Cow; use std::collections::HashMap; use serde::Serialize; @@ -10,30 +11,27 @@ use crate::types::AffiliatedKeywords; #[derive(Debug, Serialize)] #[serde(untagged)] -pub enum AdditionalPropertyValue<'s, 'p> { - SingleString(&'s str), - ListOfStrings(Vec<&'s str>), - OptionalPair { - optval: Option<&'s str>, - val: &'s str, - }, - ObjectTree(Vec<(Option>>, Vec>)>), +pub enum AdditionalPropertyValue { + SingleString(String), + ListOfStrings(Vec), + OptionalPair { optval: Option, val: String }, + ObjectTree(Vec<(Option>, Vec)>), } #[derive(Debug, Serialize, Default)] -pub struct AdditionalProperties<'s, 'p> { +pub struct AdditionalProperties { #[serde(flatten)] - pub(crate) properties: HashMap>, + pub(crate) properties: HashMap, } -impl<'s, 'p> AdditionalProperties<'s, 'p> { +impl AdditionalProperties { pub(crate) fn get_elisp_names<'c>(&'c self) -> impl Iterator + 'c { self.properties.keys().map(move |key| format!(":{}", key)) } } to_wasm!( - AdditionalProperties<'s, 'p>, + AdditionalProperties, AffiliatedKeywords<'s>, original, wasm_context, @@ -42,15 +40,17 @@ to_wasm!( for (name, val) in original.keywords.iter() { let converted_val = match val { AffiliatedKeywordValue::SingleString(val) => { - AdditionalPropertyValue::SingleString(val) + AdditionalPropertyValue::SingleString((*val).to_owned()) } AffiliatedKeywordValue::ListOfStrings(val) => { - AdditionalPropertyValue::ListOfStrings(val.clone()) + AdditionalPropertyValue::ListOfStrings( + val.iter().map(|s| (*s).to_owned()).collect(), + ) } AffiliatedKeywordValue::OptionalPair { optval, val } => { AdditionalPropertyValue::OptionalPair { - optval: optval.clone(), - val: val, + optval: optval.map(|s| (*s).to_owned()), + val: (*val).to_owned(), } } AffiliatedKeywordValue::ObjectTree(val) => { @@ -64,7 +64,7 @@ to_wasm!( .map(|child| { child .to_wasm(wasm_context.clone()) - .map(Into::>::into) + .map(Into::::into) }) .collect::, _>>()?, ) @@ -76,7 +76,7 @@ to_wasm!( .map(|child| { child .to_wasm(wasm_context.clone()) - .map(Into::>::into) + .map(Into::::into) }) .collect::, _>>()?; diff --git a/src/wasm/angle_link.rs b/src/wasm/angle_link.rs index 4cd9b65..46da241 100644 --- a/src/wasm/angle_link.rs +++ b/src/wasm/angle_link.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmAngleLink<'s, 'p> { +pub struct WasmAngleLink { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmAngleLink<'s, 'p>, + WasmAngleLink, AngleLink<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmAngleLink<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmAngleLink { + fn into(self) -> WasmAstNode { WasmAstNode::AngleLink(self) } } diff --git a/src/wasm/ast_node.rs b/src/wasm/ast_node.rs index 5dd7196..69c98b4 100644 --- a/src/wasm/ast_node.rs +++ b/src/wasm/ast_node.rs @@ -1,5 +1,3 @@ -use std::borrow::Cow; - use serde::Serialize; use super::angle_link::WasmAngleLink; @@ -60,99 +58,98 @@ use super::timestamp::WasmTimestamp; use super::underline::WasmUnderline; use super::verbatim::WasmVerbatim; use super::verse_block::WasmVerseBlock; -use super::WasmStandardProperties; -#[derive(Debug, Serialize)] -pub(crate) struct WasmAstWrapper<'b, 's, 'p, I> { - #[serde(rename = "ast-node")] - pub(crate) ast_node: Cow<'s, str>, - #[serde(rename = "standard-properties")] - pub(crate) standard_properties: &'b WasmStandardProperties, - #[serde(rename = "properties")] - pub(crate) inner: I, - pub(crate) children: &'b Vec>, -} +// #[derive(Debug, Serialize)] +// pub(crate) struct WasmAstWrapper<'b, 's, 'p, I> { +// #[serde(rename = "ast-node")] +// pub(crate) ast_node: Cow<'static, str>, +// #[serde(rename = "standard-properties")] +// pub(crate) standard_properties: WasmStandardProperties, +// #[serde(rename = "properties")] +// pub(crate) inner: I, +// pub(crate) children: &'b Vec>, +// } -impl<'b, 's, 'p, I> WasmAstWrapper<'b, 's, 'p, I> { - pub(crate) fn new( - ast_node: Cow<'s, str>, - standard_properties: &'b WasmStandardProperties, - inner: I, - children: &'b Vec>, - ) -> WasmAstWrapper<'b, 's, 'p, I> { - WasmAstWrapper { - ast_node, - standard_properties, - inner, - children, - } - } -} +// impl<'b, 's, 'p, I> WasmAstWrapper<'b, 's, 'p, I> { +// pub(crate) fn new( +// ast_node: Cow<'s, str>, +// standard_properties: &'b WasmStandardProperties, +// inner: I, +// children: &'b Vec>, +// ) -> WasmAstWrapper<'b, 's, 'p, I> { +// WasmAstWrapper { +// ast_node, +// standard_properties, +// inner, +// children, +// } +// } +// } #[derive(Debug, Serialize)] #[serde(untagged)] -pub enum WasmAstNode<'s, 'p> { +pub enum WasmAstNode { // Document Nodes - Document(WasmDocument<'s, 'p>), - Headline(WasmHeadline<'s, 'p>), - Section(WasmSection<'s, 'p>), + Document(WasmDocument), + Headline(WasmHeadline), + Section(WasmSection), // Elements - Paragraph(WasmParagraph<'s, 'p>), - PlainList(WasmPlainList<'s, 'p>), - PlainListItem(WasmPlainListItem<'s, 'p>), - CenterBlock(WasmCenterBlock<'s, 'p>), - QuoteBlock(WasmQuoteBlock<'s, 'p>), - SpecialBlock(WasmSpecialBlock<'s, 'p>), - DynamicBlock(WasmDynamicBlock<'s, 'p>), - FootnoteDefinition(WasmFootnoteDefinition<'s, 'p>), - Comment(WasmComment<'s, 'p>), - Drawer(WasmDrawer<'s, 'p>), - PropertyDrawer(WasmPropertyDrawer<'s, 'p>), - NodeProperty(WasmNodeProperty<'s, 'p>), - Table(WasmTable<'s, 'p>), - TableRow(WasmTableRow<'s, 'p>), - VerseBlock(WasmVerseBlock<'s, 'p>), - CommentBlock(WasmCommentBlock<'s, 'p>), - ExampleBlock(WasmExampleBlock<'s, 'p>), - ExportBlock(WasmExportBlock<'s, 'p>), - SrcBlock(WasmSrcBlock<'s, 'p>), - Clock(WasmClock<'s, 'p>), - DiarySexp(WasmDiarySexp<'s, 'p>), - Planning(WasmPlanning<'s, 'p>), - FixedWidthArea(WasmFixedWidthArea<'s, 'p>), - HorizontalRule(WasmHorizontalRule<'s, 'p>), - Keyword(WasmKeyword<'s, 'p>), - BabelCall(WasmBabelCall<'s, 'p>), - LatexEnvironment(WasmLatexEnvironment<'s, 'p>), + Paragraph(WasmParagraph), + PlainList(WasmPlainList), + PlainListItem(WasmPlainListItem), + CenterBlock(WasmCenterBlock), + QuoteBlock(WasmQuoteBlock), + SpecialBlock(WasmSpecialBlock), + DynamicBlock(WasmDynamicBlock), + FootnoteDefinition(WasmFootnoteDefinition), + Comment(WasmComment), + Drawer(WasmDrawer), + PropertyDrawer(WasmPropertyDrawer), + NodeProperty(WasmNodeProperty), + Table(WasmTable), + TableRow(WasmTableRow), + VerseBlock(WasmVerseBlock), + CommentBlock(WasmCommentBlock), + ExampleBlock(WasmExampleBlock), + ExportBlock(WasmExportBlock), + SrcBlock(WasmSrcBlock), + Clock(WasmClock), + DiarySexp(WasmDiarySexp), + Planning(WasmPlanning), + FixedWidthArea(WasmFixedWidthArea), + HorizontalRule(WasmHorizontalRule), + Keyword(WasmKeyword), + BabelCall(WasmBabelCall), + LatexEnvironment(WasmLatexEnvironment), // Objects - Bold(WasmBold<'s, 'p>), - Italic(WasmItalic<'s, 'p>), - Underline(WasmUnderline<'s, 'p>), - StrikeThrough(WasmStrikeThrough<'s, 'p>), - Code(WasmCode<'s, 'p>), - Verbatim(WasmVerbatim<'s, 'p>), - PlainText(WasmPlainText<'s, 'p>), - RegularLink(WasmRegularLink<'s, 'p>), - RadioLink(WasmRadioLink<'s, 'p>), - RadioTarget(WasmRadioTarget<'s, 'p>), - PlainLink(WasmPlainLink<'s, 'p>), - AngleLink(WasmAngleLink<'s, 'p>), - OrgMacro(WasmOrgMacro<'s, 'p>), - Entity(WasmEntity<'s, 'p>), - LatexFragment(WasmLatexFragment<'s, 'p>), - ExportSnippet(WasmExportSnippet<'s, 'p>), - FootnoteReference(WasmFootnoteReference<'s, 'p>), - Citation(WasmCitation<'s, 'p>), - CitationReference(WasmCitationReference<'s, 'p>), - InlineBabelCall(WasmInlineBabelCall<'s, 'p>), - InlineSourceBlock(WasmInlineSourceBlock<'s, 'p>), - LineBreak(WasmLineBreak<'s, 'p>), - Target(WasmTarget<'s, 'p>), - StatisticsCookie(WasmStatisticsCookie<'s, 'p>), - Subscript(WasmSubscript<'s, 'p>), - Superscript(WasmSuperscript<'s, 'p>), - TableCell(WasmTableCell<'s, 'p>), - Timestamp(WasmTimestamp<'s, 'p>), + Bold(WasmBold), + Italic(WasmItalic), + Underline(WasmUnderline), + StrikeThrough(WasmStrikeThrough), + Code(WasmCode), + Verbatim(WasmVerbatim), + PlainText(WasmPlainText), + RegularLink(WasmRegularLink), + RadioLink(WasmRadioLink), + RadioTarget(WasmRadioTarget), + PlainLink(WasmPlainLink), + AngleLink(WasmAngleLink), + OrgMacro(WasmOrgMacro), + Entity(WasmEntity), + LatexFragment(WasmLatexFragment), + ExportSnippet(WasmExportSnippet), + FootnoteReference(WasmFootnoteReference), + Citation(WasmCitation), + CitationReference(WasmCitationReference), + InlineBabelCall(WasmInlineBabelCall), + InlineSourceBlock(WasmInlineSourceBlock), + LineBreak(WasmLineBreak), + Target(WasmTarget), + StatisticsCookie(WasmStatisticsCookie), + Subscript(WasmSubscript), + Superscript(WasmSuperscript), + TableCell(WasmTableCell), + Timestamp(WasmTimestamp), } -impl<'s, 'p> WasmAstNode<'s, 'p> {} +impl WasmAstNode {} diff --git a/src/wasm/babel_call.rs b/src/wasm/babel_call.rs index e88cea7..f3825c9 100644 --- a/src/wasm/babel_call.rs +++ b/src/wasm/babel_call.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmBabelCall<'s, 'p> { +pub struct WasmBabelCall { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmBabelCall<'s, 'p>, + WasmBabelCall, BabelCall<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmBabelCall<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmBabelCall { + fn into(self) -> WasmAstNode { WasmAstNode::BabelCall(self) } } diff --git a/src/wasm/bold.rs b/src/wasm/bold.rs index fdb3be6..0180023 100644 --- a/src/wasm/bold.rs +++ b/src/wasm/bold.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmBold<'s, 'p> { +pub struct WasmBold { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmBold<'s, 'p>, + WasmBold, Bold<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmBold<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmBold { + fn into(self) -> WasmAstNode { WasmAstNode::Bold(self) } } diff --git a/src/wasm/center_block.rs b/src/wasm/center_block.rs index 3f9c80f..a488bf5 100644 --- a/src/wasm/center_block.rs +++ b/src/wasm/center_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmCenterBlock<'s, 'p> { +pub struct WasmCenterBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmCenterBlock<'s, 'p>, + WasmCenterBlock, CenterBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmCenterBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmCenterBlock { + fn into(self) -> WasmAstNode { WasmAstNode::CenterBlock(self) } } diff --git a/src/wasm/citation.rs b/src/wasm/citation.rs index 1622950..06f5761 100644 --- a/src/wasm/citation.rs +++ b/src/wasm/citation.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmCitation<'s, 'p> { +pub struct WasmCitation { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmCitation<'s, 'p>, + WasmCitation, Citation<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmCitation<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmCitation { + fn into(self) -> WasmAstNode { WasmAstNode::Citation(self) } } diff --git a/src/wasm/citation_reference.rs b/src/wasm/citation_reference.rs index 0950e55..dbb32fe 100644 --- a/src/wasm/citation_reference.rs +++ b/src/wasm/citation_reference.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmCitationReference<'s, 'p> { +pub struct WasmCitationReference { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmCitationReference<'s, 'p>, + WasmCitationReference, CitationReference<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmCitationReference<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmCitationReference { + fn into(self) -> WasmAstNode { WasmAstNode::CitationReference(self) } } diff --git a/src/wasm/clock.rs b/src/wasm/clock.rs index d0cbae9..a24df30 100644 --- a/src/wasm/clock.rs +++ b/src/wasm/clock.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmClock<'s, 'p> { +pub struct WasmClock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmClock<'s, 'p>, + WasmClock, Clock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmClock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmClock { + fn into(self) -> WasmAstNode { WasmAstNode::Clock(self) } } diff --git a/src/wasm/code.rs b/src/wasm/code.rs index be0ee6b..e8456b3 100644 --- a/src/wasm/code.rs +++ b/src/wasm/code.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmCode<'s, 'p> { +pub struct WasmCode { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmCode<'s, 'p>, + WasmCode, Code<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmCode<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmCode { + fn into(self) -> WasmAstNode { WasmAstNode::Code(self) } } diff --git a/src/wasm/comment.rs b/src/wasm/comment.rs index 029f6b1..c9cf266 100644 --- a/src/wasm/comment.rs +++ b/src/wasm/comment.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmComment<'s, 'p> { +pub struct WasmComment { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmComment<'s, 'p>, + WasmComment, Comment<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmComment<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmComment { + fn into(self) -> WasmAstNode { WasmAstNode::Comment(self) } } diff --git a/src/wasm/comment_block.rs b/src/wasm/comment_block.rs index 7a51e71..c39c505 100644 --- a/src/wasm/comment_block.rs +++ b/src/wasm/comment_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmCommentBlock<'s, 'p> { +pub struct WasmCommentBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmCommentBlock<'s, 'p>, + WasmCommentBlock, CommentBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmCommentBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmCommentBlock { + fn into(self) -> WasmAstNode { WasmAstNode::CommentBlock(self) } } diff --git a/src/wasm/diary_sexp.rs b/src/wasm/diary_sexp.rs index f96e5ab..14fbe18 100644 --- a/src/wasm/diary_sexp.rs +++ b/src/wasm/diary_sexp.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmDiarySexp<'s, 'p> { +pub struct WasmDiarySexp { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmDiarySexp<'s, 'p>, + WasmDiarySexp, DiarySexp<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmDiarySexp<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmDiarySexp { + fn into(self) -> WasmAstNode { WasmAstNode::DiarySexp(self) } } diff --git a/src/wasm/document.rs b/src/wasm/document.rs index e7a006f..48f6fb8 100644 --- a/src/wasm/document.rs +++ b/src/wasm/document.rs @@ -5,7 +5,6 @@ use serde::Serialize; use super::additional_property::AdditionalProperties; use super::additional_property::AdditionalPropertyValue; use super::ast_node::WasmAstNode; -use super::ast_node::WasmAstWrapper; use super::macros::to_wasm; use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; @@ -15,22 +14,22 @@ use crate::types::Document; use crate::wasm::to_wasm::ToWasmStandardProperties; #[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] +#[serde(tag = "__ast_node")] #[serde(rename = "org-data")] -pub struct WasmDocument<'s, 'p> { +pub struct WasmDocument { #[serde(rename = "standard-properties")] pub(crate) standard_properties: WasmStandardProperties, #[serde(flatten)] - pub(crate) additional_properties: AdditionalProperties<'s, 'p>, + pub(crate) additional_properties: AdditionalProperties, #[serde(rename = "__children")] - pub(crate) children: Vec>, + pub(crate) children: Vec, #[serde(rename = "CATEGORY")] - pub(crate) category: Option<&'p str>, + pub(crate) category: Option, pub(crate) path: Option, } to_wasm!( - WasmDocument<'s, 'p>, + WasmDocument, Document<'s>, original, wasm_context, @@ -43,7 +42,7 @@ to_wasm!( for (name, val) in original.get_additional_properties().map(|node_property| { ( node_property.property_name.to_uppercase(), - AdditionalPropertyValue::SingleString(node_property.value.unwrap_or("")), + AdditionalPropertyValue::SingleString(node_property.value.unwrap_or("").to_owned()), ) }) { additional_properties.properties.insert(name, val); @@ -55,12 +54,12 @@ to_wasm!( .map(|child| { child .to_wasm(wasm_context.clone()) - .map(Into::>::into) + .map(Into::::into) }) .chain(original.children.iter().map(|child| { child .to_wasm(wasm_context.clone()) - .map(Into::>::into) + .map(Into::::into) })) .collect::, _>>()?; @@ -68,34 +67,21 @@ to_wasm!( standard_properties, additional_properties, children, - category, + category: category.map(str::to_owned), path, }) } ); -impl<'s, 'p> Into> for WasmDocument<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmDocument { + fn into(self) -> WasmAstNode { WasmAstNode::Document(self) } } #[cfg(feature = "wasm_test")] -impl<'s, 'p> ElispFact<'s> for WasmDocument<'s, 'p> { +impl<'s> ElispFact<'s> for WasmDocument { fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> { "org-data".into() } } - -impl<'b, 's, 'p> Into>> - for &'b WasmDocument<'s, 'p> -{ - fn into(self) -> WasmAstWrapper<'b, 's, 'p, &'b WasmDocument<'s, 'p>> { - WasmAstWrapper::new( - self.get_elisp_name(), - &self.standard_properties, - self, - &self.children, - ) - } -} diff --git a/src/wasm/drawer.rs b/src/wasm/drawer.rs index 2375a2b..3519655 100644 --- a/src/wasm/drawer.rs +++ b/src/wasm/drawer.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmDrawer<'s, 'p> { +pub struct WasmDrawer { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmDrawer<'s, 'p>, + WasmDrawer, Drawer<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmDrawer<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmDrawer { + fn into(self) -> WasmAstNode { WasmAstNode::Drawer(self) } } diff --git a/src/wasm/dynamic_block.rs b/src/wasm/dynamic_block.rs index 9508a51..af32287 100644 --- a/src/wasm/dynamic_block.rs +++ b/src/wasm/dynamic_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmDynamicBlock<'s, 'p> { +pub struct WasmDynamicBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmDynamicBlock<'s, 'p>, + WasmDynamicBlock, DynamicBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmDynamicBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmDynamicBlock { + fn into(self) -> WasmAstNode { WasmAstNode::DynamicBlock(self) } } diff --git a/src/wasm/entity.rs b/src/wasm/entity.rs index 3a5b318..3a9ea0b 100644 --- a/src/wasm/entity.rs +++ b/src/wasm/entity.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmEntity<'s, 'p> { +pub struct WasmEntity { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmEntity<'s, 'p>, + WasmEntity, Entity<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmEntity<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmEntity { + fn into(self) -> WasmAstNode { WasmAstNode::Entity(self) } } diff --git a/src/wasm/example_block.rs b/src/wasm/example_block.rs index 7537c56..c0aa7b5 100644 --- a/src/wasm/example_block.rs +++ b/src/wasm/example_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmExampleBlock<'s, 'p> { +pub struct WasmExampleBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmExampleBlock<'s, 'p>, + WasmExampleBlock, ExampleBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmExampleBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmExampleBlock { + fn into(self) -> WasmAstNode { WasmAstNode::ExampleBlock(self) } } diff --git a/src/wasm/export_block.rs b/src/wasm/export_block.rs index 5eb3f20..75d99e2 100644 --- a/src/wasm/export_block.rs +++ b/src/wasm/export_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmExportBlock<'s, 'p> { +pub struct WasmExportBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmExportBlock<'s, 'p>, + WasmExportBlock, ExportBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmExportBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmExportBlock { + fn into(self) -> WasmAstNode { WasmAstNode::ExportBlock(self) } } diff --git a/src/wasm/export_snippet.rs b/src/wasm/export_snippet.rs index 4890edb..49ae0c3 100644 --- a/src/wasm/export_snippet.rs +++ b/src/wasm/export_snippet.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmExportSnippet<'s, 'p> { +pub struct WasmExportSnippet { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmExportSnippet<'s, 'p>, + WasmExportSnippet, ExportSnippet<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmExportSnippet<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmExportSnippet { + fn into(self) -> WasmAstNode { WasmAstNode::ExportSnippet(self) } } diff --git a/src/wasm/fixed_width_area.rs b/src/wasm/fixed_width_area.rs index b21178f..3331ba2 100644 --- a/src/wasm/fixed_width_area.rs +++ b/src/wasm/fixed_width_area.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmFixedWidthArea<'s, 'p> { +pub struct WasmFixedWidthArea { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmFixedWidthArea<'s, 'p>, + WasmFixedWidthArea, FixedWidthArea<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmFixedWidthArea<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmFixedWidthArea { + fn into(self) -> WasmAstNode { WasmAstNode::FixedWidthArea(self) } } diff --git a/src/wasm/footnote_definition.rs b/src/wasm/footnote_definition.rs index b48cd5a..47c6197 100644 --- a/src/wasm/footnote_definition.rs +++ b/src/wasm/footnote_definition.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmFootnoteDefinition<'s, 'p> { +pub struct WasmFootnoteDefinition { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmFootnoteDefinition<'s, 'p>, + WasmFootnoteDefinition, FootnoteDefinition<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmFootnoteDefinition<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmFootnoteDefinition { + fn into(self) -> WasmAstNode { WasmAstNode::FootnoteDefinition(self) } } diff --git a/src/wasm/footnote_reference.rs b/src/wasm/footnote_reference.rs index 5442f46..74b9f25 100644 --- a/src/wasm/footnote_reference.rs +++ b/src/wasm/footnote_reference.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmFootnoteReference<'s, 'p> { +pub struct WasmFootnoteReference { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmFootnoteReference<'s, 'p>, + WasmFootnoteReference, FootnoteReference<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmFootnoteReference<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmFootnoteReference { + fn into(self) -> WasmAstNode { WasmAstNode::FootnoteReference(self) } } diff --git a/src/wasm/headline.rs b/src/wasm/headline.rs index 56da464..fc0f20e 100644 --- a/src/wasm/headline.rs +++ b/src/wasm/headline.rs @@ -10,13 +10,13 @@ use crate::wasm::to_wasm::ToWasmStandardProperties; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "headline")] -pub struct WasmHeadline<'s, 'p> { +pub struct WasmHeadline { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmHeadline<'s, 'p>, + WasmHeadline, Heading<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmHeadline<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmHeadline { + fn into(self) -> WasmAstNode { WasmAstNode::Headline(self) } } diff --git a/src/wasm/horizontal_rule.rs b/src/wasm/horizontal_rule.rs index 9ea6a1d..d710fc6 100644 --- a/src/wasm/horizontal_rule.rs +++ b/src/wasm/horizontal_rule.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmHorizontalRule<'s, 'p> { +pub struct WasmHorizontalRule { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmHorizontalRule<'s, 'p>, + WasmHorizontalRule, HorizontalRule<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmHorizontalRule<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmHorizontalRule { + fn into(self) -> WasmAstNode { WasmAstNode::HorizontalRule(self) } } diff --git a/src/wasm/inline_babel_call.rs b/src/wasm/inline_babel_call.rs index 61544ba..53f2a8d 100644 --- a/src/wasm/inline_babel_call.rs +++ b/src/wasm/inline_babel_call.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmInlineBabelCall<'s, 'p> { +pub struct WasmInlineBabelCall { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmInlineBabelCall<'s, 'p>, + WasmInlineBabelCall, InlineBabelCall<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmInlineBabelCall<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmInlineBabelCall { + fn into(self) -> WasmAstNode { WasmAstNode::InlineBabelCall(self) } } diff --git a/src/wasm/inline_source_block.rs b/src/wasm/inline_source_block.rs index f6741f4..60d5f00 100644 --- a/src/wasm/inline_source_block.rs +++ b/src/wasm/inline_source_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmInlineSourceBlock<'s, 'p> { +pub struct WasmInlineSourceBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmInlineSourceBlock<'s, 'p>, + WasmInlineSourceBlock, InlineSourceBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmInlineSourceBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmInlineSourceBlock { + fn into(self) -> WasmAstNode { WasmAstNode::InlineSourceBlock(self) } } diff --git a/src/wasm/italic.rs b/src/wasm/italic.rs index ad59550..b8f5091 100644 --- a/src/wasm/italic.rs +++ b/src/wasm/italic.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmItalic<'s, 'p> { +pub struct WasmItalic { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmItalic<'s, 'p>, + WasmItalic, Italic<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmItalic<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmItalic { + fn into(self) -> WasmAstNode { WasmAstNode::Italic(self) } } diff --git a/src/wasm/keyword.rs b/src/wasm/keyword.rs index fc8431e..370b6ce 100644 --- a/src/wasm/keyword.rs +++ b/src/wasm/keyword.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmKeyword<'s, 'p> { +pub struct WasmKeyword { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmKeyword<'s, 'p>, + WasmKeyword, Keyword<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmKeyword<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmKeyword { + fn into(self) -> WasmAstNode { WasmAstNode::Keyword(self) } } diff --git a/src/wasm/latex_environment.rs b/src/wasm/latex_environment.rs index 9209726..2e4cb70 100644 --- a/src/wasm/latex_environment.rs +++ b/src/wasm/latex_environment.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmLatexEnvironment<'s, 'p> { +pub struct WasmLatexEnvironment { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmLatexEnvironment<'s, 'p>, + WasmLatexEnvironment, LatexEnvironment<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmLatexEnvironment<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmLatexEnvironment { + fn into(self) -> WasmAstNode { WasmAstNode::LatexEnvironment(self) } } diff --git a/src/wasm/latex_fragment.rs b/src/wasm/latex_fragment.rs index 77c717e..a1619c3 100644 --- a/src/wasm/latex_fragment.rs +++ b/src/wasm/latex_fragment.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmLatexFragment<'s, 'p> { +pub struct WasmLatexFragment { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmLatexFragment<'s, 'p>, + WasmLatexFragment, LatexFragment<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmLatexFragment<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmLatexFragment { + fn into(self) -> WasmAstNode { WasmAstNode::LatexFragment(self) } } diff --git a/src/wasm/line_break.rs b/src/wasm/line_break.rs index 2af6cd4..aed5d03 100644 --- a/src/wasm/line_break.rs +++ b/src/wasm/line_break.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmLineBreak<'s, 'p> { +pub struct WasmLineBreak { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmLineBreak<'s, 'p>, + WasmLineBreak, LineBreak<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmLineBreak<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmLineBreak { + fn into(self) -> WasmAstNode { WasmAstNode::LineBreak(self) } } diff --git a/src/wasm/macros.rs b/src/wasm/macros.rs index 89ce843..8ed5021 100644 --- a/src/wasm/macros.rs +++ b/src/wasm/macros.rs @@ -3,11 +3,11 @@ /// This exists to make changing the type signature easier. macro_rules! to_wasm { ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $fnbody:tt) => { - impl<'s, 'p> ToWasm<'p> for $istruct { + impl<'s> ToWasm for $istruct { type Output = $ostruct; fn to_wasm( - &'p self, + &self, $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, ) -> Result { let $original = self; @@ -16,11 +16,11 @@ macro_rules! to_wasm { } }; ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => { - impl<'s, 'p> ToWasm<'p> for $istruct { + impl<'s> ToWasm for $istruct { type Output = $ostruct; fn to_wasm( - &'p self, + &self, $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, ) -> Result { let $original = self; diff --git a/src/wasm/node_property.rs b/src/wasm/node_property.rs index 710409c..c5c7242 100644 --- a/src/wasm/node_property.rs +++ b/src/wasm/node_property.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmNodeProperty<'s, 'p> { +pub struct WasmNodeProperty { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmNodeProperty<'s, 'p>, + WasmNodeProperty, NodeProperty<'s>, original, wasm_context, diff --git a/src/wasm/org_macro.rs b/src/wasm/org_macro.rs index de38405..6be58c9 100644 --- a/src/wasm/org_macro.rs +++ b/src/wasm/org_macro.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmOrgMacro<'s, 'p> { +pub struct WasmOrgMacro { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmOrgMacro<'s, 'p>, + WasmOrgMacro, OrgMacro<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmOrgMacro<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmOrgMacro { + fn into(self) -> WasmAstNode { WasmAstNode::OrgMacro(self) } } diff --git a/src/wasm/paragraph.rs b/src/wasm/paragraph.rs index 057c050..2113f6a 100644 --- a/src/wasm/paragraph.rs +++ b/src/wasm/paragraph.rs @@ -14,15 +14,15 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "paragraph")] -pub struct WasmParagraph<'s, 'p> { +pub struct WasmParagraph { pub(crate) standard_properties: WasmStandardProperties, #[serde(flatten)] - pub(crate) additional_properties: AdditionalProperties<'s, 'p>, - pub(crate) children: Vec>, + pub(crate) additional_properties: AdditionalProperties, + pub(crate) children: Vec, } to_wasm!( - WasmParagraph<'s, 'p>, + WasmParagraph, Paragraph<'s>, original, wasm_context, @@ -38,7 +38,7 @@ to_wasm!( .map(|child| { child .to_wasm(wasm_context.clone()) - .map(Into::>::into) + .map(Into::::into) }) .collect::, _>>()?; @@ -50,14 +50,14 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmParagraph<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmParagraph { + fn into(self) -> WasmAstNode { WasmAstNode::Paragraph(self) } } #[cfg(feature = "wasm_test")] -impl<'s, 'p> ElispFact<'s> for WasmParagraph<'s, 'p> { +impl<'s> ElispFact<'s> for WasmParagraph { fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> { "paragraph".into() } diff --git a/src/wasm/parse_result.rs b/src/wasm/parse_result.rs index 9d88fb2..4dfcd8c 100644 --- a/src/wasm/parse_result.rs +++ b/src/wasm/parse_result.rs @@ -4,9 +4,9 @@ use super::document::WasmDocument; #[derive(Debug, Serialize)] #[serde(tag = "status", content = "content")] -pub enum ParseResult<'s, 'p> { +pub enum ParseResult { #[serde(rename = "success")] - Success(WasmDocument<'s, 'p>), + Success(WasmDocument), #[serde(rename = "error")] Error(String), diff --git a/src/wasm/plain_link.rs b/src/wasm/plain_link.rs index 69568a3..0676adf 100644 --- a/src/wasm/plain_link.rs +++ b/src/wasm/plain_link.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmPlainLink<'s, 'p> { +pub struct WasmPlainLink { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmPlainLink<'s, 'p>, + WasmPlainLink, PlainLink<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmPlainLink<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmPlainLink { + fn into(self) -> WasmAstNode { WasmAstNode::PlainLink(self) } } diff --git a/src/wasm/plain_list.rs b/src/wasm/plain_list.rs index df8ada2..3f8dbfa 100644 --- a/src/wasm/plain_list.rs +++ b/src/wasm/plain_list.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmPlainList<'s, 'p> { +pub struct WasmPlainList { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmPlainList<'s, 'p>, + WasmPlainList, PlainList<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmPlainList<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmPlainList { + fn into(self) -> WasmAstNode { WasmAstNode::PlainList(self) } } diff --git a/src/wasm/plain_list_item.rs b/src/wasm/plain_list_item.rs index af237ea..3ca9153 100644 --- a/src/wasm/plain_list_item.rs +++ b/src/wasm/plain_list_item.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmPlainListItem<'s, 'p> { +pub struct WasmPlainListItem { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmPlainListItem<'s, 'p>, + WasmPlainListItem, PlainListItem<'s>, original, wasm_context, diff --git a/src/wasm/plain_text.rs b/src/wasm/plain_text.rs index e8839c8..eda86ad 100644 --- a/src/wasm/plain_text.rs +++ b/src/wasm/plain_text.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmPlainText<'s, 'p> { +pub struct WasmPlainText { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmPlainText<'s, 'p>, + WasmPlainText, PlainText<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmPlainText<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmPlainText { + fn into(self) -> WasmAstNode { WasmAstNode::PlainText(self) } } diff --git a/src/wasm/planning.rs b/src/wasm/planning.rs index c921717..551aec7 100644 --- a/src/wasm/planning.rs +++ b/src/wasm/planning.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmPlanning<'s, 'p> { +pub struct WasmPlanning { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmPlanning<'s, 'p>, + WasmPlanning, Planning<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmPlanning<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmPlanning { + fn into(self) -> WasmAstNode { WasmAstNode::Planning(self) } } diff --git a/src/wasm/property_drawer.rs b/src/wasm/property_drawer.rs index a02e06d..6d2462d 100644 --- a/src/wasm/property_drawer.rs +++ b/src/wasm/property_drawer.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmPropertyDrawer<'s, 'p> { +pub struct WasmPropertyDrawer { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmPropertyDrawer<'s, 'p>, + WasmPropertyDrawer, PropertyDrawer<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmPropertyDrawer<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmPropertyDrawer { + fn into(self) -> WasmAstNode { WasmAstNode::PropertyDrawer(self) } } diff --git a/src/wasm/quote_block.rs b/src/wasm/quote_block.rs index e1f89ed..8ab493c 100644 --- a/src/wasm/quote_block.rs +++ b/src/wasm/quote_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmQuoteBlock<'s, 'p> { +pub struct WasmQuoteBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmQuoteBlock<'s, 'p>, + WasmQuoteBlock, QuoteBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmQuoteBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmQuoteBlock { + fn into(self) -> WasmAstNode { WasmAstNode::QuoteBlock(self) } } diff --git a/src/wasm/radio_link.rs b/src/wasm/radio_link.rs index 58c3395..12650d3 100644 --- a/src/wasm/radio_link.rs +++ b/src/wasm/radio_link.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmRadioLink<'s, 'p> { +pub struct WasmRadioLink { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmRadioLink<'s, 'p>, + WasmRadioLink, RadioLink<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmRadioLink<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmRadioLink { + fn into(self) -> WasmAstNode { WasmAstNode::RadioLink(self) } } diff --git a/src/wasm/radio_target.rs b/src/wasm/radio_target.rs index 5498faa..7086b10 100644 --- a/src/wasm/radio_target.rs +++ b/src/wasm/radio_target.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmRadioTarget<'s, 'p> { +pub struct WasmRadioTarget { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmRadioTarget<'s, 'p>, + WasmRadioTarget, RadioTarget<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmRadioTarget<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmRadioTarget { + fn into(self) -> WasmAstNode { WasmAstNode::RadioTarget(self) } } diff --git a/src/wasm/regular_link.rs b/src/wasm/regular_link.rs index b989a36..4d381d0 100644 --- a/src/wasm/regular_link.rs +++ b/src/wasm/regular_link.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmRegularLink<'s, 'p> { +pub struct WasmRegularLink { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmRegularLink<'s, 'p>, + WasmRegularLink, RegularLink<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmRegularLink<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmRegularLink { + fn into(self) -> WasmAstNode { WasmAstNode::RegularLink(self) } } diff --git a/src/wasm/section.rs b/src/wasm/section.rs index 641528f..e0730a4 100644 --- a/src/wasm/section.rs +++ b/src/wasm/section.rs @@ -13,15 +13,15 @@ use crate::wasm::to_wasm::ToWasmStandardProperties; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "section")] -pub struct WasmSection<'s, 'p> { +pub struct WasmSection { pub(crate) standard_properties: WasmStandardProperties, #[serde(flatten)] - pub(crate) additional_properties: AdditionalProperties<'s, 'p>, - pub(crate) children: Vec>, + pub(crate) additional_properties: AdditionalProperties, + pub(crate) children: Vec, } to_wasm!( - WasmSection<'s, 'p>, + WasmSection, Section<'s>, original, wasm_context, @@ -33,7 +33,7 @@ to_wasm!( .map(|child| { child .to_wasm(wasm_context.clone()) - .map(Into::>::into) + .map(Into::::into) }) .collect::, _>>()?; @@ -45,14 +45,14 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmSection<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmSection { + fn into(self) -> WasmAstNode { WasmAstNode::Section(self) } } #[cfg(feature = "wasm_test")] -impl<'s, 'p> ElispFact<'s> for WasmSection<'s, 'p> { +impl<'s> ElispFact<'s> for WasmSection { fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> { "section".into() } diff --git a/src/wasm/special_block.rs b/src/wasm/special_block.rs index 7617268..0ff84bc 100644 --- a/src/wasm/special_block.rs +++ b/src/wasm/special_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmSpecialBlock<'s, 'p> { +pub struct WasmSpecialBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmSpecialBlock<'s, 'p>, + WasmSpecialBlock, SpecialBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmSpecialBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmSpecialBlock { + fn into(self) -> WasmAstNode { WasmAstNode::SpecialBlock(self) } } diff --git a/src/wasm/src_block.rs b/src/wasm/src_block.rs index 67ff1a4..8762484 100644 --- a/src/wasm/src_block.rs +++ b/src/wasm/src_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmSrcBlock<'s, 'p> { +pub struct WasmSrcBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmSrcBlock<'s, 'p>, + WasmSrcBlock, SrcBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmSrcBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmSrcBlock { + fn into(self) -> WasmAstNode { WasmAstNode::SrcBlock(self) } } diff --git a/src/wasm/statistics_cookie.rs b/src/wasm/statistics_cookie.rs index 4cdd774..773d4d4 100644 --- a/src/wasm/statistics_cookie.rs +++ b/src/wasm/statistics_cookie.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmStatisticsCookie<'s, 'p> { +pub struct WasmStatisticsCookie { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmStatisticsCookie<'s, 'p>, + WasmStatisticsCookie, StatisticsCookie<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmStatisticsCookie<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmStatisticsCookie { + fn into(self) -> WasmAstNode { WasmAstNode::StatisticsCookie(self) } } diff --git a/src/wasm/strike_through.rs b/src/wasm/strike_through.rs index 08e97c1..cf42d90 100644 --- a/src/wasm/strike_through.rs +++ b/src/wasm/strike_through.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmStrikeThrough<'s, 'p> { +pub struct WasmStrikeThrough { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmStrikeThrough<'s, 'p>, + WasmStrikeThrough, StrikeThrough<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmStrikeThrough<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmStrikeThrough { + fn into(self) -> WasmAstNode { WasmAstNode::StrikeThrough(self) } } diff --git a/src/wasm/subscript.rs b/src/wasm/subscript.rs index 3cd668c..b669ec9 100644 --- a/src/wasm/subscript.rs +++ b/src/wasm/subscript.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmSubscript<'s, 'p> { +pub struct WasmSubscript { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmSubscript<'s, 'p>, + WasmSubscript, Subscript<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmSubscript<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmSubscript { + fn into(self) -> WasmAstNode { WasmAstNode::Subscript(self) } } diff --git a/src/wasm/superscript.rs b/src/wasm/superscript.rs index caf83ff..6b468a3 100644 --- a/src/wasm/superscript.rs +++ b/src/wasm/superscript.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmSuperscript<'s, 'p> { +pub struct WasmSuperscript { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmSuperscript<'s, 'p>, + WasmSuperscript, Superscript<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmSuperscript<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmSuperscript { + fn into(self) -> WasmAstNode { WasmAstNode::Superscript(self) } } diff --git a/src/wasm/table.rs b/src/wasm/table.rs index 455bc76..fbeb31c 100644 --- a/src/wasm/table.rs +++ b/src/wasm/table.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmTable<'s, 'p> { +pub struct WasmTable { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmTable<'s, 'p>, + WasmTable, Table<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmTable<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmTable { + fn into(self) -> WasmAstNode { WasmAstNode::Table(self) } } diff --git a/src/wasm/table_cell.rs b/src/wasm/table_cell.rs index c26d1b6..188baeb 100644 --- a/src/wasm/table_cell.rs +++ b/src/wasm/table_cell.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmTableCell<'s, 'p> { +pub struct WasmTableCell { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmTableCell<'s, 'p>, + WasmTableCell, TableCell<'s>, original, wasm_context, diff --git a/src/wasm/table_row.rs b/src/wasm/table_row.rs index d4237d4..3065103 100644 --- a/src/wasm/table_row.rs +++ b/src/wasm/table_row.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmTableRow<'s, 'p> { +pub struct WasmTableRow { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmTableRow<'s, 'p>, + WasmTableRow, TableRow<'s>, original, wasm_context, diff --git a/src/wasm/target.rs b/src/wasm/target.rs index ff1f533..eea8b11 100644 --- a/src/wasm/target.rs +++ b/src/wasm/target.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmTarget<'s, 'p> { +pub struct WasmTarget { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmTarget<'s, 'p>, + WasmTarget, Target<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmTarget<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmTarget { + fn into(self) -> WasmAstNode { WasmAstNode::Target(self) } } diff --git a/src/wasm/timestamp.rs b/src/wasm/timestamp.rs index 38b6ef1..e90e0db 100644 --- a/src/wasm/timestamp.rs +++ b/src/wasm/timestamp.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmTimestamp<'s, 'p> { +pub struct WasmTimestamp { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmTimestamp<'s, 'p>, + WasmTimestamp, Timestamp<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmTimestamp<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmTimestamp { + fn into(self) -> WasmAstNode { WasmAstNode::Timestamp(self) } } diff --git a/src/wasm/to_wasm.rs b/src/wasm/to_wasm.rs index 0db2a2c..52bd790 100644 --- a/src/wasm/to_wasm.rs +++ b/src/wasm/to_wasm.rs @@ -4,10 +4,10 @@ use crate::error::CustomError; use crate::types::Element; use crate::types::Object; -pub trait ToWasm<'p> { +pub trait ToWasm { type Output; - fn to_wasm(&'p self, full_document: ToWasmContext<'_>) -> Result; + fn to_wasm(&self, full_document: ToWasmContext<'_>) -> Result; } pub(crate) trait ToWasmStandardProperties { @@ -31,7 +31,7 @@ impl<'s> ToWasmContext<'s> { } to_wasm!( - WasmAstNode<'s, 'p>, + WasmAstNode, Element<'s>, original, wasm_context, @@ -93,7 +93,7 @@ to_wasm!( ); to_wasm!( - WasmAstNode<'s, 'p>, + WasmAstNode, Object<'s>, original, wasm_context, diff --git a/src/wasm/underline.rs b/src/wasm/underline.rs index 11e3830..0451b3f 100644 --- a/src/wasm/underline.rs +++ b/src/wasm/underline.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmUnderline<'s, 'p> { +pub struct WasmUnderline { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmUnderline<'s, 'p>, + WasmUnderline, Underline<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmUnderline<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmUnderline { + fn into(self) -> WasmAstNode { WasmAstNode::Underline(self) } } diff --git a/src/wasm/verbatim.rs b/src/wasm/verbatim.rs index 57ea20d..48a8892 100644 --- a/src/wasm/verbatim.rs +++ b/src/wasm/verbatim.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmVerbatim<'s, 'p> { +pub struct WasmVerbatim { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmVerbatim<'s, 'p>, + WasmVerbatim, Verbatim<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmVerbatim<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmVerbatim { + fn into(self) -> WasmAstNode { WasmAstNode::Verbatim(self) } } diff --git a/src/wasm/verse_block.rs b/src/wasm/verse_block.rs index 8693b6c..ba538f5 100644 --- a/src/wasm/verse_block.rs +++ b/src/wasm/verse_block.rs @@ -10,13 +10,13 @@ use crate::wasm::WasmAstNode; #[derive(Debug, Serialize)] #[serde(tag = "ast_node")] #[serde(rename = "org-data")] -pub struct WasmVerseBlock<'s, 'p> { +pub struct WasmVerseBlock { standard_properties: WasmStandardProperties, - children: Vec>, + children: Vec, } to_wasm!( - WasmVerseBlock<'s, 'p>, + WasmVerseBlock, VerseBlock<'s>, original, wasm_context, @@ -29,8 +29,8 @@ to_wasm!( } ); -impl<'s, 'p> Into> for WasmVerseBlock<'s, 'p> { - fn into(self) -> WasmAstNode<'s, 'p> { +impl Into for WasmVerseBlock { + fn into(self) -> WasmAstNode { WasmAstNode::VerseBlock(self) } } diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index a7f62b8..fda5f41 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -2,11 +2,6 @@ use std::borrow::Cow; use super::diff::WasmDiffResult; use super::diff::WasmDiffStatus; -use super::elisp_compare::WasmElispCompare; -use super::logic::wasm_compare_additional_properties; -use super::logic::wasm_compare_list; -use super::logic::wasm_compare_property_quoted_string; -use super::logic::wasm_compare_standard_properties; use crate::compare::ElispFact; use crate::compare::EmacsField; use crate::compare::Token; @@ -71,10 +66,10 @@ use crate::wasm::WasmVerbatim; use crate::wasm::WasmVerseBlock; use crate::wasm_test::macros::wasm_compare; -pub fn wasm_compare_document<'b, 's, 'p>( +pub fn wasm_compare_document<'e, 's, 'w>( source: &'s str, - emacs: &'b Token<'s>, - wasm: WasmDocument<'s, 'p>, + emacs: &'e Token<'s>, + wasm: &'w WasmDocument, ) -> Result, Box> { let wasm_json = serde_json::to_string(&wasm)?; let wasm_json_parsed = serde_json::from_str(&wasm_json)?; @@ -238,1663 +233,1663 @@ fn wasm_key_to_emacs_key(wasm_key: WK) -> String { format!(":{key}", key = wasm_key) } -pub fn old_wasm_compare_document<'b, 's, 'p>( - source: &'s str, - emacs: &'b Token<'s>, - wasm: WasmDocument<'s, 'p>, -) -> Result, Box> { - wasm.compare_ast_node(source, emacs) -} - -impl<'s, 'p, WAN: WasmElispCompare<'s, 'p>> WasmElispCompare<'s, 'p> for &WAN { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - (*self).compare_ast_node(source, emacs) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmAstNode<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - match self { - WasmAstNode::Document(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Headline(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Section(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Paragraph(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::PlainList(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::PlainListItem(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::CenterBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::QuoteBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::SpecialBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::DynamicBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::FootnoteDefinition(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Comment(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Drawer(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::PropertyDrawer(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::NodeProperty(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Table(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::TableRow(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::VerseBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::CommentBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::ExampleBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::ExportBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::SrcBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Clock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::DiarySexp(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Planning(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::FixedWidthArea(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::HorizontalRule(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Keyword(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::BabelCall(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::LatexEnvironment(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Bold(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Italic(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Underline(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::StrikeThrough(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Code(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Verbatim(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::PlainText(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::RegularLink(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::RadioLink(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::RadioTarget(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::PlainLink(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::AngleLink(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::OrgMacro(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Entity(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::LatexFragment(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::ExportSnippet(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::FootnoteReference(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Citation(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::CitationReference(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::InlineBabelCall(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::InlineSourceBlock(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::LineBreak(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Target(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::StatisticsCookie(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Subscript(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Superscript(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::TableCell(inner) => inner.compare_ast_node(source, emacs), - WasmAstNode::Timestamp(inner) => inner.compare_ast_node(source, emacs), - } - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDocument<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - let result = wasm_compare!( - source, - emacs, - self, - ( - EmacsField::Required(":path"), - |w| w.path.as_ref().and_then(|p| p.to_str()), - wasm_compare_property_quoted_string - ), - ( - EmacsField::Required(":CATEGORY"), - |w| w.category.as_ref(), - wasm_compare_property_quoted_string - ) - ); - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmHeadline<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSection<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - let result = wasm_compare!(source, emacs, self,); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmParagraph<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - let result = wasm_compare!(source, emacs, self,); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainList<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainListItem<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCenterBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmQuoteBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSpecialBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDynamicBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmFootnoteDefinition<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmComment<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDrawer<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPropertyDrawer<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmNodeProperty<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTable<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTableRow<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmVerseBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCommentBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmExampleBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmExportBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSrcBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmClock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDiarySexp<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlanning<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmFixedWidthArea<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmHorizontalRule<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmKeyword<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmBabelCall<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmLatexEnvironment<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmBold<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmItalic<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmUnderline<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmStrikeThrough<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCode<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmVerbatim<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainText<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmRegularLink<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmRadioLink<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmRadioTarget<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainLink<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmAngleLink<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmOrgMacro<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmEntity<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmLatexFragment<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmExportSnippet<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmFootnoteReference<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCitation<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCitationReference<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmInlineBabelCall<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmInlineSourceBlock<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmLineBreak<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTarget<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmStatisticsCookie<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSubscript<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSuperscript<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTableCell<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} - -impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTimestamp<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box> { - // TODO: Implement this. - let result = WasmDiffResult::default(); - // let result = wasm_compare!( - // source, - // emacs, - // self, - // ( - // EmacsField::Required(":path"), - // |w| w.path.as_ref().and_then(|p| p.to_str()), - // wasm_compare_property_quoted_string - // ), - // ( - // EmacsField::Required(":CATEGORY"), - // |w| w.category.as_ref(), - // wasm_compare_property_quoted_string - // ) - // ); - - Ok(result) - } -} +// pub fn old_wasm_compare_document<'b, 's, 'p>( +// source: &'s str, +// emacs: &'b Token<'s>, +// wasm: WasmDocument<'s, 'p>, +// ) -> Result, Box> { +// wasm.compare_ast_node(source, emacs) +// } + +// impl<'s, 'p, WAN: WasmElispCompare<'s, 'p>> WasmElispCompare<'s, 'p> for &WAN { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// (*self).compare_ast_node(source, emacs) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmAstNode<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// match self { +// WasmAstNode::Document(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Headline(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Section(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Paragraph(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::PlainList(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::PlainListItem(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::CenterBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::QuoteBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::SpecialBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::DynamicBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::FootnoteDefinition(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Comment(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Drawer(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::PropertyDrawer(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::NodeProperty(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Table(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::TableRow(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::VerseBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::CommentBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::ExampleBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::ExportBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::SrcBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Clock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::DiarySexp(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Planning(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::FixedWidthArea(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::HorizontalRule(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Keyword(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::BabelCall(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::LatexEnvironment(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Bold(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Italic(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Underline(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::StrikeThrough(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Code(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Verbatim(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::PlainText(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::RegularLink(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::RadioLink(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::RadioTarget(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::PlainLink(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::AngleLink(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::OrgMacro(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Entity(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::LatexFragment(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::ExportSnippet(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::FootnoteReference(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Citation(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::CitationReference(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::InlineBabelCall(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::InlineSourceBlock(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::LineBreak(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Target(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::StatisticsCookie(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Subscript(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Superscript(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::TableCell(inner) => inner.compare_ast_node(source, emacs), +// WasmAstNode::Timestamp(inner) => inner.compare_ast_node(source, emacs), +// } +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDocument<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// let result = wasm_compare!( +// source, +// emacs, +// self, +// ( +// EmacsField::Required(":path"), +// |w| w.path.as_ref().and_then(|p| p.to_str()), +// wasm_compare_property_quoted_string +// ), +// ( +// EmacsField::Required(":CATEGORY"), +// |w| w.category.as_ref(), +// wasm_compare_property_quoted_string +// ) +// ); +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmHeadline<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSection<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// let result = wasm_compare!(source, emacs, self,); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmParagraph<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// let result = wasm_compare!(source, emacs, self,); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainList<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainListItem<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCenterBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmQuoteBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSpecialBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDynamicBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmFootnoteDefinition<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmComment<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDrawer<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPropertyDrawer<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmNodeProperty<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTable<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTableRow<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmVerseBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCommentBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmExampleBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmExportBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSrcBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmClock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDiarySexp<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlanning<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmFixedWidthArea<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmHorizontalRule<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmKeyword<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmBabelCall<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmLatexEnvironment<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmBold<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmItalic<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmUnderline<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmStrikeThrough<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCode<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmVerbatim<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainText<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmRegularLink<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmRadioLink<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmRadioTarget<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainLink<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmAngleLink<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmOrgMacro<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmEntity<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmLatexFragment<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmExportSnippet<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmFootnoteReference<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCitation<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCitationReference<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmInlineBabelCall<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmInlineSourceBlock<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmLineBreak<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTarget<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmStatisticsCookie<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSubscript<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSuperscript<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTableCell<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } + +// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTimestamp<'s, 'p> { +// fn compare_ast_node<'b>( +// &self, +// source: &'s str, +// emacs: &'b Token<'s>, +// ) -> Result, Box> { +// // TODO: Implement this. +// let result = WasmDiffResult::default(); +// // let result = wasm_compare!( +// // source, +// // emacs, +// // self, +// // ( +// // EmacsField::Required(":path"), +// // |w| w.path.as_ref().and_then(|p| p.to_str()), +// // wasm_compare_property_quoted_string +// // ), +// // ( +// // EmacsField::Required(":CATEGORY"), +// // |w| w.category.as_ref(), +// // wasm_compare_property_quoted_string +// // ) +// // ); + +// Ok(result) +// } +// } diff --git a/src/wasm_test/elisp_compare.rs b/src/wasm_test/elisp_compare.rs deleted file mode 100644 index fc23b52..0000000 --- a/src/wasm_test/elisp_compare.rs +++ /dev/null @@ -1,10 +0,0 @@ -use super::diff::WasmDiffResult; -use crate::compare::Token; - -pub trait WasmElispCompare<'s, 'p> { - fn compare_ast_node<'b>( - &self, - source: &'s str, - emacs: &'b Token<'s>, - ) -> Result, Box>; -} diff --git a/src/wasm_test/logic.rs b/src/wasm_test/logic.rs index 29a460a..a8a73dd 100644 --- a/src/wasm_test/logic.rs +++ b/src/wasm_test/logic.rs @@ -1,6 +1,5 @@ use super::diff::WasmDiffResult; use super::diff::WasmDiffStatus; -use super::elisp_compare::WasmElispCompare; use crate::compare::get_emacs_standard_properties; use crate::compare::get_property; use crate::compare::get_property_quoted_string; @@ -10,378 +9,378 @@ use crate::wasm::AdditionalProperties; use crate::wasm::AdditionalPropertyValue; use crate::wasm::WasmStandardProperties; -pub(crate) fn wasm_compare_list<'b, 's: 'b, 'p, EI, WI, WC>( - source: &'s str, - emacs: EI, - wasm: WI, -) -> Result, Box> -where - EI: Iterator> + ExactSizeIterator, - WI: Iterator + ExactSizeIterator, - WC: WasmElispCompare<'s, 'p>, -{ - let status = Vec::new(); - let emacs_length = emacs.len(); - let wasm_length = wasm.len(); - if emacs_length != wasm_length { - return Ok(WasmDiffResult { - status: vec![WasmDiffStatus::Bad( - format!( - "Child length mismatch (emacs != rust) {:?} != {:?}", - emacs_length, wasm_length - ) - .into(), - )], - children: Vec::new(), - name: "".into(), - }); - } +// pub(crate) fn wasm_compare_list<'b, 's: 'b, 'p, EI, WI, WC>( +// source: &'s str, +// emacs: EI, +// wasm: WI, +// ) -> Result, Box> +// where +// EI: Iterator> + ExactSizeIterator, +// WI: Iterator + ExactSizeIterator, +// WC: WasmElispCompare<'s, 'p>, +// { +// let status = Vec::new(); +// let emacs_length = emacs.len(); +// let wasm_length = wasm.len(); +// if emacs_length != wasm_length { +// return Ok(WasmDiffResult { +// status: vec![WasmDiffStatus::Bad( +// format!( +// "Child length mismatch (emacs != rust) {:?} != {:?}", +// emacs_length, wasm_length +// ) +// .into(), +// )], +// children: Vec::new(), +// name: "".into(), +// }); +// } - let mut child_status = Vec::with_capacity(emacs_length); - for (emacs_child, wasm_child) in emacs.zip(wasm) { - child_status.push(wasm_child.compare_ast_node(source, emacs_child)?); - } - Ok(WasmDiffResult { - status, - children: child_status, - name: "".into(), - }) -} +// let mut child_status = Vec::with_capacity(emacs_length); +// for (emacs_child, wasm_child) in emacs.zip(wasm) { +// child_status.push(wasm_child.compare_ast_node(source, emacs_child)?); +// } +// Ok(WasmDiffResult { +// status, +// children: child_status, +// name: "".into(), +// }) +// } -pub(crate) fn wasm_compare_property_quoted_string< - 'b, - 's, - W, - WV: AsRef + std::fmt::Debug, - WG: Fn(W) -> Option, ->( - _source: &'s str, - emacs: &'b Token<'s>, - wasm_node: W, - emacs_field: &str, - wasm_value_getter: WG, -) -> Result, Box> { - let mut result = WasmDiffResult::default(); - let emacs_value = get_property_quoted_string(emacs, emacs_field)?; - let wasm_value = wasm_value_getter(wasm_node); - if wasm_value.as_ref().map(|s| s.as_ref()) != emacs_value.as_deref() { - result.status.push(WasmDiffStatus::Bad( - format!( - "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = emacs_field, - emacs = emacs_value, - wasm = wasm_value, - ) - .into(), - )) - } - Ok(result) -} +// pub(crate) fn wasm_compare_property_quoted_string< +// 'b, +// 's, +// W, +// WV: AsRef + std::fmt::Debug, +// WG: Fn(W) -> Option, +// >( +// _source: &'s str, +// emacs: &'b Token<'s>, +// wasm_node: W, +// emacs_field: &str, +// wasm_value_getter: WG, +// ) -> Result, Box> { +// let mut result = WasmDiffResult::default(); +// let emacs_value = get_property_quoted_string(emacs, emacs_field)?; +// let wasm_value = wasm_value_getter(wasm_node); +// if wasm_value.as_ref().map(|s| s.as_ref()) != emacs_value.as_deref() { +// result.status.push(WasmDiffStatus::Bad( +// format!( +// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = emacs_field, +// emacs = emacs_value, +// wasm = wasm_value, +// ) +// .into(), +// )) +// } +// Ok(result) +// } -pub(crate) fn wasm_compare_property_list_of_quoted_string< - 'b, - 's, - WI: Iterator + ExactSizeIterator, - W, - WV: AsRef + std::fmt::Debug, - WG: Fn(W) -> Option, ->( - _source: &'s str, - emacs: &'b Token<'s>, - wasm_node: W, - emacs_field: &str, - wasm_value_getter: WG, -) -> Result, Box> { - let mut result = WasmDiffResult::default(); - let emacs_value = get_property(emacs, emacs_field)? - .map(Token::as_list) - .map_or(Ok(None), |r| r.map(Some))?; - let wasm_value = wasm_value_getter(wasm_node); - match (emacs_value, wasm_value) { - (None, None) => {} - (None, Some(_)) | (Some(_), None) => { - return Ok(WasmDiffResult { - status: vec![WasmDiffStatus::Bad( - format!( - "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = emacs_field, - emacs = if emacs_value.is_some() {"Some"} else {"None"}, - wasm = if !emacs_value.is_some() {"Some"} else {"None"} - ) - .into(), - )], - children: Vec::new(), - name: "".into(), - }); - } - (Some(el), Some(wl)) if el.len() != wl.len() => { - return Ok(WasmDiffResult { - status: vec![WasmDiffStatus::Bad( - format!( - "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = emacs_field, - emacs = el.len(), - wasm = wl.len() - ) - .into(), - )], - children: Vec::new(), - name: "".into(), - }); - } - (Some(el), Some(wl)) => { - for (e, w) in el.iter().zip(wl) { - let e = unquote(e.as_atom()?)?; - let w = w.as_ref(); - if e != w { - result.status.push(WasmDiffStatus::Bad( - format!( - "Property list value mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = emacs_field, - emacs = e, - wasm = w - ) - .into(), - )); - } - } - } - }; +// pub(crate) fn wasm_compare_property_list_of_quoted_string< +// 'b, +// 's, +// WI: Iterator + ExactSizeIterator, +// W, +// WV: AsRef + std::fmt::Debug, +// WG: Fn(W) -> Option, +// >( +// _source: &'s str, +// emacs: &'b Token<'s>, +// wasm_node: W, +// emacs_field: &str, +// wasm_value_getter: WG, +// ) -> Result, Box> { +// let mut result = WasmDiffResult::default(); +// let emacs_value = get_property(emacs, emacs_field)? +// .map(Token::as_list) +// .map_or(Ok(None), |r| r.map(Some))?; +// let wasm_value = wasm_value_getter(wasm_node); +// match (emacs_value, wasm_value) { +// (None, None) => {} +// (None, Some(_)) | (Some(_), None) => { +// return Ok(WasmDiffResult { +// status: vec![WasmDiffStatus::Bad( +// format!( +// "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = emacs_field, +// emacs = if emacs_value.is_some() {"Some"} else {"None"}, +// wasm = if !emacs_value.is_some() {"Some"} else {"None"} +// ) +// .into(), +// )], +// children: Vec::new(), +// name: "".into(), +// }); +// } +// (Some(el), Some(wl)) if el.len() != wl.len() => { +// return Ok(WasmDiffResult { +// status: vec![WasmDiffStatus::Bad( +// format!( +// "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = emacs_field, +// emacs = el.len(), +// wasm = wl.len() +// ) +// .into(), +// )], +// children: Vec::new(), +// name: "".into(), +// }); +// } +// (Some(el), Some(wl)) => { +// for (e, w) in el.iter().zip(wl) { +// let e = unquote(e.as_atom()?)?; +// let w = w.as_ref(); +// if e != w { +// result.status.push(WasmDiffStatus::Bad( +// format!( +// "Property list value mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = emacs_field, +// emacs = e, +// wasm = w +// ) +// .into(), +// )); +// } +// } +// } +// }; - Ok(result) -} +// Ok(result) +// } -pub(crate) fn wasm_compare_property_optional_pair< - 'b, - 's, - W, - WV: AsRef + std::fmt::Debug, - WOV: AsRef + std::fmt::Debug, - WG: Fn(W) -> Option<(Option, WV)>, ->( - _source: &'s str, - emacs: &'b Token<'s>, - wasm_node: W, - emacs_field: &str, - wasm_value_getter: WG, -) -> Result, Box> { - let mut result = WasmDiffResult::default(); - let emacs_value = get_property(emacs, emacs_field)? - .map(Token::as_list) - .map_or(Ok(None), |r| r.map(Some))?; - let wasm_value = wasm_value_getter(wasm_node); - match (emacs_value, &wasm_value) { - (None, None) => {} - (None, Some(_)) | (Some(_), None) => { - return Ok(WasmDiffResult { - status: vec![WasmDiffStatus::Bad( - format!( - "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = emacs_field, - emacs = if emacs_value.is_some() {"Some"} else {"None"}, - wasm = if !emacs_value.is_some() {"Some"} else {"None"} - ) - .into(), - )], - children: Vec::new(), - name: "".into(), - }); - } - (Some(el), Some((Some(owl), wl))) if el.len() == 3 => { - let e = el - .first() - .map(Token::as_atom) - .map_or(Ok(None), |r| r.map(Some))? - .map(unquote) - .map_or(Ok(None), |r| r.map(Some))? - .expect("Above match proved length to be 3."); - let oe = el - .get(2) - .map(Token::as_atom) - .map_or(Ok(None), |r| r.map(Some))? - .map(unquote) - .map_or(Ok(None), |r| r.map(Some))? - .expect("Above match proved length to be 3."); - let w = wl.as_ref(); - let ow = owl.as_ref(); - if e != w { - result.status.push(WasmDiffStatus::Bad( - format!( - "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = "end", - emacs = e, - wasm = w, - ) - .into(), - )); - } - if oe != ow { - result.status.push(WasmDiffStatus::Bad( - format!( - "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = "end", - emacs = oe, - wasm = ow, - ) - .into(), - )); - } - } - (Some(el), Some((None, wl))) if el.len() == 1 => { - let e = el - .first() - .map(Token::as_atom) - .map_or(Ok(None), |r| r.map(Some))? - .map(unquote) - .map_or(Ok(None), |r| r.map(Some))? - .expect("Above match proved length to be 3."); - let w = wl.as_ref(); - if e != w { - result.status.push(WasmDiffStatus::Bad( - format!( - "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = "end", - emacs = e, - wasm = w, - ) - .into(), - )); - } - } - (Some(el), Some(_)) => { - return Ok(WasmDiffResult { - status: vec![WasmDiffStatus::Bad( - format!( - "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = emacs_field, - emacs = el.len(), - wasm = wasm_value - ) - .into(), - )], - children: Vec::new(), - name: "".into(), - }); - } - } - Ok(result) -} +// pub(crate) fn wasm_compare_property_optional_pair< +// 'b, +// 's, +// W, +// WV: AsRef + std::fmt::Debug, +// WOV: AsRef + std::fmt::Debug, +// WG: Fn(W) -> Option<(Option, WV)>, +// >( +// _source: &'s str, +// emacs: &'b Token<'s>, +// wasm_node: W, +// emacs_field: &str, +// wasm_value_getter: WG, +// ) -> Result, Box> { +// let mut result = WasmDiffResult::default(); +// let emacs_value = get_property(emacs, emacs_field)? +// .map(Token::as_list) +// .map_or(Ok(None), |r| r.map(Some))?; +// let wasm_value = wasm_value_getter(wasm_node); +// match (emacs_value, &wasm_value) { +// (None, None) => {} +// (None, Some(_)) | (Some(_), None) => { +// return Ok(WasmDiffResult { +// status: vec![WasmDiffStatus::Bad( +// format!( +// "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = emacs_field, +// emacs = if emacs_value.is_some() {"Some"} else {"None"}, +// wasm = if !emacs_value.is_some() {"Some"} else {"None"} +// ) +// .into(), +// )], +// children: Vec::new(), +// name: "".into(), +// }); +// } +// (Some(el), Some((Some(owl), wl))) if el.len() == 3 => { +// let e = el +// .first() +// .map(Token::as_atom) +// .map_or(Ok(None), |r| r.map(Some))? +// .map(unquote) +// .map_or(Ok(None), |r| r.map(Some))? +// .expect("Above match proved length to be 3."); +// let oe = el +// .get(2) +// .map(Token::as_atom) +// .map_or(Ok(None), |r| r.map(Some))? +// .map(unquote) +// .map_or(Ok(None), |r| r.map(Some))? +// .expect("Above match proved length to be 3."); +// let w = wl.as_ref(); +// let ow = owl.as_ref(); +// if e != w { +// result.status.push(WasmDiffStatus::Bad( +// format!( +// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = "end", +// emacs = e, +// wasm = w, +// ) +// .into(), +// )); +// } +// if oe != ow { +// result.status.push(WasmDiffStatus::Bad( +// format!( +// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = "end", +// emacs = oe, +// wasm = ow, +// ) +// .into(), +// )); +// } +// } +// (Some(el), Some((None, wl))) if el.len() == 1 => { +// let e = el +// .first() +// .map(Token::as_atom) +// .map_or(Ok(None), |r| r.map(Some))? +// .map(unquote) +// .map_or(Ok(None), |r| r.map(Some))? +// .expect("Above match proved length to be 3."); +// let w = wl.as_ref(); +// if e != w { +// result.status.push(WasmDiffStatus::Bad( +// format!( +// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = "end", +// emacs = e, +// wasm = w, +// ) +// .into(), +// )); +// } +// } +// (Some(el), Some(_)) => { +// return Ok(WasmDiffResult { +// status: vec![WasmDiffStatus::Bad( +// format!( +// "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = emacs_field, +// emacs = el.len(), +// wasm = wasm_value +// ) +// .into(), +// )], +// children: Vec::new(), +// name: "".into(), +// }); +// } +// } +// Ok(result) +// } -pub(crate) fn wasm_compare_standard_properties<'b, 's>( - _source: &'s str, - emacs: &'b Token<'s>, - wasm: &WasmStandardProperties, -) -> Result, Box> { - let mut result = WasmDiffResult::default(); - let mut layer = WasmDiffResult::default(); - layer.name = "standard-properties".into(); - let standard_properties = get_emacs_standard_properties(emacs)?; +// pub(crate) fn wasm_compare_standard_properties<'b, 's>( +// _source: &'s str, +// emacs: &'b Token<'s>, +// wasm: &WasmStandardProperties, +// ) -> Result, Box> { +// let mut result = WasmDiffResult::default(); +// let mut layer = WasmDiffResult::default(); +// layer.name = "standard-properties".into(); +// let standard_properties = get_emacs_standard_properties(emacs)?; - if Some(wasm.begin) != standard_properties.begin { - layer.status.push(WasmDiffStatus::Bad( - format!( - "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = "begin", - emacs = standard_properties.begin, - wasm = Some(wasm.begin), - ) - .into(), - )); - } - if Some(wasm.end) != standard_properties.end { - layer.status.push(WasmDiffStatus::Bad( - format!( - "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = "end", - emacs = standard_properties.end, - wasm = Some(wasm.end), - ) - .into(), - )); - } - if wasm.contents_begin != standard_properties.contents_begin { - layer.status.push(WasmDiffStatus::Bad( - format!( - "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = "contents-begin", - emacs = standard_properties.contents_begin, - wasm = wasm.contents_begin, - ) - .into(), - )); - } - if wasm.contents_end != standard_properties.contents_end { - layer.status.push(WasmDiffStatus::Bad( - format!( - "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = "contents-end", - emacs = standard_properties.contents_end, - wasm = wasm.contents_end, - ) - .into(), - )); - } - if Some(wasm.post_blank).map(|post_blank| post_blank as usize) != standard_properties.post_blank - { - layer.status.push(WasmDiffStatus::Bad( - format!( - "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", - property = "post-blank", - emacs = standard_properties.post_blank, - wasm = Some(wasm.post_blank), - ) - .into(), - )); - } +// if Some(wasm.begin) != standard_properties.begin { +// layer.status.push(WasmDiffStatus::Bad( +// format!( +// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = "begin", +// emacs = standard_properties.begin, +// wasm = Some(wasm.begin), +// ) +// .into(), +// )); +// } +// if Some(wasm.end) != standard_properties.end { +// layer.status.push(WasmDiffStatus::Bad( +// format!( +// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = "end", +// emacs = standard_properties.end, +// wasm = Some(wasm.end), +// ) +// .into(), +// )); +// } +// if wasm.contents_begin != standard_properties.contents_begin { +// layer.status.push(WasmDiffStatus::Bad( +// format!( +// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = "contents-begin", +// emacs = standard_properties.contents_begin, +// wasm = wasm.contents_begin, +// ) +// .into(), +// )); +// } +// if wasm.contents_end != standard_properties.contents_end { +// layer.status.push(WasmDiffStatus::Bad( +// format!( +// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = "contents-end", +// emacs = standard_properties.contents_end, +// wasm = wasm.contents_end, +// ) +// .into(), +// )); +// } +// if Some(wasm.post_blank).map(|post_blank| post_blank as usize) != standard_properties.post_blank +// { +// layer.status.push(WasmDiffStatus::Bad( +// format!( +// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", +// property = "post-blank", +// emacs = standard_properties.post_blank, +// wasm = Some(wasm.post_blank), +// ) +// .into(), +// )); +// } - result.children.push(layer); - Ok(result) -} +// result.children.push(layer); +// Ok(result) +// } -pub(crate) fn wasm_compare_additional_properties<'b, 's>( - source: &'s str, - emacs: &'b Token<'s>, - wasm: &AdditionalProperties<'_, '_>, -) -> Result, Box> { - let mut result = WasmDiffResult::default(); - let mut layer = WasmDiffResult::default(); - layer.name = "additional-properties".into(); +// pub(crate) fn wasm_compare_additional_properties<'b, 's>( +// source: &'s str, +// emacs: &'b Token<'s>, +// wasm: &AdditionalProperties<'_, '_>, +// ) -> Result, Box> { +// let mut result = WasmDiffResult::default(); +// let mut layer = WasmDiffResult::default(); +// layer.name = "additional-properties".into(); - for (property_name, property_value) in wasm.properties.iter() { - let emacs_property_name = format!(":{property_name}", property_name = property_name); - match property_value { - AdditionalPropertyValue::SingleString(wasm_value) => { - layer.extend(wasm_compare_property_quoted_string( - source, - emacs, - wasm, - &emacs_property_name, - |_| Some(wasm_value), - )?)?; - } - AdditionalPropertyValue::ListOfStrings(wasm_value) => { - layer.extend(wasm_compare_property_list_of_quoted_string( - source, - emacs, - wasm, - &emacs_property_name, - |_| Some(wasm_value.iter()), - )?)?; - } - // TODO: similar to compare_affiliated_keywords - AdditionalPropertyValue::OptionalPair { optval, val } => { - layer.extend(wasm_compare_property_optional_pair( - source, - emacs, - wasm, - &emacs_property_name, - |_| Some((*optval, *val)), - )?)?; - } - AdditionalPropertyValue::ObjectTree(_) => todo!(), - } - } +// for (property_name, property_value) in wasm.properties.iter() { +// let emacs_property_name = format!(":{property_name}", property_name = property_name); +// match property_value { +// AdditionalPropertyValue::SingleString(wasm_value) => { +// layer.extend(wasm_compare_property_quoted_string( +// source, +// emacs, +// wasm, +// &emacs_property_name, +// |_| Some(wasm_value), +// )?)?; +// } +// AdditionalPropertyValue::ListOfStrings(wasm_value) => { +// layer.extend(wasm_compare_property_list_of_quoted_string( +// source, +// emacs, +// wasm, +// &emacs_property_name, +// |_| Some(wasm_value.iter()), +// )?)?; +// } +// // TODO: similar to compare_affiliated_keywords +// AdditionalPropertyValue::OptionalPair { optval, val } => { +// layer.extend(wasm_compare_property_optional_pair( +// source, +// emacs, +// wasm, +// &emacs_property_name, +// |_| Some((*optval, *val)), +// )?)?; +// } +// AdditionalPropertyValue::ObjectTree(_) => todo!(), +// } +// } - result.children.push(layer); - Ok(result) -} +// result.children.push(layer); +// Ok(result) +// } diff --git a/src/wasm_test/mod.rs b/src/wasm_test/mod.rs index 7032539..a383bbc 100644 --- a/src/wasm_test/mod.rs +++ b/src/wasm_test/mod.rs @@ -1,6 +1,5 @@ mod compare; mod diff; -mod elisp_compare; mod logic; mod macros; mod runner; diff --git a/src/wasm_test/runner.rs b/src/wasm_test/runner.rs index c14f143..054137b 100644 --- a/src/wasm_test/runner.rs +++ b/src/wasm_test/runner.rs @@ -47,7 +47,7 @@ pub async fn wasm_run_anonymous_compare_with_settings<'g, 's, P: AsRef>( } // We do the diffing after printing out both parsed forms in case the diffing panics - let diff_result = wasm_compare_document(org_contents, &parsed_sexp, wasm_parsed)?; + let diff_result = wasm_compare_document(org_contents, &parsed_sexp, &wasm_parsed)?; if !silent { diff_result.print(org_contents)?; } @@ -112,7 +112,7 @@ pub async fn wasm_run_compare_on_file_with_settings<'g, 's, P: AsRef>( } // We do the diffing after printing out both parsed forms in case the diffing panics - let diff_result = wasm_compare_document(org_contents, &parsed_sexp, wasm_parsed)?; + let diff_result = wasm_compare_document(org_contents, &parsed_sexp, &wasm_parsed)?; if !silent { diff_result.print(org_contents)?; } From cad2be43bf3b7c93eb2e308ed9e704df48d40fc7 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 14:06:10 -0500 Subject: [PATCH 04/15] Implement a new to_wasm macro that uses the WasmAstNodeWrapper. --- src/wasm/ast_node.rs | 41 ++++++++++------------------- src/wasm/document.rs | 39 ++++++++-------------------- src/wasm/macros.rs | 61 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 55 deletions(-) diff --git a/src/wasm/ast_node.rs b/src/wasm/ast_node.rs index 69c98b4..79b365c 100644 --- a/src/wasm/ast_node.rs +++ b/src/wasm/ast_node.rs @@ -1,3 +1,5 @@ +use std::borrow::Cow; + use serde::Serialize; use super::angle_link::WasmAngleLink; @@ -58,39 +60,24 @@ use super::timestamp::WasmTimestamp; use super::underline::WasmUnderline; use super::verbatim::WasmVerbatim; use super::verse_block::WasmVerseBlock; +use super::WasmStandardProperties; -// #[derive(Debug, Serialize)] -// pub(crate) struct WasmAstWrapper<'b, 's, 'p, I> { -// #[serde(rename = "ast-node")] -// pub(crate) ast_node: Cow<'static, str>, -// #[serde(rename = "standard-properties")] -// pub(crate) standard_properties: WasmStandardProperties, -// #[serde(rename = "properties")] -// pub(crate) inner: I, -// pub(crate) children: &'b Vec>, -// } - -// impl<'b, 's, 'p, I> WasmAstWrapper<'b, 's, 'p, I> { -// pub(crate) fn new( -// ast_node: Cow<'s, str>, -// standard_properties: &'b WasmStandardProperties, -// inner: I, -// children: &'b Vec>, -// ) -> WasmAstWrapper<'b, 's, 'p, I> { -// WasmAstWrapper { -// ast_node, -// standard_properties, -// inner, -// children, -// } -// } -// } +#[derive(Debug, Serialize)] +pub struct WasmAstNodeWrapper { + pub(crate) ast_node: String, + #[serde(rename = "standard-properties")] + pub(crate) standard_properties: WasmStandardProperties, + #[serde(rename = "children")] + pub(crate) children: Vec, + #[serde(rename = "properties")] + pub(crate) properties: I, +} #[derive(Debug, Serialize)] #[serde(untagged)] pub enum WasmAstNode { // Document Nodes - Document(WasmDocument), + Document(WasmAstNodeWrapper), Headline(WasmHeadline), Section(WasmSection), // Elements diff --git a/src/wasm/document.rs b/src/wasm/document.rs index 48f6fb8..8235641 100644 --- a/src/wasm/document.rs +++ b/src/wasm/document.rs @@ -5,8 +5,8 @@ use serde::Serialize; use super::additional_property::AdditionalProperties; use super::additional_property::AdditionalPropertyValue; use super::ast_node::WasmAstNode; +use super::macros::new_to_wasm; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; #[cfg(feature = "wasm_test")] use crate::compare::ElispFact; @@ -14,26 +14,21 @@ use crate::types::Document; use crate::wasm::to_wasm::ToWasmStandardProperties; #[derive(Debug, Serialize)] -#[serde(tag = "__ast_node")] -#[serde(rename = "org-data")] pub struct WasmDocument { - #[serde(rename = "standard-properties")] - pub(crate) standard_properties: WasmStandardProperties, #[serde(flatten)] pub(crate) additional_properties: AdditionalProperties, - #[serde(rename = "__children")] - pub(crate) children: Vec, #[serde(rename = "CATEGORY")] pub(crate) category: Option, pub(crate) path: Option, } -to_wasm!( +new_to_wasm!( WasmDocument, Document<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Document(original) }, + { "org-data".into() }, { let category = original.category.as_ref().map(String::as_str); let path = original.path.clone(); @@ -63,25 +58,13 @@ to_wasm!( })) .collect::, _>>()?; - Ok(WasmDocument { - standard_properties, - additional_properties, + Ok(( children, - category: category.map(str::to_owned), - path, - }) + WasmDocument { + additional_properties, + category: category.map(str::to_owned), + path, + }, + )) } ); - -impl Into for WasmDocument { - fn into(self) -> WasmAstNode { - WasmAstNode::Document(self) - } -} - -#[cfg(feature = "wasm_test")] -impl<'s> ElispFact<'s> for WasmDocument { - fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> { - "org-data".into() - } -} diff --git a/src/wasm/macros.rs b/src/wasm/macros.rs index 8ed5021..60e986e 100644 --- a/src/wasm/macros.rs +++ b/src/wasm/macros.rs @@ -33,3 +33,64 @@ macro_rules! to_wasm { } pub(crate) use to_wasm; + +/// Write the implementation for the intermediate ast node. +/// +/// This exists to make changing the type signature easier. +macro_rules! new_to_wasm { + ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $fnbody:tt) => { + impl<'s> ToWasm for $istruct { + type Output = $ostruct; + + fn to_wasm( + &self, + $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, + ) -> Result { + let $original = self; + $fnbody + } + } + }; + ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $toastnodebody:tt, $elispnamebody:tt, $fnbody:tt) => { + impl<'s> ToWasm for $istruct { + type Output = crate::wasm::ast_node::WasmAstNodeWrapper<$ostruct>; + + fn to_wasm( + &self, + $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, + ) -> Result { + let $original = self; + let standard_properties = + self.to_wasm_standard_properties($wasm_context.clone())?; + + $fnbody.map( + |(children, inner)| crate::wasm::ast_node::WasmAstNodeWrapper { + ast_node: inner.get_elisp_name().into_owned(), + standard_properties, + children, + properties: inner, + }, + ) + } + } + + impl Into for crate::wasm::ast_node::WasmAstNodeWrapper<$ostruct> { + fn into(self) -> WasmAstNode { + let $original = self; + let ret = $toastnodebody; + ret + } + } + + #[cfg(feature = "wasm_test")] + impl<'s> ElispFact<'s> for $ostruct { + fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> { + let $original = self; + let ret = $elispnamebody; + ret + } + } + }; +} + +pub(crate) use new_to_wasm; From 579cbb5d113238b776bd15d33e2b1178db13c38e Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 15:03:36 -0500 Subject: [PATCH 05/15] Switch everything over to the new to_wasm macro. --- src/wasm/additional_property.rs | 5 +- src/wasm/angle_link.rs | 33 +++--- src/wasm/ast_node.rs | 121 ++++++++++--------- src/wasm/babel_call.rs | 33 +++--- src/wasm/bold.rs | 43 ++++--- src/wasm/center_block.rs | 43 ++++--- src/wasm/citation.rs | 43 ++++--- src/wasm/citation_reference.rs | 33 +++--- src/wasm/clock.rs | 33 +++--- src/wasm/code.rs | 33 +++--- src/wasm/comment.rs | 33 +++--- src/wasm/comment_block.rs | 33 +++--- src/wasm/diary_sexp.rs | 33 +++--- src/wasm/document.rs | 7 +- src/wasm/drawer.rs | 43 ++++--- src/wasm/dynamic_block.rs | 43 ++++--- src/wasm/entity.rs | 33 +++--- src/wasm/example_block.rs | 33 +++--- src/wasm/export_block.rs | 33 +++--- src/wasm/export_snippet.rs | 33 +++--- src/wasm/fixed_width_area.rs | 33 +++--- src/wasm/footnote_definition.rs | 43 ++++--- src/wasm/footnote_reference.rs | 33 +++--- src/wasm/headline.rs | 41 ++++--- src/wasm/horizontal_rule.rs | 33 +++--- src/wasm/inline_babel_call.rs | 33 +++--- src/wasm/inline_source_block.rs | 33 +++--- src/wasm/italic.rs | 43 ++++--- src/wasm/keyword.rs | 33 +++--- src/wasm/latex_environment.rs | 33 +++--- src/wasm/latex_fragment.rs | 33 +++--- src/wasm/line_break.rs | 33 +++--- src/wasm/macros.rs | 40 +------ src/wasm/mod.rs | 1 + src/wasm/node_property.rs | 27 +++-- src/wasm/org_macro.rs | 33 +++--- src/wasm/paragraph.rs | 36 ++---- src/wasm/parse_result.rs | 6 +- src/wasm/plain_link.rs | 33 +++--- src/wasm/plain_list.rs | 43 ++++--- src/wasm/plain_list_item.rs | 37 ++++-- src/wasm/plain_text.rs | 33 +++--- src/wasm/planning.rs | 33 +++--- src/wasm/property_drawer.rs | 43 ++++--- src/wasm/quote_block.rs | 43 ++++--- src/wasm/radio_link.rs | 43 ++++--- src/wasm/radio_target.rs | 43 ++++--- src/wasm/regular_link.rs | 43 ++++--- src/wasm/section.rs | 34 ++---- src/wasm/special_block.rs | 43 ++++--- src/wasm/src_block.rs | 33 +++--- src/wasm/standard_properties.rs | 3 +- src/wasm/statistics_cookie.rs | 33 +++--- src/wasm/strike_through.rs | 43 ++++--- src/wasm/subscript.rs | 43 ++++--- src/wasm/superscript.rs | 43 ++++--- src/wasm/table.rs | 43 ++++--- src/wasm/table_cell.rs | 37 ++++-- src/wasm/table_row.rs | 37 ++++-- src/wasm/target.rs | 33 +++--- src/wasm/timestamp.rs | 33 +++--- src/wasm/to_wasm.rs | 204 ++++++++++++++------------------ src/wasm/underline.rs | 43 ++++--- src/wasm/verbatim.rs | 33 +++--- src/wasm/verse_block.rs | 43 ++++--- src/wasm_test/compare.rs | 24 ++-- 66 files changed, 1258 insertions(+), 1252 deletions(-) diff --git a/src/wasm/additional_property.rs b/src/wasm/additional_property.rs index d5b1305..0584545 100644 --- a/src/wasm/additional_property.rs +++ b/src/wasm/additional_property.rs @@ -1,6 +1,7 @@ use std::borrow::Cow; use std::collections::HashMap; +use serde::Deserialize; use serde::Serialize; use super::macros::to_wasm; @@ -9,7 +10,7 @@ use super::WasmAstNode; use crate::types::AffiliatedKeywordValue; use crate::types::AffiliatedKeywords; -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(untagged)] pub enum AdditionalPropertyValue { SingleString(String), @@ -18,7 +19,7 @@ pub enum AdditionalPropertyValue { ObjectTree(Vec<(Option>, Vec)>), } -#[derive(Debug, Serialize, Default)] +#[derive(Debug, Serialize, Deserialize, Default)] pub struct AdditionalProperties { #[serde(flatten)] pub(crate) properties: HashMap, diff --git a/src/wasm/angle_link.rs b/src/wasm/angle_link.rs index 46da241..bb100eb 100644 --- a/src/wasm/angle_link.rs +++ b/src/wasm/angle_link.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::AngleLink; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmAngleLink { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( AngleLink<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::AngleLink(original) }, + { "TODO".into() }, { - Ok(WasmAngleLink { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmAngleLink { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmAngleLink { - fn into(self) -> WasmAstNode { - WasmAstNode::AngleLink(self) - } -} diff --git a/src/wasm/ast_node.rs b/src/wasm/ast_node.rs index 79b365c..218e8e3 100644 --- a/src/wasm/ast_node.rs +++ b/src/wasm/ast_node.rs @@ -1,5 +1,4 @@ -use std::borrow::Cow; - +use serde::Deserialize; use serde::Serialize; use super::angle_link::WasmAngleLink; @@ -62,7 +61,7 @@ use super::verbatim::WasmVerbatim; use super::verse_block::WasmVerseBlock; use super::WasmStandardProperties; -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmAstNodeWrapper { pub(crate) ast_node: String, #[serde(rename = "standard-properties")] @@ -73,70 +72,70 @@ pub struct WasmAstNodeWrapper { pub(crate) properties: I, } -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(untagged)] pub enum WasmAstNode { // Document Nodes Document(WasmAstNodeWrapper), - Headline(WasmHeadline), - Section(WasmSection), + Headline(WasmAstNodeWrapper), + Section(WasmAstNodeWrapper), // Elements - Paragraph(WasmParagraph), - PlainList(WasmPlainList), - PlainListItem(WasmPlainListItem), - CenterBlock(WasmCenterBlock), - QuoteBlock(WasmQuoteBlock), - SpecialBlock(WasmSpecialBlock), - DynamicBlock(WasmDynamicBlock), - FootnoteDefinition(WasmFootnoteDefinition), - Comment(WasmComment), - Drawer(WasmDrawer), - PropertyDrawer(WasmPropertyDrawer), - NodeProperty(WasmNodeProperty), - Table(WasmTable), - TableRow(WasmTableRow), - VerseBlock(WasmVerseBlock), - CommentBlock(WasmCommentBlock), - ExampleBlock(WasmExampleBlock), - ExportBlock(WasmExportBlock), - SrcBlock(WasmSrcBlock), - Clock(WasmClock), - DiarySexp(WasmDiarySexp), - Planning(WasmPlanning), - FixedWidthArea(WasmFixedWidthArea), - HorizontalRule(WasmHorizontalRule), - Keyword(WasmKeyword), - BabelCall(WasmBabelCall), - LatexEnvironment(WasmLatexEnvironment), + Paragraph(WasmAstNodeWrapper), + PlainList(WasmAstNodeWrapper), + PlainListItem(WasmAstNodeWrapper), + CenterBlock(WasmAstNodeWrapper), + QuoteBlock(WasmAstNodeWrapper), + SpecialBlock(WasmAstNodeWrapper), + DynamicBlock(WasmAstNodeWrapper), + FootnoteDefinition(WasmAstNodeWrapper), + Comment(WasmAstNodeWrapper), + Drawer(WasmAstNodeWrapper), + PropertyDrawer(WasmAstNodeWrapper), + NodeProperty(WasmAstNodeWrapper), + Table(WasmAstNodeWrapper), + TableRow(WasmAstNodeWrapper), + VerseBlock(WasmAstNodeWrapper), + CommentBlock(WasmAstNodeWrapper), + ExampleBlock(WasmAstNodeWrapper), + ExportBlock(WasmAstNodeWrapper), + SrcBlock(WasmAstNodeWrapper), + Clock(WasmAstNodeWrapper), + DiarySexp(WasmAstNodeWrapper), + Planning(WasmAstNodeWrapper), + FixedWidthArea(WasmAstNodeWrapper), + HorizontalRule(WasmAstNodeWrapper), + Keyword(WasmAstNodeWrapper), + BabelCall(WasmAstNodeWrapper), + LatexEnvironment(WasmAstNodeWrapper), // Objects - Bold(WasmBold), - Italic(WasmItalic), - Underline(WasmUnderline), - StrikeThrough(WasmStrikeThrough), - Code(WasmCode), - Verbatim(WasmVerbatim), - PlainText(WasmPlainText), - RegularLink(WasmRegularLink), - RadioLink(WasmRadioLink), - RadioTarget(WasmRadioTarget), - PlainLink(WasmPlainLink), - AngleLink(WasmAngleLink), - OrgMacro(WasmOrgMacro), - Entity(WasmEntity), - LatexFragment(WasmLatexFragment), - ExportSnippet(WasmExportSnippet), - FootnoteReference(WasmFootnoteReference), - Citation(WasmCitation), - CitationReference(WasmCitationReference), - InlineBabelCall(WasmInlineBabelCall), - InlineSourceBlock(WasmInlineSourceBlock), - LineBreak(WasmLineBreak), - Target(WasmTarget), - StatisticsCookie(WasmStatisticsCookie), - Subscript(WasmSubscript), - Superscript(WasmSuperscript), - TableCell(WasmTableCell), - Timestamp(WasmTimestamp), + Bold(WasmAstNodeWrapper), + Italic(WasmAstNodeWrapper), + Underline(WasmAstNodeWrapper), + StrikeThrough(WasmAstNodeWrapper), + Code(WasmAstNodeWrapper), + Verbatim(WasmAstNodeWrapper), + PlainText(WasmAstNodeWrapper), + RegularLink(WasmAstNodeWrapper), + RadioLink(WasmAstNodeWrapper), + RadioTarget(WasmAstNodeWrapper), + PlainLink(WasmAstNodeWrapper), + AngleLink(WasmAstNodeWrapper), + OrgMacro(WasmAstNodeWrapper), + Entity(WasmAstNodeWrapper), + LatexFragment(WasmAstNodeWrapper), + ExportSnippet(WasmAstNodeWrapper), + FootnoteReference(WasmAstNodeWrapper), + Citation(WasmAstNodeWrapper), + CitationReference(WasmAstNodeWrapper), + InlineBabelCall(WasmAstNodeWrapper), + InlineSourceBlock(WasmAstNodeWrapper), + LineBreak(WasmAstNodeWrapper), + Target(WasmAstNodeWrapper), + StatisticsCookie(WasmAstNodeWrapper), + Subscript(WasmAstNodeWrapper), + Superscript(WasmAstNodeWrapper), + TableCell(WasmAstNodeWrapper), + Timestamp(WasmAstNodeWrapper), } impl WasmAstNode {} diff --git a/src/wasm/babel_call.rs b/src/wasm/babel_call.rs index f3825c9..56746f7 100644 --- a/src/wasm/babel_call.rs +++ b/src/wasm/babel_call.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::BabelCall; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmBabelCall { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( BabelCall<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::BabelCall(original) }, + { "TODO".into() }, { - Ok(WasmBabelCall { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmBabelCall { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmBabelCall { - fn into(self) -> WasmAstNode { - WasmAstNode::BabelCall(self) - } -} diff --git a/src/wasm/bold.rs b/src/wasm/bold.rs index 0180023..9ca857b 100644 --- a/src/wasm/bold.rs +++ b/src/wasm/bold.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Bold; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmBold { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( Bold<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Bold(original) }, + { "TODO".into() }, { - Ok(WasmBold { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmBold { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmBold { - fn into(self) -> WasmAstNode { - WasmAstNode::Bold(self) - } -} diff --git a/src/wasm/center_block.rs b/src/wasm/center_block.rs index a488bf5..9895e80 100644 --- a/src/wasm/center_block.rs +++ b/src/wasm/center_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::CenterBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmCenterBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( CenterBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::CenterBlock(original) }, + { "TODO".into() }, { - Ok(WasmCenterBlock { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmCenterBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmCenterBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::CenterBlock(self) - } -} diff --git a/src/wasm/citation.rs b/src/wasm/citation.rs index 06f5761..a92b73c 100644 --- a/src/wasm/citation.rs +++ b/src/wasm/citation.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Citation; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmCitation { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( Citation<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Citation(original) }, + { "TODO".into() }, { - Ok(WasmCitation { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmCitation { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmCitation { - fn into(self) -> WasmAstNode { - WasmAstNode::Citation(self) - } -} diff --git a/src/wasm/citation_reference.rs b/src/wasm/citation_reference.rs index dbb32fe..bb9e18f 100644 --- a/src/wasm/citation_reference.rs +++ b/src/wasm/citation_reference.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::CitationReference; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmCitationReference { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( CitationReference<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::CitationReference(original) }, + { "TODO".into() }, { - Ok(WasmCitationReference { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmCitationReference { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmCitationReference { - fn into(self) -> WasmAstNode { - WasmAstNode::CitationReference(self) - } -} diff --git a/src/wasm/clock.rs b/src/wasm/clock.rs index a24df30..acc2e78 100644 --- a/src/wasm/clock.rs +++ b/src/wasm/clock.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Clock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmClock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( Clock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Clock(original) }, + { "TODO".into() }, { - Ok(WasmClock { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmClock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmClock { - fn into(self) -> WasmAstNode { - WasmAstNode::Clock(self) - } -} diff --git a/src/wasm/code.rs b/src/wasm/code.rs index e8456b3..e191116 100644 --- a/src/wasm/code.rs +++ b/src/wasm/code.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Code; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmCode { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( Code<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Code(original) }, + { "TODO".into() }, { - Ok(WasmCode { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmCode { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmCode { - fn into(self) -> WasmAstNode { - WasmAstNode::Code(self) - } -} diff --git a/src/wasm/comment.rs b/src/wasm/comment.rs index c9cf266..c73f138 100644 --- a/src/wasm/comment.rs +++ b/src/wasm/comment.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Comment; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmComment { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( Comment<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Comment(original) }, + { "TODO".into() }, { - Ok(WasmComment { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmComment { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmComment { - fn into(self) -> WasmAstNode { - WasmAstNode::Comment(self) - } -} diff --git a/src/wasm/comment_block.rs b/src/wasm/comment_block.rs index c39c505..a04c593 100644 --- a/src/wasm/comment_block.rs +++ b/src/wasm/comment_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::CommentBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmCommentBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( CommentBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::CommentBlock(original) }, + { "TODO".into() }, { - Ok(WasmCommentBlock { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmCommentBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmCommentBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::CommentBlock(self) - } -} diff --git a/src/wasm/diary_sexp.rs b/src/wasm/diary_sexp.rs index 14fbe18..7029077 100644 --- a/src/wasm/diary_sexp.rs +++ b/src/wasm/diary_sexp.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::DiarySexp; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmDiarySexp { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( DiarySexp<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::DiarySexp(original) }, + { "TODO".into() }, { - Ok(WasmDiarySexp { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmDiarySexp { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmDiarySexp { - fn into(self) -> WasmAstNode { - WasmAstNode::DiarySexp(self) - } -} diff --git a/src/wasm/document.rs b/src/wasm/document.rs index 8235641..dc75c0e 100644 --- a/src/wasm/document.rs +++ b/src/wasm/document.rs @@ -1,19 +1,18 @@ use std::path::PathBuf; +use serde::Deserialize; use serde::Serialize; use super::additional_property::AdditionalProperties; use super::additional_property::AdditionalPropertyValue; use super::ast_node::WasmAstNode; -use super::macros::new_to_wasm; use super::macros::to_wasm; use super::to_wasm::ToWasm; -#[cfg(feature = "wasm_test")] use crate::compare::ElispFact; use crate::types::Document; use crate::wasm::to_wasm::ToWasmStandardProperties; -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmDocument { #[serde(flatten)] pub(crate) additional_properties: AdditionalProperties, @@ -22,7 +21,7 @@ pub struct WasmDocument { pub(crate) path: Option, } -new_to_wasm!( +to_wasm!( WasmDocument, Document<'s>, original, diff --git a/src/wasm/drawer.rs b/src/wasm/drawer.rs index 3519655..b76292d 100644 --- a/src/wasm/drawer.rs +++ b/src/wasm/drawer.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Drawer; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmDrawer { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( Drawer<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Drawer(original) }, + { "TODO".into() }, { - Ok(WasmDrawer { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmDrawer { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmDrawer { - fn into(self) -> WasmAstNode { - WasmAstNode::Drawer(self) - } -} diff --git a/src/wasm/dynamic_block.rs b/src/wasm/dynamic_block.rs index af32287..3b4f1ac 100644 --- a/src/wasm/dynamic_block.rs +++ b/src/wasm/dynamic_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::DynamicBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmDynamicBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( DynamicBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::DynamicBlock(original) }, + { "TODO".into() }, { - Ok(WasmDynamicBlock { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmDynamicBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmDynamicBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::DynamicBlock(self) - } -} diff --git a/src/wasm/entity.rs b/src/wasm/entity.rs index 3a9ea0b..112e0e4 100644 --- a/src/wasm/entity.rs +++ b/src/wasm/entity.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Entity; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmEntity { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( Entity<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Entity(original) }, + { "TODO".into() }, { - Ok(WasmEntity { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmEntity { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmEntity { - fn into(self) -> WasmAstNode { - WasmAstNode::Entity(self) - } -} diff --git a/src/wasm/example_block.rs b/src/wasm/example_block.rs index c0aa7b5..7c3fb9c 100644 --- a/src/wasm/example_block.rs +++ b/src/wasm/example_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::ExampleBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmExampleBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( ExampleBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::ExampleBlock(original) }, + { "TODO".into() }, { - Ok(WasmExampleBlock { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmExampleBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmExampleBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::ExampleBlock(self) - } -} diff --git a/src/wasm/export_block.rs b/src/wasm/export_block.rs index 75d99e2..3fe8828 100644 --- a/src/wasm/export_block.rs +++ b/src/wasm/export_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::ExportBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmExportBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( ExportBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::ExportBlock(original) }, + { "TODO".into() }, { - Ok(WasmExportBlock { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmExportBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmExportBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::ExportBlock(self) - } -} diff --git a/src/wasm/export_snippet.rs b/src/wasm/export_snippet.rs index 49ae0c3..ef03374 100644 --- a/src/wasm/export_snippet.rs +++ b/src/wasm/export_snippet.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::ExportSnippet; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmExportSnippet { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( ExportSnippet<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::ExportSnippet(original) }, + { "TODO".into() }, { - Ok(WasmExportSnippet { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmExportSnippet { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmExportSnippet { - fn into(self) -> WasmAstNode { - WasmAstNode::ExportSnippet(self) - } -} diff --git a/src/wasm/fixed_width_area.rs b/src/wasm/fixed_width_area.rs index 3331ba2..8c29e8f 100644 --- a/src/wasm/fixed_width_area.rs +++ b/src/wasm/fixed_width_area.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::FixedWidthArea; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmFixedWidthArea { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( FixedWidthArea<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::FixedWidthArea(original) }, + { "TODO".into() }, { - Ok(WasmFixedWidthArea { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmFixedWidthArea { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmFixedWidthArea { - fn into(self) -> WasmAstNode { - WasmAstNode::FixedWidthArea(self) - } -} diff --git a/src/wasm/footnote_definition.rs b/src/wasm/footnote_definition.rs index 47c6197..8b54427 100644 --- a/src/wasm/footnote_definition.rs +++ b/src/wasm/footnote_definition.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::FootnoteDefinition; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmFootnoteDefinition { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( FootnoteDefinition<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::FootnoteDefinition(original) }, + { "TODO".into() }, { - Ok(WasmFootnoteDefinition { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmFootnoteDefinition { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmFootnoteDefinition { - fn into(self) -> WasmAstNode { - WasmAstNode::FootnoteDefinition(self) - } -} diff --git a/src/wasm/footnote_reference.rs b/src/wasm/footnote_reference.rs index 74b9f25..6b023ae 100644 --- a/src/wasm/footnote_reference.rs +++ b/src/wasm/footnote_reference.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::FootnoteReference; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmFootnoteReference { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( FootnoteReference<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::FootnoteReference(original) }, + { "TODO".into() }, { - Ok(WasmFootnoteReference { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmFootnoteReference { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmFootnoteReference { - fn into(self) -> WasmAstNode { - WasmAstNode::FootnoteReference(self) - } -} diff --git a/src/wasm/headline.rs b/src/wasm/headline.rs index fc0f20e..bd803f4 100644 --- a/src/wasm/headline.rs +++ b/src/wasm/headline.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Heading; use crate::wasm::to_wasm::ToWasmStandardProperties; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "headline")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmHeadline { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( Heading<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Headline(original) }, + { "TODO".into() }, { - Ok(WasmHeadline { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmHeadline { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmHeadline { - fn into(self) -> WasmAstNode { - WasmAstNode::Headline(self) - } -} diff --git a/src/wasm/horizontal_rule.rs b/src/wasm/horizontal_rule.rs index d710fc6..0103cf6 100644 --- a/src/wasm/horizontal_rule.rs +++ b/src/wasm/horizontal_rule.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::HorizontalRule; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmHorizontalRule { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( HorizontalRule<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::HorizontalRule(original) }, + { "TODO".into() }, { - Ok(WasmHorizontalRule { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmHorizontalRule { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmHorizontalRule { - fn into(self) -> WasmAstNode { - WasmAstNode::HorizontalRule(self) - } -} diff --git a/src/wasm/inline_babel_call.rs b/src/wasm/inline_babel_call.rs index 53f2a8d..036efdb 100644 --- a/src/wasm/inline_babel_call.rs +++ b/src/wasm/inline_babel_call.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::InlineBabelCall; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmInlineBabelCall { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( InlineBabelCall<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::InlineBabelCall(original) }, + { "TODO".into() }, { - Ok(WasmInlineBabelCall { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmInlineBabelCall { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmInlineBabelCall { - fn into(self) -> WasmAstNode { - WasmAstNode::InlineBabelCall(self) - } -} diff --git a/src/wasm/inline_source_block.rs b/src/wasm/inline_source_block.rs index 60d5f00..b560ceb 100644 --- a/src/wasm/inline_source_block.rs +++ b/src/wasm/inline_source_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::InlineSourceBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmInlineSourceBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( InlineSourceBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::InlineSourceBlock(original) }, + { "TODO".into() }, { - Ok(WasmInlineSourceBlock { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmInlineSourceBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmInlineSourceBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::InlineSourceBlock(self) - } -} diff --git a/src/wasm/italic.rs b/src/wasm/italic.rs index b8f5091..e38854e 100644 --- a/src/wasm/italic.rs +++ b/src/wasm/italic.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Italic; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmItalic { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( Italic<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Italic(original) }, + { "TODO".into() }, { - Ok(WasmItalic { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmItalic { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmItalic { - fn into(self) -> WasmAstNode { - WasmAstNode::Italic(self) - } -} diff --git a/src/wasm/keyword.rs b/src/wasm/keyword.rs index 370b6ce..289bbc4 100644 --- a/src/wasm/keyword.rs +++ b/src/wasm/keyword.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Keyword; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmKeyword { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( Keyword<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Keyword(original) }, + { "TODO".into() }, { - Ok(WasmKeyword { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmKeyword { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmKeyword { - fn into(self) -> WasmAstNode { - WasmAstNode::Keyword(self) - } -} diff --git a/src/wasm/latex_environment.rs b/src/wasm/latex_environment.rs index 2e4cb70..8c002dd 100644 --- a/src/wasm/latex_environment.rs +++ b/src/wasm/latex_environment.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::LatexEnvironment; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmLatexEnvironment { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( LatexEnvironment<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::LatexEnvironment(original) }, + { "TODO".into() }, { - Ok(WasmLatexEnvironment { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmLatexEnvironment { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmLatexEnvironment { - fn into(self) -> WasmAstNode { - WasmAstNode::LatexEnvironment(self) - } -} diff --git a/src/wasm/latex_fragment.rs b/src/wasm/latex_fragment.rs index a1619c3..47d3f99 100644 --- a/src/wasm/latex_fragment.rs +++ b/src/wasm/latex_fragment.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::LatexFragment; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmLatexFragment { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( LatexFragment<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::LatexFragment(original) }, + { "TODO".into() }, { - Ok(WasmLatexFragment { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmLatexFragment { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmLatexFragment { - fn into(self) -> WasmAstNode { - WasmAstNode::LatexFragment(self) - } -} diff --git a/src/wasm/line_break.rs b/src/wasm/line_break.rs index aed5d03..4d158c7 100644 --- a/src/wasm/line_break.rs +++ b/src/wasm/line_break.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::LineBreak; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmLineBreak { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( LineBreak<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::LineBreak(original) }, + { "TODO".into() }, { - Ok(WasmLineBreak { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmLineBreak { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmLineBreak { - fn into(self) -> WasmAstNode { - WasmAstNode::LineBreak(self) - } -} diff --git a/src/wasm/macros.rs b/src/wasm/macros.rs index 60e986e..daf1360 100644 --- a/src/wasm/macros.rs +++ b/src/wasm/macros.rs @@ -2,42 +2,6 @@ /// /// This exists to make changing the type signature easier. macro_rules! to_wasm { - ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $fnbody:tt) => { - impl<'s> ToWasm for $istruct { - type Output = $ostruct; - - fn to_wasm( - &self, - $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, - ) -> Result { - let $original = self; - $fnbody - } - } - }; - ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => { - impl<'s> ToWasm for $istruct { - type Output = $ostruct; - - fn to_wasm( - &self, - $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, - ) -> Result { - let $original = self; - let $standard_properties = - self.to_wasm_standard_properties($wasm_context.clone())?; - $fnbody - } - } - }; -} - -pub(crate) use to_wasm; - -/// Write the implementation for the intermediate ast node. -/// -/// This exists to make changing the type signature easier. -macro_rules! new_to_wasm { ($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $fnbody:tt) => { impl<'s> ToWasm for $istruct { type Output = $ostruct; @@ -83,7 +47,7 @@ macro_rules! new_to_wasm { } #[cfg(feature = "wasm_test")] - impl<'s> ElispFact<'s> for $ostruct { + impl<'s> crate::compare::ElispFact<'s> for $ostruct { fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> { let $original = self; let ret = $elispnamebody; @@ -93,4 +57,4 @@ macro_rules! new_to_wasm { }; } -pub(crate) use new_to_wasm; +pub(crate) use to_wasm; diff --git a/src/wasm/mod.rs b/src/wasm/mod.rs index 5eb1b9b..fa504dd 100644 --- a/src/wasm/mod.rs +++ b/src/wasm/mod.rs @@ -67,6 +67,7 @@ pub use additional_property::AdditionalProperties; pub use additional_property::AdditionalPropertyValue; pub(crate) use angle_link::WasmAngleLink; pub use ast_node::WasmAstNode; +pub use ast_node::WasmAstNodeWrapper; pub(crate) use babel_call::WasmBabelCall; pub(crate) use bold::WasmBold; pub(crate) use center_block::WasmCenterBlock; diff --git a/src/wasm/node_property.rs b/src/wasm/node_property.rs index c5c7242..2fa3595 100644 --- a/src/wasm/node_property.rs +++ b/src/wasm/node_property.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::NodeProperty; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmNodeProperty { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,11 +20,14 @@ to_wasm!( NodeProperty<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::NodeProperty(original) }, + { "TODO".into() }, { - Ok(WasmNodeProperty { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmNodeProperty { + additional_properties: AdditionalProperties::default(), + }, + )) } ); diff --git a/src/wasm/org_macro.rs b/src/wasm/org_macro.rs index 6be58c9..46fbc38 100644 --- a/src/wasm/org_macro.rs +++ b/src/wasm/org_macro.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::OrgMacro; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmOrgMacro { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( OrgMacro<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::OrgMacro(original) }, + { "TODO".into() }, { - Ok(WasmOrgMacro { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmOrgMacro { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmOrgMacro { - fn into(self) -> WasmAstNode { - WasmAstNode::OrgMacro(self) - } -} diff --git a/src/wasm/paragraph.rs b/src/wasm/paragraph.rs index 2113f6a..5d253d5 100644 --- a/src/wasm/paragraph.rs +++ b/src/wasm/paragraph.rs @@ -1,24 +1,19 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; use super::AdditionalProperties; -#[cfg(feature = "wasm_test")] use crate::compare::ElispFact; use crate::types::GetAffiliatedKeywords; use crate::types::Paragraph; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "paragraph")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmParagraph { - pub(crate) standard_properties: WasmStandardProperties, #[serde(flatten)] pub(crate) additional_properties: AdditionalProperties, - pub(crate) children: Vec, } to_wasm!( @@ -26,7 +21,8 @@ to_wasm!( Paragraph<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Paragraph(original) }, + { "paragraph".into() }, { let additional_properties = original .get_affiliated_keywords() @@ -42,23 +38,11 @@ to_wasm!( }) .collect::, _>>()?; - Ok(WasmParagraph { - standard_properties, - additional_properties, + Ok(( children, - }) + WasmParagraph { + additional_properties, + }, + )) } ); - -impl Into for WasmParagraph { - fn into(self) -> WasmAstNode { - WasmAstNode::Paragraph(self) - } -} - -#[cfg(feature = "wasm_test")] -impl<'s> ElispFact<'s> for WasmParagraph { - fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> { - "paragraph".into() - } -} diff --git a/src/wasm/parse_result.rs b/src/wasm/parse_result.rs index 4dfcd8c..33ab251 100644 --- a/src/wasm/parse_result.rs +++ b/src/wasm/parse_result.rs @@ -1,12 +1,14 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNodeWrapper; use super::document::WasmDocument; -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Deserialize)] #[serde(tag = "status", content = "content")] pub enum ParseResult { #[serde(rename = "success")] - Success(WasmDocument), + Success(WasmAstNodeWrapper), #[serde(rename = "error")] Error(String), diff --git a/src/wasm/plain_link.rs b/src/wasm/plain_link.rs index 0676adf..fbb76f7 100644 --- a/src/wasm/plain_link.rs +++ b/src/wasm/plain_link.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::PlainLink; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmPlainLink { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( PlainLink<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::PlainLink(original) }, + { "TODO".into() }, { - Ok(WasmPlainLink { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmPlainLink { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmPlainLink { - fn into(self) -> WasmAstNode { - WasmAstNode::PlainLink(self) - } -} diff --git a/src/wasm/plain_list.rs b/src/wasm/plain_list.rs index 3f8dbfa..a560951 100644 --- a/src/wasm/plain_list.rs +++ b/src/wasm/plain_list.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::PlainList; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmPlainList { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( PlainList<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::PlainList(original) }, + { "TODO".into() }, { - Ok(WasmPlainList { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmPlainList { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmPlainList { - fn into(self) -> WasmAstNode { - WasmAstNode::PlainList(self) - } -} diff --git a/src/wasm/plain_list_item.rs b/src/wasm/plain_list_item.rs index 3ca9153..2bf6174 100644 --- a/src/wasm/plain_list_item.rs +++ b/src/wasm/plain_list_item.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::PlainListItem; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmPlainListItem { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,11 +20,24 @@ to_wasm!( PlainListItem<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::PlainListItem(original) }, + { "TODO".into() }, { - Ok(WasmPlainListItem { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmPlainListItem { + additional_properties: AdditionalProperties::default(), + }, + )) } ); diff --git a/src/wasm/plain_text.rs b/src/wasm/plain_text.rs index eda86ad..8681230 100644 --- a/src/wasm/plain_text.rs +++ b/src/wasm/plain_text.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::PlainText; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmPlainText { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( PlainText<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::PlainText(original) }, + { "TODO".into() }, { - Ok(WasmPlainText { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmPlainText { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmPlainText { - fn into(self) -> WasmAstNode { - WasmAstNode::PlainText(self) - } -} diff --git a/src/wasm/planning.rs b/src/wasm/planning.rs index 551aec7..36e8537 100644 --- a/src/wasm/planning.rs +++ b/src/wasm/planning.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Planning; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmPlanning { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( Planning<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Planning(original) }, + { "TODO".into() }, { - Ok(WasmPlanning { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmPlanning { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmPlanning { - fn into(self) -> WasmAstNode { - WasmAstNode::Planning(self) - } -} diff --git a/src/wasm/property_drawer.rs b/src/wasm/property_drawer.rs index 6d2462d..fd67b30 100644 --- a/src/wasm/property_drawer.rs +++ b/src/wasm/property_drawer.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::PropertyDrawer; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmPropertyDrawer { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( PropertyDrawer<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::PropertyDrawer(original) }, + { "TODO".into() }, { - Ok(WasmPropertyDrawer { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmPropertyDrawer { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmPropertyDrawer { - fn into(self) -> WasmAstNode { - WasmAstNode::PropertyDrawer(self) - } -} diff --git a/src/wasm/quote_block.rs b/src/wasm/quote_block.rs index 8ab493c..39a9071 100644 --- a/src/wasm/quote_block.rs +++ b/src/wasm/quote_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::QuoteBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmQuoteBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( QuoteBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::QuoteBlock(original) }, + { "TODO".into() }, { - Ok(WasmQuoteBlock { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmQuoteBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmQuoteBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::QuoteBlock(self) - } -} diff --git a/src/wasm/radio_link.rs b/src/wasm/radio_link.rs index 12650d3..f217af7 100644 --- a/src/wasm/radio_link.rs +++ b/src/wasm/radio_link.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::RadioLink; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmRadioLink { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( RadioLink<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::RadioLink(original) }, + { "TODO".into() }, { - Ok(WasmRadioLink { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmRadioLink { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmRadioLink { - fn into(self) -> WasmAstNode { - WasmAstNode::RadioLink(self) - } -} diff --git a/src/wasm/radio_target.rs b/src/wasm/radio_target.rs index 7086b10..927d876 100644 --- a/src/wasm/radio_target.rs +++ b/src/wasm/radio_target.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::RadioTarget; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmRadioTarget { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( RadioTarget<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::RadioTarget(original) }, + { "TODO".into() }, { - Ok(WasmRadioTarget { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmRadioTarget { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmRadioTarget { - fn into(self) -> WasmAstNode { - WasmAstNode::RadioTarget(self) - } -} diff --git a/src/wasm/regular_link.rs b/src/wasm/regular_link.rs index 4d381d0..5374394 100644 --- a/src/wasm/regular_link.rs +++ b/src/wasm/regular_link.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::RegularLink; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmRegularLink { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( RegularLink<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::RegularLink(original) }, + { "TODO".into() }, { - Ok(WasmRegularLink { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmRegularLink { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmRegularLink { - fn into(self) -> WasmAstNode { - WasmAstNode::RegularLink(self) - } -} diff --git a/src/wasm/section.rs b/src/wasm/section.rs index e0730a4..f267723 100644 --- a/src/wasm/section.rs +++ b/src/wasm/section.rs @@ -1,23 +1,18 @@ +use serde::Deserialize; use serde::Serialize; use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; use super::AdditionalProperties; -#[cfg(feature = "wasm_test")] use crate::compare::ElispFact; use crate::types::Section; use crate::wasm::to_wasm::ToWasmStandardProperties; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "section")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmSection { - pub(crate) standard_properties: WasmStandardProperties, #[serde(flatten)] pub(crate) additional_properties: AdditionalProperties, - pub(crate) children: Vec, } to_wasm!( @@ -25,7 +20,8 @@ to_wasm!( Section<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Section(original) }, + { "section".into() }, { let children = original .children @@ -37,23 +33,11 @@ to_wasm!( }) .collect::, _>>()?; - Ok(WasmSection { - standard_properties, - additional_properties: AdditionalProperties::default(), + Ok(( children, - }) + WasmSection { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmSection { - fn into(self) -> WasmAstNode { - WasmAstNode::Section(self) - } -} - -#[cfg(feature = "wasm_test")] -impl<'s> ElispFact<'s> for WasmSection { - fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> { - "section".into() - } -} diff --git a/src/wasm/special_block.rs b/src/wasm/special_block.rs index 0ff84bc..ea191e3 100644 --- a/src/wasm/special_block.rs +++ b/src/wasm/special_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::SpecialBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmSpecialBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( SpecialBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::SpecialBlock(original) }, + { "TODO".into() }, { - Ok(WasmSpecialBlock { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmSpecialBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmSpecialBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::SpecialBlock(self) - } -} diff --git a/src/wasm/src_block.rs b/src/wasm/src_block.rs index 8762484..6aac926 100644 --- a/src/wasm/src_block.rs +++ b/src/wasm/src_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::SrcBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmSrcBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( SrcBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::SrcBlock(original) }, + { "TODO".into() }, { - Ok(WasmSrcBlock { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmSrcBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmSrcBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::SrcBlock(self) - } -} diff --git a/src/wasm/standard_properties.rs b/src/wasm/standard_properties.rs index ea00c23..c6bf021 100644 --- a/src/wasm/standard_properties.rs +++ b/src/wasm/standard_properties.rs @@ -1,3 +1,4 @@ +use serde::Deserialize; use serde::Serialize; use super::to_wasm::ToWasmContext; @@ -5,7 +6,7 @@ use super::to_wasm::ToWasmStandardProperties; use crate::types::PostBlank; use crate::types::StandardProperties; -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, Deserialize)] pub(crate) struct WasmStandardProperties { pub(crate) begin: usize, pub(crate) end: usize, diff --git a/src/wasm/statistics_cookie.rs b/src/wasm/statistics_cookie.rs index 773d4d4..49aa98a 100644 --- a/src/wasm/statistics_cookie.rs +++ b/src/wasm/statistics_cookie.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::StatisticsCookie; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmStatisticsCookie { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( StatisticsCookie<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::StatisticsCookie(original) }, + { "TODO".into() }, { - Ok(WasmStatisticsCookie { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmStatisticsCookie { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmStatisticsCookie { - fn into(self) -> WasmAstNode { - WasmAstNode::StatisticsCookie(self) - } -} diff --git a/src/wasm/strike_through.rs b/src/wasm/strike_through.rs index cf42d90..9c272c9 100644 --- a/src/wasm/strike_through.rs +++ b/src/wasm/strike_through.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::StrikeThrough; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmStrikeThrough { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( StrikeThrough<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::StrikeThrough(original) }, + { "TODO".into() }, { - Ok(WasmStrikeThrough { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmStrikeThrough { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmStrikeThrough { - fn into(self) -> WasmAstNode { - WasmAstNode::StrikeThrough(self) - } -} diff --git a/src/wasm/subscript.rs b/src/wasm/subscript.rs index b669ec9..495c099 100644 --- a/src/wasm/subscript.rs +++ b/src/wasm/subscript.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Subscript; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmSubscript { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( Subscript<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Subscript(original) }, + { "TODO".into() }, { - Ok(WasmSubscript { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmSubscript { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmSubscript { - fn into(self) -> WasmAstNode { - WasmAstNode::Subscript(self) - } -} diff --git a/src/wasm/superscript.rs b/src/wasm/superscript.rs index 6b468a3..077025f 100644 --- a/src/wasm/superscript.rs +++ b/src/wasm/superscript.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Superscript; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmSuperscript { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( Superscript<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Superscript(original) }, + { "TODO".into() }, { - Ok(WasmSuperscript { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmSuperscript { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmSuperscript { - fn into(self) -> WasmAstNode { - WasmAstNode::Superscript(self) - } -} diff --git a/src/wasm/table.rs b/src/wasm/table.rs index fbeb31c..8b96484 100644 --- a/src/wasm/table.rs +++ b/src/wasm/table.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Table; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmTable { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( Table<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Table(original) }, + { "TODO".into() }, { - Ok(WasmTable { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmTable { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmTable { - fn into(self) -> WasmAstNode { - WasmAstNode::Table(self) - } -} diff --git a/src/wasm/table_cell.rs b/src/wasm/table_cell.rs index 188baeb..7c2978a 100644 --- a/src/wasm/table_cell.rs +++ b/src/wasm/table_cell.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::TableCell; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmTableCell { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,11 +20,24 @@ to_wasm!( TableCell<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::TableCell(original) }, + { "TODO".into() }, { - Ok(WasmTableCell { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmTableCell { + additional_properties: AdditionalProperties::default(), + }, + )) } ); diff --git a/src/wasm/table_row.rs b/src/wasm/table_row.rs index 3065103..e3ee3f1 100644 --- a/src/wasm/table_row.rs +++ b/src/wasm/table_row.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::TableRow; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmTableRow { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,11 +20,24 @@ to_wasm!( TableRow<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::TableRow(original) }, + { "TODO".into() }, { - Ok(WasmTableRow { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmTableRow { + additional_properties: AdditionalProperties::default(), + }, + )) } ); diff --git a/src/wasm/target.rs b/src/wasm/target.rs index eea8b11..5b14b4a 100644 --- a/src/wasm/target.rs +++ b/src/wasm/target.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Target; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmTarget { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( Target<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Target(original) }, + { "TODO".into() }, { - Ok(WasmTarget { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmTarget { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmTarget { - fn into(self) -> WasmAstNode { - WasmAstNode::Target(self) - } -} diff --git a/src/wasm/timestamp.rs b/src/wasm/timestamp.rs index e90e0db..554ad8a 100644 --- a/src/wasm/timestamp.rs +++ b/src/wasm/timestamp.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Timestamp; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmTimestamp { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( Timestamp<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Timestamp(original) }, + { "TODO".into() }, { - Ok(WasmTimestamp { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmTimestamp { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmTimestamp { - fn into(self) -> WasmAstNode { - WasmAstNode::Timestamp(self) - } -} diff --git a/src/wasm/to_wasm.rs b/src/wasm/to_wasm.rs index 52bd790..7b8211f 100644 --- a/src/wasm/to_wasm.rs +++ b/src/wasm/to_wasm.rs @@ -1,6 +1,7 @@ use super::macros::to_wasm; use super::WasmAstNode; use crate::error::CustomError; +use crate::types::DocumentElement; use crate::types::Element; use crate::types::Object; @@ -30,125 +31,94 @@ impl<'s> ToWasmContext<'s> { } } -to_wasm!( - WasmAstNode, - Element<'s>, - original, - wasm_context, - standard_properties, - { - match original { - Element::Paragraph(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::PlainList(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::CenterBlock(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::QuoteBlock(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::SpecialBlock(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::DynamicBlock(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::FootnoteDefinition(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::Comment(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::Drawer(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::PropertyDrawer(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::Table(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::VerseBlock(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::CommentBlock(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::ExampleBlock(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::ExportBlock(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::SrcBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::Clock(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::DiarySexp(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::Planning(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::FixedWidthArea(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::HorizontalRule(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Element::Keyword(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::BabelCall(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Element::LatexEnvironment(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } +to_wasm!(WasmAstNode, DocumentElement<'s>, original, wasm_context, { + match original { + DocumentElement::Heading(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + DocumentElement::Section(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) } } -); +}); -to_wasm!( - WasmAstNode, - Object<'s>, - original, - wasm_context, - standard_properties, - { - match original { - Object::Bold(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::Italic(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::Underline(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::StrikeThrough(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::Code(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::Verbatim(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::PlainText(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::RegularLink(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::RadioLink(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::RadioTarget(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::PlainLink(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::AngleLink(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::OrgMacro(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::Entity(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::LatexFragment(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::ExportSnippet(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::FootnoteReference(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::Citation(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::CitationReference(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::InlineBabelCall(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::InlineSourceBlock(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::LineBreak(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::Target(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::StatisticsCookie(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::Subscript(inner) => inner.to_wasm(wasm_context).map(Into::::into), - Object::Superscript(inner) => { - inner.to_wasm(wasm_context).map(Into::::into) - } - Object::Timestamp(inner) => inner.to_wasm(wasm_context).map(Into::::into), +to_wasm!(WasmAstNode, Element<'s>, original, wasm_context, { + match original { + Element::Paragraph(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::PlainList(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::CenterBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::QuoteBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::SpecialBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::DynamicBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::FootnoteDefinition(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + Element::Comment(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::Drawer(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::PropertyDrawer(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + Element::Table(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::VerseBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::CommentBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::ExampleBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::ExportBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::SrcBlock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::Clock(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::DiarySexp(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::Planning(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::FixedWidthArea(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + Element::HorizontalRule(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + Element::Keyword(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::BabelCall(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Element::LatexEnvironment(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) } } -); +}); + +to_wasm!(WasmAstNode, Object<'s>, original, wasm_context, { + match original { + Object::Bold(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::Italic(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::Underline(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::StrikeThrough(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::Code(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::Verbatim(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::PlainText(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::RegularLink(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::RadioLink(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::RadioTarget(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::PlainLink(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::AngleLink(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::OrgMacro(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::Entity(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::LatexFragment(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::ExportSnippet(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::FootnoteReference(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + Object::Citation(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::CitationReference(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + Object::InlineBabelCall(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + Object::InlineSourceBlock(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + Object::LineBreak(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::Target(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::StatisticsCookie(inner) => { + inner.to_wasm(wasm_context).map(Into::::into) + } + Object::Subscript(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::Superscript(inner) => inner.to_wasm(wasm_context).map(Into::::into), + Object::Timestamp(inner) => inner.to_wasm(wasm_context).map(Into::::into), + } +}); diff --git a/src/wasm/underline.rs b/src/wasm/underline.rs index 0451b3f..6cedab3 100644 --- a/src/wasm/underline.rs +++ b/src/wasm/underline.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Underline; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmUnderline { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( Underline<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Underline(original) }, + { "TODO".into() }, { - Ok(WasmUnderline { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmUnderline { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmUnderline { - fn into(self) -> WasmAstNode { - WasmAstNode::Underline(self) - } -} diff --git a/src/wasm/verbatim.rs b/src/wasm/verbatim.rs index 48a8892..1655112 100644 --- a/src/wasm/verbatim.rs +++ b/src/wasm/verbatim.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::Verbatim; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmVerbatim { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,14 @@ to_wasm!( Verbatim<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::Verbatim(original) }, + { "TODO".into() }, { - Ok(WasmVerbatim { - standard_properties, - children: Vec::new(), - }) + Ok(( + Vec::new(), + WasmVerbatim { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmVerbatim { - fn into(self) -> WasmAstNode { - WasmAstNode::Verbatim(self) - } -} diff --git a/src/wasm/verse_block.rs b/src/wasm/verse_block.rs index ba538f5..9520dbf 100644 --- a/src/wasm/verse_block.rs +++ b/src/wasm/verse_block.rs @@ -1,18 +1,18 @@ +use serde::Deserialize; use serde::Serialize; +use super::ast_node::WasmAstNode; use super::macros::to_wasm; -use super::standard_properties::WasmStandardProperties; use super::to_wasm::ToWasm; +use super::AdditionalProperties; +use crate::compare::ElispFact; use crate::types::VerseBlock; use crate::wasm::to_wasm::ToWasmStandardProperties; -use crate::wasm::WasmAstNode; -#[derive(Debug, Serialize)] -#[serde(tag = "ast_node")] -#[serde(rename = "org-data")] +#[derive(Debug, Serialize, Deserialize)] pub struct WasmVerseBlock { - standard_properties: WasmStandardProperties, - children: Vec, + #[serde(flatten)] + pub(crate) additional_properties: AdditionalProperties, } to_wasm!( @@ -20,17 +20,24 @@ to_wasm!( VerseBlock<'s>, original, wasm_context, - standard_properties, + { WasmAstNode::VerseBlock(original) }, + { "TODO".into() }, { - Ok(WasmVerseBlock { - standard_properties, - children: Vec::new(), - }) + let children = original + .children + .iter() + .map(|child| { + child + .to_wasm(wasm_context.clone()) + .map(Into::::into) + }) + .collect::, _>>()?; + + Ok(( + children, + WasmVerseBlock { + additional_properties: AdditionalProperties::default(), + }, + )) } ); - -impl Into for WasmVerseBlock { - fn into(self) -> WasmAstNode { - WasmAstNode::VerseBlock(self) - } -} diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index fda5f41..aac61a2 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -7,6 +7,7 @@ use crate::compare::EmacsField; use crate::compare::Token; use crate::wasm::WasmAngleLink; use crate::wasm::WasmAstNode; +use crate::wasm::WasmAstNodeWrapper; use crate::wasm::WasmBabelCall; use crate::wasm::WasmBold; use crate::wasm::WasmCenterBlock; @@ -69,7 +70,7 @@ use crate::wasm_test::macros::wasm_compare; pub fn wasm_compare_document<'e, 's, 'w>( source: &'s str, emacs: &'e Token<'s>, - wasm: &'w WasmDocument, + wasm: &'w WasmAstNodeWrapper, ) -> Result, Box> { let wasm_json = serde_json::to_string(&wasm)?; let wasm_json_parsed = serde_json::from_str(&wasm_json)?; @@ -153,6 +154,11 @@ fn compare_ast_node<'b, 's, 'p>( .next() .ok_or("Should have an attributes child.")? .as_map()?; + let wasm_attributes_map = wasm + .get("properties") + .ok_or(r#"Wasm ast node should have a "properties" attribute."#)? + .as_object() + .ok_or(r#"Wasm ast node "properties" attribute should be an object."#)?; { // Compare attribute names. @@ -160,11 +166,10 @@ fn compare_ast_node<'b, 's, 'p>( .keys() .map(|s| (*s).to_owned()) .collect(); - let wasm_keys: std::collections::BTreeSet = wasm - .keys() - .filter(|k| !k.starts_with("__")) - .map(wasm_key_to_emacs_key) - .collect(); + let wasm_keys: std::collections::BTreeSet = + std::iter::once(":standard-properties".to_owned()) + .chain(wasm_attributes_map.keys().map(wasm_key_to_emacs_key)) + .collect(); let emacs_only_attributes: Vec<&String> = emacs_keys.difference(&wasm_keys).collect(); let wasm_only_attributes: Vec<&String> = wasm_keys.difference(&emacs_keys).collect(); if !emacs_only_attributes.is_empty() { @@ -201,13 +206,10 @@ fn compare_ast_node<'b, 's, 'p>( { // Compare attributes. - for attribute_name in wasm - .keys() - .filter(|k| !k.starts_with("__") && k.as_str() != "standard-properties") - { + for attribute_name in wasm_attributes_map.keys() { let mut layer = WasmDiffResult::default(); layer.name = Cow::Owned(attribute_name.clone()); - let wasm_attribute_value = wasm + let wasm_attribute_value = wasm_attributes_map .get(attribute_name) .ok_or("Key should exist in both wasm and elisp at this point.")?; let emacs_key = wasm_key_to_emacs_key(attribute_name); From c2f9789a641fa0bd3e8e85ab5585355341a7a6c7 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 15:09:54 -0500 Subject: [PATCH 06/15] Placeholder for comparing quoted strings. --- src/wasm_test/compare.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index aac61a2..cfa65e7 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -87,6 +87,12 @@ fn compare_json_value<'b, 's>( // We hit a regular ast node. compare_ast_node(source, el, wasm) } + (serde_json::Value::String(w), Token::Atom(e)) + if e.starts_with('"') && e.ends_with('"') => + { + // We hit a string compared against a quoted string from elisp (as opposed to an unquoted literal). + compare_quoted_string(source, e, w) + } (serde_json::Value::Null, Token::Atom(_)) => todo!(), (serde_json::Value::Null, Token::List(_)) => todo!(), (serde_json::Value::Null, Token::TextWithProperties(_)) => todo!(), @@ -235,6 +241,16 @@ fn wasm_key_to_emacs_key(wasm_key: WK) -> String { format!(":{key}", key = wasm_key) } +fn compare_quoted_string<'e, 's, 'w>( + source: &'s str, + emacs: &'e str, + wasm: &'w String, +) -> Result, Box> { + let mut result = WasmDiffResult::default(); + // TODO + Ok(result) +} + // pub fn old_wasm_compare_document<'b, 's, 'p>( // source: &'s str, // emacs: &'b Token<'s>, From adcd0de7e422f65d30180f069404932c5aa269ce Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 15:38:18 -0500 Subject: [PATCH 07/15] Compare standard properties. --- src/compare/mod.rs | 1 + src/compare/util.rs | 2 +- src/wasm_test/compare.rs | 101 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 102 insertions(+), 2 deletions(-) diff --git a/src/compare/mod.rs b/src/compare/mod.rs index 5b1ab67..76ee7a0 100644 --- a/src/compare/mod.rs +++ b/src/compare/mod.rs @@ -20,4 +20,5 @@ pub use sexp::Token; pub(crate) use util::get_emacs_standard_properties; pub(crate) use util::get_property; pub(crate) use util::get_property_quoted_string; +pub(crate) use util::maybe_token_to_usize; pub(crate) use util::EmacsStandardProperties; diff --git a/src/compare/util.rs b/src/compare/util.rs index b22fe84..f0a0b03 100644 --- a/src/compare/util.rs +++ b/src/compare/util.rs @@ -203,7 +203,7 @@ pub(crate) fn get_emacs_standard_properties( }) } -fn maybe_token_to_usize( +pub(crate) fn maybe_token_to_usize( token: Option<&Token<'_>>, ) -> Result, Box> { Ok(token diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index cfa65e7..59bd911 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -1,9 +1,13 @@ use std::borrow::Cow; +use std::collections::HashMap; use super::diff::WasmDiffResult; use super::diff::WasmDiffStatus; +use crate::compare::get_emacs_standard_properties; +use crate::compare::maybe_token_to_usize; use crate::compare::ElispFact; use crate::compare::EmacsField; +use crate::compare::EmacsStandardProperties; use crate::compare::Token; use crate::wasm::WasmAngleLink; use crate::wasm::WasmAstNode; @@ -231,7 +235,60 @@ fn compare_ast_node<'b, 's, 'p>( } } - // TODO: compare standard-properties. + { + // Compare standard-properties. + let mut layer = WasmDiffResult::default(); + layer.name = "standard-properties".into(); + let emacs_standard_properties = wasm_get_emacs_standard_properties(&emacs_attributes_map)?; + let wasm_standard_properties = wasm + .get("standard-properties") + .ok_or(r#"Wasm AST nodes should have a "standard-properties" attribute."#)? + .as_object() + .ok_or(r#"Wasm ast node "standard-properties" attribute should be an object."#)?; + for (emacs_value, wasm_name) in [ + (emacs_standard_properties.begin, "begin"), + (emacs_standard_properties.end, "end"), + (emacs_standard_properties.contents_begin, "contents_begin"), + (emacs_standard_properties.contents_end, "contents_end"), + (emacs_standard_properties.post_blank, "post_blank"), + ] { + match (emacs_value, wasm_standard_properties.get(wasm_name)) { + (None, None) => {} + (None, Some(_)) => { + layer.status.push(WasmDiffStatus::Bad( + format!( + "Elisp node lacked field present in wasm node. Name=({name}).", + name = wasm_name, + ) + .into(), + )); + } + (Some(_), None) => { + layer.status.push(WasmDiffStatus::Bad( + format!( + "Wasm node lacked field present in elisp node. Name=({name}).", + name = wasm_name, + ) + .into(), + )); + } + (Some(e), Some(serde_json::Value::Number(w))) + if w.as_u64().map(|w| w as usize) == Some(e) => {} + (Some(e), Some(w)) => { + layer.status.push(WasmDiffStatus::Bad( + format!( + "Property value mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = e, + wasm = w, + ) + .into(), + )); + } + } + } + result.children.push(layer); + } + // TODO: compare children Ok(result) @@ -251,6 +308,48 @@ fn compare_quoted_string<'e, 's, 'w>( Ok(result) } +pub(crate) fn wasm_get_emacs_standard_properties( + attributes_map: &HashMap<&str, &Token<'_>>, +) -> Result> { + let standard_properties = attributes_map.get(":standard-properties"); + Ok(if standard_properties.is_some() { + let mut std_props = standard_properties + .expect("if statement proves its Some") + .as_vector()? + .iter(); + let begin = maybe_token_to_usize(std_props.next())?; + let post_affiliated = maybe_token_to_usize(std_props.next())?; + let contents_begin = maybe_token_to_usize(std_props.next())?; + let contents_end = maybe_token_to_usize(std_props.next())?; + let end = maybe_token_to_usize(std_props.next())?; + let post_blank = maybe_token_to_usize(std_props.next())?; + EmacsStandardProperties { + begin, + post_affiliated, + contents_begin, + contents_end, + end, + post_blank, + } + } else { + let begin = maybe_token_to_usize(attributes_map.get(":begin").copied())?; + let end = maybe_token_to_usize(attributes_map.get(":end").copied())?; + let contents_begin = maybe_token_to_usize(attributes_map.get(":contents-begin").copied())?; + let contents_end = maybe_token_to_usize(attributes_map.get(":contents-end").copied())?; + let post_blank = maybe_token_to_usize(attributes_map.get(":post-blank").copied())?; + let post_affiliated = + maybe_token_to_usize(attributes_map.get(":post-affiliated").copied())?; + EmacsStandardProperties { + begin, + post_affiliated, + contents_begin, + contents_end, + end, + post_blank, + } + }) +} + // pub fn old_wasm_compare_document<'b, 's, 'p>( // source: &'s str, // emacs: &'b Token<'s>, From 5d31db39a4a5fbc808dad992e6e8342cdf437786 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 15:41:41 -0500 Subject: [PATCH 08/15] Remove some underscores from wasm schema to match elisp. --- src/wasm/ast_node.rs | 1 + src/wasm/standard_properties.rs | 3 +++ src/wasm_test/compare.rs | 10 +++++----- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/wasm/ast_node.rs b/src/wasm/ast_node.rs index 218e8e3..76b7f35 100644 --- a/src/wasm/ast_node.rs +++ b/src/wasm/ast_node.rs @@ -63,6 +63,7 @@ use super::WasmStandardProperties; #[derive(Debug, Serialize, Deserialize)] pub struct WasmAstNodeWrapper { + #[serde(rename = "ast-node")] pub(crate) ast_node: String, #[serde(rename = "standard-properties")] pub(crate) standard_properties: WasmStandardProperties, diff --git a/src/wasm/standard_properties.rs b/src/wasm/standard_properties.rs index c6bf021..de46b16 100644 --- a/src/wasm/standard_properties.rs +++ b/src/wasm/standard_properties.rs @@ -10,8 +10,11 @@ use crate::types::StandardProperties; pub(crate) struct WasmStandardProperties { pub(crate) begin: usize, pub(crate) end: usize, + #[serde(rename = "contents-begin")] pub(crate) contents_begin: Option, + #[serde(rename = "contents-end")] pub(crate) contents_end: Option, + #[serde(rename = "post-blank")] pub(crate) post_blank: PostBlank, } diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index 59bd911..b0c32d4 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -87,7 +87,7 @@ fn compare_json_value<'b, 's>( emacs: &'b Token<'s>, ) -> Result, Box> { 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. 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.")? .as_atom()?; let wasm_name = wasm - .get("ast_node") + .get("ast-node") .ok_or("Should have a ast node type.")? .as_str() .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 [ (emacs_standard_properties.begin, "begin"), (emacs_standard_properties.end, "end"), - (emacs_standard_properties.contents_begin, "contents_begin"), - (emacs_standard_properties.contents_end, "contents_end"), - (emacs_standard_properties.post_blank, "post_blank"), + (emacs_standard_properties.contents_begin, "contents-begin"), + (emacs_standard_properties.contents_end, "contents-end"), + (emacs_standard_properties.post_blank, "post-blank"), ] { match (emacs_value, wasm_standard_properties.get(wasm_name)) { (None, None) => {} From 2bfa8e59e7cc14bbc1704fc621cf35d0b8f8bee0 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 16:06:07 -0500 Subject: [PATCH 09/15] Add code to compare children. --- src/wasm_test/compare.rs | 63 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index b0c32d4..e8b6b4d 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -124,10 +124,10 @@ fn compare_json_value<'b, 's>( } } -fn compare_ast_node<'b, 's, 'p>( +fn compare_ast_node<'e, 's, 'w>( source: &'s str, - emacs: &'b Vec>, - wasm: &serde_json::Map, + emacs: &'e Vec>, + wasm: &'w serde_json::Map, ) -> Result, Box> { let mut result = WasmDiffResult::default(); let mut emacs_list_iter = emacs.iter(); @@ -289,7 +289,25 @@ fn compare_ast_node<'b, 's, 'p>( result.children.push(layer); } - // TODO: compare children + { + // Compare children. + let mut layer = WasmDiffResult::default(); + if let Some(wasm_iter) = wasm + .get("children") + .map(|children| children.as_array()) + .flatten() + .map(|children| children.iter()) + { + layer.extend(wasm_compare_list(source, emacs_list_iter, wasm_iter)?)?; + } else { + layer.extend(wasm_compare_list( + source, + emacs_list_iter, + std::iter::empty::<&serde_json::Value>(), + )?)?; + } + result.children.push(layer); + } Ok(result) } @@ -350,6 +368,43 @@ pub(crate) fn wasm_get_emacs_standard_properties( }) } +fn wasm_compare_list<'e, 's: 'e, 'w, EI, WI>( + source: &'s str, + emacs: EI, + wasm: WI, +) -> Result, Box> +where + EI: Iterator> + ExactSizeIterator, + WI: Iterator + ExactSizeIterator, +{ + let emacs_length = emacs.len(); + let wasm_length = wasm.len(); + if emacs_length != wasm_length { + return Ok(WasmDiffResult { + status: vec![WasmDiffStatus::Bad( + format!( + "Child length mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs_length, + wasm = wasm_length + ) + .into(), + )], + children: Vec::new(), + name: "".into(), + }); + } + + let mut child_status = Vec::with_capacity(emacs_length); + for (emacs_child, wasm_child) in emacs.zip(wasm) { + child_status.push(compare_json_value(wasm_child, source, emacs_child)?); + } + Ok(WasmDiffResult { + status: Vec::new(), + children: child_status, + name: "".into(), + }) +} + // pub fn old_wasm_compare_document<'b, 's, 'p>( // source: &'s str, // emacs: &'b Token<'s>, From 54085b5833a47bfd5b064ed6acbdc482642f007e Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 16:51:52 -0500 Subject: [PATCH 10/15] Implement compare optional pair. --- src/wasm_test/compare.rs | 75 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index e8b6b4d..ad7d232 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -86,6 +86,10 @@ fn compare_json_value<'b, 's>( source: &'s str, emacs: &'b Token<'s>, ) -> Result, Box> { + println!("XXXXXXXXXXXXXX compare_json_value XXXXXXXXXXXXXX"); + println!("{:?}", emacs); + println!("{:?}", value); + println!("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); match (value, emacs) { (serde_json::Value::Object(wasm), Token::List(el)) if wasm.contains_key("ast-node") => { // We hit a regular ast node. @@ -97,6 +101,14 @@ fn compare_json_value<'b, 's>( // We hit a string compared against a quoted string from elisp (as opposed to an unquoted literal). compare_quoted_string(source, e, w) } + (serde_json::Value::Array(w), Token::List(e)) => { + wasm_compare_list(source, e.iter(), w.iter()) + } + (serde_json::Value::Object(wasm), Token::List(e)) + if wasm.contains_key("optval") && wasm.contains_key("val") => + { + compare_optional_pair(source, e, wasm) + } (serde_json::Value::Null, Token::Atom(_)) => todo!(), (serde_json::Value::Null, Token::List(_)) => todo!(), (serde_json::Value::Null, Token::TextWithProperties(_)) => todo!(), @@ -114,7 +126,7 @@ fn compare_json_value<'b, 's>( (serde_json::Value::String(_), Token::TextWithProperties(_)) => todo!(), (serde_json::Value::String(_), Token::Vector(_)) => todo!(), (serde_json::Value::Array(_), Token::Atom(_)) => todo!(), - (serde_json::Value::Array(_), Token::List(_)) => todo!(), + // (serde_json::Value::Array(_), Token::List(_)) => todo!(), (serde_json::Value::Array(_), Token::TextWithProperties(_)) => todo!(), (serde_json::Value::Array(_), Token::Vector(_)) => todo!(), (serde_json::Value::Object(_), Token::Atom(_)) => todo!(), @@ -405,6 +417,67 @@ where }) } +fn compare_optional_pair<'e, 's, 'w>( + source: &'s str, + emacs: &'e Vec>, + wasm: &'w serde_json::Map, +) -> Result, Box> { + let mut result = WasmDiffResult::default(); + let wasm_optval = wasm + .get("optval") + .ok_or(r#"Wasm optional pair should have an "optval" attribute."#)?; + let wasm_val = wasm + .get("val") + .ok_or(r#"Wasm optional pair should have an "optval" attribute."#)?; + if let serde_json::Value::Null = wasm_optval { + // If the optval is null, then the elisp should have just a single value of a quoted string. + if emacs.len() != 1 { + return Ok(WasmDiffResult { + status: vec![WasmDiffStatus::Bad( + format!( + "Optional pair with null optval should have 1 element. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs, + wasm = wasm + ) + .into(), + )], + children: Vec::new(), + name: "".into(), + }); + } + + let emacs_val = emacs + .first() + .expect("If-statement proves this will be Some."); + result.extend(compare_json_value(wasm_val, source, emacs_val)?)?; + } else { + // If the optval is not null, then the elisp should have 3 values, the optval, a dot, and the val. + if emacs.len() != 3 { + return Ok(WasmDiffResult { + status: vec![WasmDiffStatus::Bad( + format!( + "Optional pair with non-null optval should have 3 elements. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs, + wasm = wasm + ) + .into(), + )], + children: Vec::new(), + name: "".into(), + }); + } + let emacs_optval = emacs + .first() + .expect("If-statement proves this will be Some."); + let emacs_val = emacs + .get(2) + .expect("If-statement proves this will be Some."); + result.extend(compare_json_value(wasm_optval, source, emacs_optval)?)?; + result.extend(compare_json_value(wasm_val, source, emacs_val)?)?; + } + Ok(result) +} + // pub fn old_wasm_compare_document<'b, 's, 'p>( // source: &'s str, // emacs: &'b Token<'s>, From 037caf369ceaf3514691491132e764487b3080c1 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 16:56:02 -0500 Subject: [PATCH 11/15] Standardize parameter order. --- src/wasm_test/compare.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index ad7d232..558473f 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -78,19 +78,19 @@ pub fn wasm_compare_document<'e, 's, 'w>( ) -> Result, Box> { let wasm_json = serde_json::to_string(&wasm)?; let wasm_json_parsed = serde_json::from_str(&wasm_json)?; - compare_json_value(&wasm_json_parsed, source, emacs) + compare_json_value(source, emacs, &wasm_json_parsed) } fn compare_json_value<'b, 's>( - value: &serde_json::Value, source: &'s str, emacs: &'b Token<'s>, + wasm: &serde_json::Value, ) -> Result, Box> { println!("XXXXXXXXXXXXXX compare_json_value XXXXXXXXXXXXXX"); println!("{:?}", emacs); - println!("{:?}", value); + println!("{:?}", wasm); println!("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); - match (value, emacs) { + match (wasm, emacs) { (serde_json::Value::Object(wasm), Token::List(el)) if wasm.contains_key("ast-node") => { // We hit a regular ast node. compare_ast_node(source, el, wasm) @@ -239,9 +239,9 @@ fn compare_ast_node<'e, 's, 'w>( .get(emacs_key.as_str()) .ok_or("Key should exist in both wasm and elisp at this point.")?; layer.extend(compare_json_value( - wasm_attribute_value, source, emacs_attribute_value, + wasm_attribute_value, )?)?; result.children.push(layer); } @@ -408,7 +408,7 @@ where let mut child_status = Vec::with_capacity(emacs_length); for (emacs_child, wasm_child) in emacs.zip(wasm) { - child_status.push(compare_json_value(wasm_child, source, emacs_child)?); + child_status.push(compare_json_value(source, emacs_child, wasm_child)?); } Ok(WasmDiffResult { status: Vec::new(), @@ -449,7 +449,7 @@ fn compare_optional_pair<'e, 's, 'w>( let emacs_val = emacs .first() .expect("If-statement proves this will be Some."); - result.extend(compare_json_value(wasm_val, source, emacs_val)?)?; + result.extend(compare_json_value(source, emacs_val, wasm_val)?)?; } else { // If the optval is not null, then the elisp should have 3 values, the optval, a dot, and the val. if emacs.len() != 3 { @@ -472,8 +472,8 @@ fn compare_optional_pair<'e, 's, 'w>( let emacs_val = emacs .get(2) .expect("If-statement proves this will be Some."); - result.extend(compare_json_value(wasm_optval, source, emacs_optval)?)?; - result.extend(compare_json_value(wasm_val, source, emacs_val)?)?; + result.extend(compare_json_value(source, emacs_optval, wasm_optval)?)?; + result.extend(compare_json_value(source, emacs_val, wasm_val)?)?; } Ok(result) } From 777c756a7f8ba953aa4c510e35a4effc2fd10c1d Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 17:24:38 -0500 Subject: [PATCH 12/15] Compare plain text AST nodes. --- src/compare/mod.rs | 1 + src/wasm/plain_text.rs | 2 +- src/wasm_test/compare.rs | 123 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 125 insertions(+), 1 deletion(-) diff --git a/src/compare/mod.rs b/src/compare/mod.rs index 76ee7a0..e5f8e98 100644 --- a/src/compare/mod.rs +++ b/src/compare/mod.rs @@ -16,6 +16,7 @@ pub(crate) use compare_field::EmacsField; pub(crate) use elisp_fact::ElispFact; pub use sexp::sexp; pub(crate) use sexp::unquote; +pub(crate) use sexp::TextWithProperties; pub use sexp::Token; pub(crate) use util::get_emacs_standard_properties; pub(crate) use util::get_property; diff --git a/src/wasm/plain_text.rs b/src/wasm/plain_text.rs index 8681230..974cb16 100644 --- a/src/wasm/plain_text.rs +++ b/src/wasm/plain_text.rs @@ -21,7 +21,7 @@ to_wasm!( original, wasm_context, { WasmAstNode::PlainText(original) }, - { "TODO".into() }, + { "plain-text".into() }, { Ok(( Vec::new(), diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index 558473f..6ba9b7b 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -5,9 +5,11 @@ use super::diff::WasmDiffResult; use super::diff::WasmDiffStatus; use crate::compare::get_emacs_standard_properties; use crate::compare::maybe_token_to_usize; +use crate::compare::unquote; use crate::compare::ElispFact; use crate::compare::EmacsField; use crate::compare::EmacsStandardProperties; +use crate::compare::TextWithProperties; use crate::compare::Token; use crate::wasm::WasmAngleLink; use crate::wasm::WasmAstNode; @@ -109,6 +111,9 @@ fn compare_json_value<'b, 's>( { compare_optional_pair(source, e, wasm) } + (serde_json::Value::Object(w), Token::TextWithProperties(e)) if is_plain_text(w) => { + compare_plain_text(source, e, w) + } (serde_json::Value::Null, Token::Atom(_)) => todo!(), (serde_json::Value::Null, Token::List(_)) => todo!(), (serde_json::Value::Null, Token::TextWithProperties(_)) => todo!(), @@ -478,6 +483,124 @@ fn compare_optional_pair<'e, 's, 'w>( Ok(result) } +fn is_plain_text<'e, 's, 'w>(wasm: &'w serde_json::Map) -> bool { + if let Some(serde_json::Value::String(node_type)) = wasm.get("ast-node") { + node_type == "plain-text" + } else { + false + } +} + +fn compare_plain_text<'e, 's, 'w>( + source: &'s str, + emacs: &'e TextWithProperties<'s>, + wasm: &'w serde_json::Map, +) -> Result, Box> { + let mut result = WasmDiffResult::default(); + if !is_plain_text(wasm) { + result.status.push(WasmDiffStatus::Bad( + format!( + "AST node type mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs, + wasm = wasm, + ) + .into(), + )); + return Ok(result); + } + + let emacs_text = unquote(emacs.text)?; + let wasm_standard_properties = wasm + .get("standard-properties") + .ok_or(r#"Wasm AST nodes should have a "standard-properties" attribute."#)? + .as_object() + .ok_or(r#"Wasm ast node "standard-properties" attribute should be an object."#)?; + let wasm_begin = { + if let Some(serde_json::Value::Number(begin)) = wasm_standard_properties.get("begin") { + begin + .as_u64() + .map(|w| w as usize) + .ok_or("Begin should be a number.")? + } else { + result.status.push(WasmDiffStatus::Bad( + format!( + "AST node type mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs, + wasm = wasm, + ) + .into(), + )); + return Ok(result); + } + }; + let wasm_end = { + if let Some(serde_json::Value::Number(end)) = wasm_standard_properties.get("end") { + end.as_u64() + .map(|w| w as usize) + .ok_or("End should be a number.")? + } else { + result.status.push(WasmDiffStatus::Bad( + format!( + "AST node type mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs, + wasm = wasm, + ) + .into(), + )); + return Ok(result); + } + }; + let wasm_text: String = source + .chars() + .skip(wasm_begin - 1) + .take(wasm_end - wasm_begin) + .collect(); + if wasm_text != emacs_text { + result.status.push(WasmDiffStatus::Bad( + format!( + "Text mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs_text, + wasm = wasm_text, + ) + .into(), + )); + return Ok(result); + } + + let emacs_start = emacs + .properties + .first() + .map(|t| t.as_atom()) + .map_or(Ok(None), |r| r.map(Some))?; + if emacs_start != Some("0") { + result.status.push(WasmDiffStatus::Bad( + format!( + "Text should start at offset 0. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs, + wasm = wasm, + ) + .into(), + )); + } + let emacs_end = emacs + .properties + .get(1) + .map(|t| t.as_atom()) + .map_or(Ok(None), |r| r.map(Some))?; + if emacs_end != Some((wasm_end - wasm_begin).to_string().as_str()) { + result.status.push(WasmDiffStatus::Bad( + format!( + "Text end mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs_end, + wasm = wasm_end - wasm_begin, + ) + .into(), + )); + } + + Ok(result) +} + // pub fn old_wasm_compare_document<'b, 's, 'p>( // source: &'s str, // emacs: &'b Token<'s>, From ef549d3b1988f598de9c81aee1ef650902bfac37 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 17:26:28 -0500 Subject: [PATCH 13/15] Compare quoted strings. --- src/wasm_test/compare.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index 6ba9b7b..f156746 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -309,6 +309,7 @@ fn compare_ast_node<'e, 's, 'w>( { // Compare children. let mut layer = WasmDiffResult::default(); + layer.name = "children".into(); if let Some(wasm_iter) = wasm .get("children") .map(|children| children.as_array()) @@ -339,7 +340,17 @@ fn compare_quoted_string<'e, 's, 'w>( wasm: &'w String, ) -> Result, Box> { let mut result = WasmDiffResult::default(); - // TODO + let emacs_text = unquote(emacs)?; + if wasm.as_str() != emacs_text { + result.status.push(WasmDiffStatus::Bad( + format!( + "Text mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs_text, + wasm = wasm, + ) + .into(), + )); + } Ok(result) } @@ -497,6 +508,7 @@ fn compare_plain_text<'e, 's, 'w>( wasm: &'w serde_json::Map, ) -> Result, Box> { let mut result = WasmDiffResult::default(); + result.name = "plain-text".into(); if !is_plain_text(wasm) { result.status.push(WasmDiffStatus::Bad( format!( From 78befc76657c1546e3efb2478e6953b67974074b Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 17:31:14 -0500 Subject: [PATCH 14/15] Remove old code. --- src/wasm_test/compare.rs | 1661 -------------------------------------- src/wasm_test/logic.rs | 386 --------- src/wasm_test/mod.rs | 1 - 3 files changed, 2048 deletions(-) delete mode 100644 src/wasm_test/logic.rs diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index f156746..45b7f16 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -612,1664 +612,3 @@ fn compare_plain_text<'e, 's, 'w>( Ok(result) } - -// pub fn old_wasm_compare_document<'b, 's, 'p>( -// source: &'s str, -// emacs: &'b Token<'s>, -// wasm: WasmDocument<'s, 'p>, -// ) -> Result, Box> { -// wasm.compare_ast_node(source, emacs) -// } - -// impl<'s, 'p, WAN: WasmElispCompare<'s, 'p>> WasmElispCompare<'s, 'p> for &WAN { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// (*self).compare_ast_node(source, emacs) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmAstNode<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// match self { -// WasmAstNode::Document(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Headline(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Section(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Paragraph(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::PlainList(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::PlainListItem(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::CenterBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::QuoteBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::SpecialBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::DynamicBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::FootnoteDefinition(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Comment(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Drawer(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::PropertyDrawer(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::NodeProperty(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Table(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::TableRow(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::VerseBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::CommentBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::ExampleBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::ExportBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::SrcBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Clock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::DiarySexp(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Planning(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::FixedWidthArea(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::HorizontalRule(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Keyword(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::BabelCall(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::LatexEnvironment(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Bold(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Italic(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Underline(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::StrikeThrough(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Code(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Verbatim(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::PlainText(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::RegularLink(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::RadioLink(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::RadioTarget(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::PlainLink(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::AngleLink(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::OrgMacro(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Entity(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::LatexFragment(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::ExportSnippet(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::FootnoteReference(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Citation(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::CitationReference(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::InlineBabelCall(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::InlineSourceBlock(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::LineBreak(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Target(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::StatisticsCookie(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Subscript(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Superscript(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::TableCell(inner) => inner.compare_ast_node(source, emacs), -// WasmAstNode::Timestamp(inner) => inner.compare_ast_node(source, emacs), -// } -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDocument<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// let result = wasm_compare!( -// source, -// emacs, -// self, -// ( -// EmacsField::Required(":path"), -// |w| w.path.as_ref().and_then(|p| p.to_str()), -// wasm_compare_property_quoted_string -// ), -// ( -// EmacsField::Required(":CATEGORY"), -// |w| w.category.as_ref(), -// wasm_compare_property_quoted_string -// ) -// ); -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmHeadline<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSection<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// let result = wasm_compare!(source, emacs, self,); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmParagraph<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// let result = wasm_compare!(source, emacs, self,); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainList<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainListItem<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCenterBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmQuoteBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSpecialBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDynamicBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmFootnoteDefinition<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmComment<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDrawer<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPropertyDrawer<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmNodeProperty<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTable<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTableRow<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmVerseBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCommentBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmExampleBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmExportBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSrcBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmClock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDiarySexp<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlanning<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmFixedWidthArea<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmHorizontalRule<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmKeyword<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmBabelCall<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmLatexEnvironment<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmBold<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmItalic<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmUnderline<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmStrikeThrough<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCode<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmVerbatim<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainText<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmRegularLink<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmRadioLink<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmRadioTarget<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmPlainLink<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmAngleLink<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmOrgMacro<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmEntity<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmLatexFragment<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmExportSnippet<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmFootnoteReference<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCitation<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmCitationReference<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmInlineBabelCall<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmInlineSourceBlock<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmLineBreak<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTarget<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmStatisticsCookie<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSubscript<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmSuperscript<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTableCell<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } - -// impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmTimestamp<'s, 'p> { -// fn compare_ast_node<'b>( -// &self, -// source: &'s str, -// emacs: &'b Token<'s>, -// ) -> Result, Box> { -// // TODO: Implement this. -// let result = WasmDiffResult::default(); -// // let result = wasm_compare!( -// // source, -// // emacs, -// // self, -// // ( -// // EmacsField::Required(":path"), -// // |w| w.path.as_ref().and_then(|p| p.to_str()), -// // wasm_compare_property_quoted_string -// // ), -// // ( -// // EmacsField::Required(":CATEGORY"), -// // |w| w.category.as_ref(), -// // wasm_compare_property_quoted_string -// // ) -// // ); - -// Ok(result) -// } -// } diff --git a/src/wasm_test/logic.rs b/src/wasm_test/logic.rs deleted file mode 100644 index a8a73dd..0000000 --- a/src/wasm_test/logic.rs +++ /dev/null @@ -1,386 +0,0 @@ -use super::diff::WasmDiffResult; -use super::diff::WasmDiffStatus; -use crate::compare::get_emacs_standard_properties; -use crate::compare::get_property; -use crate::compare::get_property_quoted_string; -use crate::compare::unquote; -use crate::compare::Token; -use crate::wasm::AdditionalProperties; -use crate::wasm::AdditionalPropertyValue; -use crate::wasm::WasmStandardProperties; - -// pub(crate) fn wasm_compare_list<'b, 's: 'b, 'p, EI, WI, WC>( -// source: &'s str, -// emacs: EI, -// wasm: WI, -// ) -> Result, Box> -// where -// EI: Iterator> + ExactSizeIterator, -// WI: Iterator + ExactSizeIterator, -// WC: WasmElispCompare<'s, 'p>, -// { -// let status = Vec::new(); -// let emacs_length = emacs.len(); -// let wasm_length = wasm.len(); -// if emacs_length != wasm_length { -// return Ok(WasmDiffResult { -// status: vec![WasmDiffStatus::Bad( -// format!( -// "Child length mismatch (emacs != rust) {:?} != {:?}", -// emacs_length, wasm_length -// ) -// .into(), -// )], -// children: Vec::new(), -// name: "".into(), -// }); -// } - -// let mut child_status = Vec::with_capacity(emacs_length); -// for (emacs_child, wasm_child) in emacs.zip(wasm) { -// child_status.push(wasm_child.compare_ast_node(source, emacs_child)?); -// } -// Ok(WasmDiffResult { -// status, -// children: child_status, -// name: "".into(), -// }) -// } - -// pub(crate) fn wasm_compare_property_quoted_string< -// 'b, -// 's, -// W, -// WV: AsRef + std::fmt::Debug, -// WG: Fn(W) -> Option, -// >( -// _source: &'s str, -// emacs: &'b Token<'s>, -// wasm_node: W, -// emacs_field: &str, -// wasm_value_getter: WG, -// ) -> Result, Box> { -// let mut result = WasmDiffResult::default(); -// let emacs_value = get_property_quoted_string(emacs, emacs_field)?; -// let wasm_value = wasm_value_getter(wasm_node); -// if wasm_value.as_ref().map(|s| s.as_ref()) != emacs_value.as_deref() { -// result.status.push(WasmDiffStatus::Bad( -// format!( -// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = emacs_field, -// emacs = emacs_value, -// wasm = wasm_value, -// ) -// .into(), -// )) -// } -// Ok(result) -// } - -// pub(crate) fn wasm_compare_property_list_of_quoted_string< -// 'b, -// 's, -// WI: Iterator + ExactSizeIterator, -// W, -// WV: AsRef + std::fmt::Debug, -// WG: Fn(W) -> Option, -// >( -// _source: &'s str, -// emacs: &'b Token<'s>, -// wasm_node: W, -// emacs_field: &str, -// wasm_value_getter: WG, -// ) -> Result, Box> { -// let mut result = WasmDiffResult::default(); -// let emacs_value = get_property(emacs, emacs_field)? -// .map(Token::as_list) -// .map_or(Ok(None), |r| r.map(Some))?; -// let wasm_value = wasm_value_getter(wasm_node); -// match (emacs_value, wasm_value) { -// (None, None) => {} -// (None, Some(_)) | (Some(_), None) => { -// return Ok(WasmDiffResult { -// status: vec![WasmDiffStatus::Bad( -// format!( -// "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = emacs_field, -// emacs = if emacs_value.is_some() {"Some"} else {"None"}, -// wasm = if !emacs_value.is_some() {"Some"} else {"None"} -// ) -// .into(), -// )], -// children: Vec::new(), -// name: "".into(), -// }); -// } -// (Some(el), Some(wl)) if el.len() != wl.len() => { -// return Ok(WasmDiffResult { -// status: vec![WasmDiffStatus::Bad( -// format!( -// "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = emacs_field, -// emacs = el.len(), -// wasm = wl.len() -// ) -// .into(), -// )], -// children: Vec::new(), -// name: "".into(), -// }); -// } -// (Some(el), Some(wl)) => { -// for (e, w) in el.iter().zip(wl) { -// let e = unquote(e.as_atom()?)?; -// let w = w.as_ref(); -// if e != w { -// result.status.push(WasmDiffStatus::Bad( -// format!( -// "Property list value mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = emacs_field, -// emacs = e, -// wasm = w -// ) -// .into(), -// )); -// } -// } -// } -// }; - -// Ok(result) -// } - -// pub(crate) fn wasm_compare_property_optional_pair< -// 'b, -// 's, -// W, -// WV: AsRef + std::fmt::Debug, -// WOV: AsRef + std::fmt::Debug, -// WG: Fn(W) -> Option<(Option, WV)>, -// >( -// _source: &'s str, -// emacs: &'b Token<'s>, -// wasm_node: W, -// emacs_field: &str, -// wasm_value_getter: WG, -// ) -> Result, Box> { -// let mut result = WasmDiffResult::default(); -// let emacs_value = get_property(emacs, emacs_field)? -// .map(Token::as_list) -// .map_or(Ok(None), |r| r.map(Some))?; -// let wasm_value = wasm_value_getter(wasm_node); -// match (emacs_value, &wasm_value) { -// (None, None) => {} -// (None, Some(_)) | (Some(_), None) => { -// return Ok(WasmDiffResult { -// status: vec![WasmDiffStatus::Bad( -// format!( -// "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = emacs_field, -// emacs = if emacs_value.is_some() {"Some"} else {"None"}, -// wasm = if !emacs_value.is_some() {"Some"} else {"None"} -// ) -// .into(), -// )], -// children: Vec::new(), -// name: "".into(), -// }); -// } -// (Some(el), Some((Some(owl), wl))) if el.len() == 3 => { -// let e = el -// .first() -// .map(Token::as_atom) -// .map_or(Ok(None), |r| r.map(Some))? -// .map(unquote) -// .map_or(Ok(None), |r| r.map(Some))? -// .expect("Above match proved length to be 3."); -// let oe = el -// .get(2) -// .map(Token::as_atom) -// .map_or(Ok(None), |r| r.map(Some))? -// .map(unquote) -// .map_or(Ok(None), |r| r.map(Some))? -// .expect("Above match proved length to be 3."); -// let w = wl.as_ref(); -// let ow = owl.as_ref(); -// if e != w { -// result.status.push(WasmDiffStatus::Bad( -// format!( -// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = "end", -// emacs = e, -// wasm = w, -// ) -// .into(), -// )); -// } -// if oe != ow { -// result.status.push(WasmDiffStatus::Bad( -// format!( -// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = "end", -// emacs = oe, -// wasm = ow, -// ) -// .into(), -// )); -// } -// } -// (Some(el), Some((None, wl))) if el.len() == 1 => { -// let e = el -// .first() -// .map(Token::as_atom) -// .map_or(Ok(None), |r| r.map(Some))? -// .map(unquote) -// .map_or(Ok(None), |r| r.map(Some))? -// .expect("Above match proved length to be 3."); -// let w = wl.as_ref(); -// if e != w { -// result.status.push(WasmDiffStatus::Bad( -// format!( -// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = "end", -// emacs = e, -// wasm = w, -// ) -// .into(), -// )); -// } -// } -// (Some(el), Some(_)) => { -// return Ok(WasmDiffResult { -// status: vec![WasmDiffStatus::Bad( -// format!( -// "Property list length mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = emacs_field, -// emacs = el.len(), -// wasm = wasm_value -// ) -// .into(), -// )], -// children: Vec::new(), -// name: "".into(), -// }); -// } -// } -// Ok(result) -// } - -// pub(crate) fn wasm_compare_standard_properties<'b, 's>( -// _source: &'s str, -// emacs: &'b Token<'s>, -// wasm: &WasmStandardProperties, -// ) -> Result, Box> { -// let mut result = WasmDiffResult::default(); -// let mut layer = WasmDiffResult::default(); -// layer.name = "standard-properties".into(); -// let standard_properties = get_emacs_standard_properties(emacs)?; - -// if Some(wasm.begin) != standard_properties.begin { -// layer.status.push(WasmDiffStatus::Bad( -// format!( -// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = "begin", -// emacs = standard_properties.begin, -// wasm = Some(wasm.begin), -// ) -// .into(), -// )); -// } -// if Some(wasm.end) != standard_properties.end { -// layer.status.push(WasmDiffStatus::Bad( -// format!( -// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = "end", -// emacs = standard_properties.end, -// wasm = Some(wasm.end), -// ) -// .into(), -// )); -// } -// if wasm.contents_begin != standard_properties.contents_begin { -// layer.status.push(WasmDiffStatus::Bad( -// format!( -// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = "contents-begin", -// emacs = standard_properties.contents_begin, -// wasm = wasm.contents_begin, -// ) -// .into(), -// )); -// } -// if wasm.contents_end != standard_properties.contents_end { -// layer.status.push(WasmDiffStatus::Bad( -// format!( -// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = "contents-end", -// emacs = standard_properties.contents_end, -// wasm = wasm.contents_end, -// ) -// .into(), -// )); -// } -// if Some(wasm.post_blank).map(|post_blank| post_blank as usize) != standard_properties.post_blank -// { -// layer.status.push(WasmDiffStatus::Bad( -// format!( -// "Property mismatch. Property=({property}) Emacs=({emacs:?}) Wasm=({wasm:?}).", -// property = "post-blank", -// emacs = standard_properties.post_blank, -// wasm = Some(wasm.post_blank), -// ) -// .into(), -// )); -// } - -// result.children.push(layer); -// Ok(result) -// } - -// pub(crate) fn wasm_compare_additional_properties<'b, 's>( -// source: &'s str, -// emacs: &'b Token<'s>, -// wasm: &AdditionalProperties<'_, '_>, -// ) -> Result, Box> { -// let mut result = WasmDiffResult::default(); -// let mut layer = WasmDiffResult::default(); -// layer.name = "additional-properties".into(); - -// for (property_name, property_value) in wasm.properties.iter() { -// let emacs_property_name = format!(":{property_name}", property_name = property_name); -// match property_value { -// AdditionalPropertyValue::SingleString(wasm_value) => { -// layer.extend(wasm_compare_property_quoted_string( -// source, -// emacs, -// wasm, -// &emacs_property_name, -// |_| Some(wasm_value), -// )?)?; -// } -// AdditionalPropertyValue::ListOfStrings(wasm_value) => { -// layer.extend(wasm_compare_property_list_of_quoted_string( -// source, -// emacs, -// wasm, -// &emacs_property_name, -// |_| Some(wasm_value.iter()), -// )?)?; -// } -// // TODO: similar to compare_affiliated_keywords -// AdditionalPropertyValue::OptionalPair { optval, val } => { -// layer.extend(wasm_compare_property_optional_pair( -// source, -// emacs, -// wasm, -// &emacs_property_name, -// |_| Some((*optval, *val)), -// )?)?; -// } -// AdditionalPropertyValue::ObjectTree(_) => todo!(), -// } -// } - -// result.children.push(layer); -// Ok(result) -// } diff --git a/src/wasm_test/mod.rs b/src/wasm_test/mod.rs index a383bbc..038b592 100644 --- a/src/wasm_test/mod.rs +++ b/src/wasm_test/mod.rs @@ -1,6 +1,5 @@ mod compare; mod diff; -mod logic; mod macros; mod runner; From 90735586b581b5c8b93500b7773ccdeb61693d40 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Fri, 29 Dec 2023 17:46:35 -0500 Subject: [PATCH 15/15] Add special case for object trees. --- src/wasm/additional_property.rs | 12 ++- src/wasm_test/compare.rs | 169 +++++++++++++++++++------------- src/wasm_test/diff.rs | 2 +- 3 files changed, 113 insertions(+), 70 deletions(-) diff --git a/src/wasm/additional_property.rs b/src/wasm/additional_property.rs index 0584545..b754f14 100644 --- a/src/wasm/additional_property.rs +++ b/src/wasm/additional_property.rs @@ -15,8 +15,14 @@ use crate::types::AffiliatedKeywords; pub enum AdditionalPropertyValue { SingleString(String), ListOfStrings(Vec), - OptionalPair { optval: Option, val: String }, - ObjectTree(Vec<(Option>, Vec)>), + OptionalPair { + optval: Option, + val: String, + }, + ObjectTree { + #[serde(rename = "object-tree")] + object_tree: Vec<(Option>, Vec)>, + }, } #[derive(Debug, Serialize, Deserialize, Default)] @@ -84,7 +90,7 @@ to_wasm!( ret.push((converted_optval, converted_value)); } - AdditionalPropertyValue::ObjectTree(ret) + AdditionalPropertyValue::ObjectTree { object_tree: ret } } }; additional_properties diff --git a/src/wasm_test/compare.rs b/src/wasm_test/compare.rs index 45b7f16..6169f75 100644 --- a/src/wasm_test/compare.rs +++ b/src/wasm_test/compare.rs @@ -3,75 +3,13 @@ use std::collections::HashMap; use super::diff::WasmDiffResult; use super::diff::WasmDiffStatus; -use crate::compare::get_emacs_standard_properties; use crate::compare::maybe_token_to_usize; use crate::compare::unquote; -use crate::compare::ElispFact; -use crate::compare::EmacsField; use crate::compare::EmacsStandardProperties; use crate::compare::TextWithProperties; use crate::compare::Token; -use crate::wasm::WasmAngleLink; -use crate::wasm::WasmAstNode; use crate::wasm::WasmAstNodeWrapper; -use crate::wasm::WasmBabelCall; -use crate::wasm::WasmBold; -use crate::wasm::WasmCenterBlock; -use crate::wasm::WasmCitation; -use crate::wasm::WasmCitationReference; -use crate::wasm::WasmClock; -use crate::wasm::WasmCode; -use crate::wasm::WasmComment; -use crate::wasm::WasmCommentBlock; -use crate::wasm::WasmDiarySexp; use crate::wasm::WasmDocument; -use crate::wasm::WasmDrawer; -use crate::wasm::WasmDynamicBlock; -use crate::wasm::WasmEntity; -use crate::wasm::WasmExampleBlock; -use crate::wasm::WasmExportBlock; -use crate::wasm::WasmExportSnippet; -use crate::wasm::WasmFixedWidthArea; -use crate::wasm::WasmFootnoteDefinition; -use crate::wasm::WasmFootnoteReference; -use crate::wasm::WasmHeadline; -use crate::wasm::WasmHorizontalRule; -use crate::wasm::WasmInlineBabelCall; -use crate::wasm::WasmInlineSourceBlock; -use crate::wasm::WasmItalic; -use crate::wasm::WasmKeyword; -use crate::wasm::WasmLatexEnvironment; -use crate::wasm::WasmLatexFragment; -use crate::wasm::WasmLineBreak; -use crate::wasm::WasmNodeProperty; -use crate::wasm::WasmOrgMacro; -use crate::wasm::WasmParagraph; -use crate::wasm::WasmPlainLink; -use crate::wasm::WasmPlainList; -use crate::wasm::WasmPlainListItem; -use crate::wasm::WasmPlainText; -use crate::wasm::WasmPlanning; -use crate::wasm::WasmPropertyDrawer; -use crate::wasm::WasmQuoteBlock; -use crate::wasm::WasmRadioLink; -use crate::wasm::WasmRadioTarget; -use crate::wasm::WasmRegularLink; -use crate::wasm::WasmSection; -use crate::wasm::WasmSpecialBlock; -use crate::wasm::WasmSrcBlock; -use crate::wasm::WasmStatisticsCookie; -use crate::wasm::WasmStrikeThrough; -use crate::wasm::WasmSubscript; -use crate::wasm::WasmSuperscript; -use crate::wasm::WasmTable; -use crate::wasm::WasmTableCell; -use crate::wasm::WasmTableRow; -use crate::wasm::WasmTarget; -use crate::wasm::WasmTimestamp; -use crate::wasm::WasmUnderline; -use crate::wasm::WasmVerbatim; -use crate::wasm::WasmVerseBlock; -use crate::wasm_test::macros::wasm_compare; pub fn wasm_compare_document<'e, 's, 'w>( source: &'s str, @@ -88,10 +26,10 @@ fn compare_json_value<'b, 's>( emacs: &'b Token<'s>, wasm: &serde_json::Value, ) -> Result, Box> { - println!("XXXXXXXXXXXXXX compare_json_value XXXXXXXXXXXXXX"); - println!("{:?}", emacs); - println!("{:?}", wasm); - println!("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); + // println!("XXXXXXXXXXXXXX compare_json_value XXXXXXXXXXXXXX"); + // println!("{:?}", emacs); + // println!("{:?}", wasm); + // println!("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); match (wasm, emacs) { (serde_json::Value::Object(wasm), Token::List(el)) if wasm.contains_key("ast-node") => { // We hit a regular ast node. @@ -104,6 +42,7 @@ fn compare_json_value<'b, 's>( compare_quoted_string(source, e, w) } (serde_json::Value::Array(w), Token::List(e)) => { + // TODO: This is creating children with no names. wasm_compare_list(source, e.iter(), w.iter()) } (serde_json::Value::Object(wasm), Token::List(e)) @@ -111,6 +50,10 @@ fn compare_json_value<'b, 's>( { compare_optional_pair(source, e, wasm) } + (serde_json::Value::Object(wasm), Token::List(el)) if wasm.contains_key("object-tree") => { + // We hit an object tree additional property. + compare_object_tree(source, el, wasm) + } (serde_json::Value::Object(w), Token::TextWithProperties(e)) if is_plain_text(w) => { compare_plain_text(source, e, w) } @@ -494,6 +437,100 @@ fn compare_optional_pair<'e, 's, 'w>( Ok(result) } +fn compare_object_tree<'e, 's, 'w>( + source: &'s str, + emacs: &'e Vec>, + wasm: &'w serde_json::Map, +) -> Result, Box> { + let mut result = WasmDiffResult::default(); + let wasm_attributes = wasm + .get("object-tree") + .ok_or(r#"Wasm object tree should have an "object-tree" attribute."#)? + .as_array() + .ok_or(r#"Wasm "object-tree" attribute should be a list."#)?; + let emacs_outer_length = emacs.len(); + let wasm_outer_length = wasm_attributes.len(); + if emacs_outer_length != wasm_outer_length { + result.status.push(WasmDiffStatus::Bad( + format!( + "Child length mismatch. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs_outer_length, + wasm = wasm_outer_length + ) + .into(), + )); + return Ok(result); + } + + for (emacs_attribute, wasm_attribute) in emacs.iter().zip(wasm_attributes.iter()) { + let emacs_attribute = emacs_attribute.as_list()?; + let wasm_attribute = wasm_attribute + .as_array() + .ok_or("Wasm middle layer in object tree should be a list.")?; + if wasm_attribute.len() != 2 { + result.status.push(WasmDiffStatus::Bad( + format!( + "Wasm middle layer in object tree should have a length of 2. Wasm=({wasm:?}).", + wasm = wasm_attribute.len() + ) + .into(), + )); + return Ok(result); + } + if let Some(serde_json::Value::Null) = wasm_attribute.first() { + // If optval is null then the emacs array should only contain 1 value. + if emacs_attribute.len() != 1 { + result.status.push(WasmDiffStatus::Bad( + format!( + "Emacs middle layer in object tree should have a length of 1. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs_attribute, + wasm = wasm_attribute + ) + .into(), + )); + return Ok(result); + } + + let emacs_val = emacs_attribute + .first() + .expect("If-statement proves this will be Some."); + let wasm_val = wasm_attribute + .get(1) + .expect("If-statement proves this will be Some."); + result.extend(compare_json_value(source, emacs_val, wasm_val)?)?; + } else { + // If optval is not null, then the emacs array should contain 3 values, the optval, a dot, and the val. + if emacs_attribute.len() != 3 { + result.status.push(WasmDiffStatus::Bad( + format!( + "Emacs middle layer in object tree should have a length of 3. Emacs=({emacs:?}) Wasm=({wasm:?}).", + emacs = emacs_attribute, + wasm = wasm_attribute + ) + .into(), + )); + return Ok(result); + } + let emacs_optval = emacs_attribute + .first() + .expect("If-statement proves this will be Some."); + let wasm_optval = wasm_attribute + .first() + .expect("If-statement proves this will be Some."); + let emacs_val = emacs_attribute + .get(2) + .expect("If-statement proves this will be Some."); + let wasm_val = wasm_attribute + .get(1) + .expect("If-statement proves this will be Some."); + result.extend(compare_json_value(source, emacs_optval, wasm_optval)?)?; + result.extend(compare_json_value(source, emacs_val, wasm_val)?)?; + } + } + + Ok(result) +} + fn is_plain_text<'e, 's, 'w>(wasm: &'w serde_json::Map) -> bool { if let Some(serde_json::Value::String(node_type)) = wasm.get("ast-node") { node_type == "plain-text" diff --git a/src/wasm_test/diff.rs b/src/wasm_test/diff.rs index 0cccf4d..7101a9d 100644 --- a/src/wasm_test/diff.rs +++ b/src/wasm_test/diff.rs @@ -55,7 +55,7 @@ impl<'s> WasmDiffResult<'s> { original_document: &str, ) -> Result<(), Box> { let status_text = { - if self.is_bad() { + if self.is_self_bad() { format!( "{color}BAD{reset}", color = foreground_color(255, 0, 0),