Remove lifetimes from wasm ast nodes.
This commit is contained in:
parent
9f4f8e79ce
commit
a0a4f0eb90
@ -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<WasmAstNode<'s, 'p>>>, Vec<WasmAstNode<'s, 'p>>)>),
|
||||
pub enum AdditionalPropertyValue {
|
||||
SingleString(String),
|
||||
ListOfStrings(Vec<String>),
|
||||
OptionalPair { optval: Option<String>, val: String },
|
||||
ObjectTree(Vec<(Option<Vec<WasmAstNode>>, Vec<WasmAstNode>)>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Default)]
|
||||
pub struct AdditionalProperties<'s, 'p> {
|
||||
pub struct AdditionalProperties {
|
||||
#[serde(flatten)]
|
||||
pub(crate) properties: HashMap<String, AdditionalPropertyValue<'s, 'p>>,
|
||||
pub(crate) properties: HashMap<String, AdditionalPropertyValue>,
|
||||
}
|
||||
|
||||
impl<'s, 'p> AdditionalProperties<'s, 'p> {
|
||||
impl AdditionalProperties {
|
||||
pub(crate) fn get_elisp_names<'c>(&'c self) -> impl Iterator<Item = String> + '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::<WasmAstNode<'_, '_>>::into)
|
||||
.map(Into::<WasmAstNode>::into)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?,
|
||||
)
|
||||
@ -76,7 +76,7 @@ to_wasm!(
|
||||
.map(|child| {
|
||||
child
|
||||
.to_wasm(wasm_context.clone())
|
||||
.map(Into::<WasmAstNode<'_, '_>>::into)
|
||||
.map(Into::<WasmAstNode>::into)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmAngleLink<'s, 'p>,
|
||||
WasmAngleLink,
|
||||
AngleLink<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmAngleLink<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmAngleLink {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::AngleLink(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
// #[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<WasmAstNode<'s, 'p>>,
|
||||
// }
|
||||
|
||||
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<WasmAstNode<'s, 'p>>,
|
||||
) -> 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<WasmAstNode<'s, 'p>>,
|
||||
// ) -> 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 {}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmBabelCall<'s, 'p>,
|
||||
WasmBabelCall,
|
||||
BabelCall<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmBabelCall<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmBabelCall {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::BabelCall(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmBold<'s, 'p>,
|
||||
WasmBold,
|
||||
Bold<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmBold<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmBold {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Bold(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCenterBlock<'s, 'p>,
|
||||
WasmCenterBlock,
|
||||
CenterBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmCenterBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmCenterBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::CenterBlock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCitation<'s, 'p>,
|
||||
WasmCitation,
|
||||
Citation<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmCitation<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmCitation {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Citation(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCitationReference<'s, 'p>,
|
||||
WasmCitationReference,
|
||||
CitationReference<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmCitationReference<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmCitationReference {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::CitationReference(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmClock<'s, 'p>,
|
||||
WasmClock,
|
||||
Clock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmClock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmClock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Clock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCode<'s, 'p>,
|
||||
WasmCode,
|
||||
Code<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmCode<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmCode {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Code(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmComment<'s, 'p>,
|
||||
WasmComment,
|
||||
Comment<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmComment<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmComment {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Comment(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCommentBlock<'s, 'p>,
|
||||
WasmCommentBlock,
|
||||
CommentBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmCommentBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmCommentBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::CommentBlock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmDiarySexp<'s, 'p>,
|
||||
WasmDiarySexp,
|
||||
DiarySexp<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmDiarySexp<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmDiarySexp {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::DiarySexp(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
pub(crate) children: Vec<WasmAstNode>,
|
||||
#[serde(rename = "CATEGORY")]
|
||||
pub(crate) category: Option<&'p str>,
|
||||
pub(crate) category: Option<String>,
|
||||
pub(crate) path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
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::<WasmAstNode<'_, '_>>::into)
|
||||
.map(Into::<WasmAstNode>::into)
|
||||
})
|
||||
.chain(original.children.iter().map(|child| {
|
||||
child
|
||||
.to_wasm(wasm_context.clone())
|
||||
.map(Into::<WasmAstNode<'_, '_>>::into)
|
||||
.map(Into::<WasmAstNode>::into)
|
||||
}))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
@ -68,34 +67,21 @@ to_wasm!(
|
||||
standard_properties,
|
||||
additional_properties,
|
||||
children,
|
||||
category,
|
||||
category: category.map(str::to_owned),
|
||||
path,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmDocument<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> 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<WasmAstWrapper<'b, 's, 'p, &'b WasmDocument<'s, 'p>>>
|
||||
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,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmDrawer<'s, 'p>,
|
||||
WasmDrawer,
|
||||
Drawer<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmDrawer<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmDrawer {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Drawer(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmDynamicBlock<'s, 'p>,
|
||||
WasmDynamicBlock,
|
||||
DynamicBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmDynamicBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmDynamicBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::DynamicBlock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmEntity<'s, 'p>,
|
||||
WasmEntity,
|
||||
Entity<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmEntity<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmEntity {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Entity(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmExampleBlock<'s, 'p>,
|
||||
WasmExampleBlock,
|
||||
ExampleBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmExampleBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmExampleBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::ExampleBlock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmExportBlock<'s, 'p>,
|
||||
WasmExportBlock,
|
||||
ExportBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmExportBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmExportBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::ExportBlock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmExportSnippet<'s, 'p>,
|
||||
WasmExportSnippet,
|
||||
ExportSnippet<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmExportSnippet<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmExportSnippet {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::ExportSnippet(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmFixedWidthArea<'s, 'p>,
|
||||
WasmFixedWidthArea,
|
||||
FixedWidthArea<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmFixedWidthArea<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmFixedWidthArea {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::FixedWidthArea(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmFootnoteDefinition<'s, 'p>,
|
||||
WasmFootnoteDefinition,
|
||||
FootnoteDefinition<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmFootnoteDefinition<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmFootnoteDefinition {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::FootnoteDefinition(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmFootnoteReference<'s, 'p>,
|
||||
WasmFootnoteReference,
|
||||
FootnoteReference<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmFootnoteReference<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmFootnoteReference {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::FootnoteReference(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmHeadline<'s, 'p>,
|
||||
WasmHeadline,
|
||||
Heading<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmHeadline<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmHeadline {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Headline(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmHorizontalRule<'s, 'p>,
|
||||
WasmHorizontalRule,
|
||||
HorizontalRule<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmHorizontalRule<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmHorizontalRule {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::HorizontalRule(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmInlineBabelCall<'s, 'p>,
|
||||
WasmInlineBabelCall,
|
||||
InlineBabelCall<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmInlineBabelCall<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmInlineBabelCall {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::InlineBabelCall(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmInlineSourceBlock<'s, 'p>,
|
||||
WasmInlineSourceBlock,
|
||||
InlineSourceBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmInlineSourceBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmInlineSourceBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::InlineSourceBlock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmItalic<'s, 'p>,
|
||||
WasmItalic,
|
||||
Italic<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmItalic<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmItalic {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Italic(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmKeyword<'s, 'p>,
|
||||
WasmKeyword,
|
||||
Keyword<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmKeyword<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmKeyword {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Keyword(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmLatexEnvironment<'s, 'p>,
|
||||
WasmLatexEnvironment,
|
||||
LatexEnvironment<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmLatexEnvironment<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmLatexEnvironment {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::LatexEnvironment(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmLatexFragment<'s, 'p>,
|
||||
WasmLatexFragment,
|
||||
LatexFragment<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmLatexFragment<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmLatexFragment {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::LatexFragment(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmLineBreak<'s, 'p>,
|
||||
WasmLineBreak,
|
||||
LineBreak<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmLineBreak<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmLineBreak {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::LineBreak(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<Self::Output, crate::error::CustomError> {
|
||||
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<Self::Output, crate::error::CustomError> {
|
||||
let $original = self;
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmNodeProperty<'s, 'p>,
|
||||
WasmNodeProperty,
|
||||
NodeProperty<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmOrgMacro<'s, 'p>,
|
||||
WasmOrgMacro,
|
||||
OrgMacro<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmOrgMacro<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmOrgMacro {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::OrgMacro(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
pub(crate) additional_properties: AdditionalProperties,
|
||||
pub(crate) children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
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::<WasmAstNode<'_, '_>>::into)
|
||||
.map(Into::<WasmAstNode>::into)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
@ -50,14 +50,14 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmParagraph<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> 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()
|
||||
}
|
||||
|
@ -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),
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlainLink<'s, 'p>,
|
||||
WasmPlainLink,
|
||||
PlainLink<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmPlainLink<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmPlainLink {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::PlainLink(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlainList<'s, 'p>,
|
||||
WasmPlainList,
|
||||
PlainList<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmPlainList<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmPlainList {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::PlainList(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlainListItem<'s, 'p>,
|
||||
WasmPlainListItem,
|
||||
PlainListItem<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlainText<'s, 'p>,
|
||||
WasmPlainText,
|
||||
PlainText<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmPlainText<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmPlainText {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::PlainText(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlanning<'s, 'p>,
|
||||
WasmPlanning,
|
||||
Planning<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmPlanning<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmPlanning {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Planning(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPropertyDrawer<'s, 'p>,
|
||||
WasmPropertyDrawer,
|
||||
PropertyDrawer<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmPropertyDrawer<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmPropertyDrawer {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::PropertyDrawer(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmQuoteBlock<'s, 'p>,
|
||||
WasmQuoteBlock,
|
||||
QuoteBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmQuoteBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmQuoteBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::QuoteBlock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmRadioLink<'s, 'p>,
|
||||
WasmRadioLink,
|
||||
RadioLink<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmRadioLink<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmRadioLink {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::RadioLink(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmRadioTarget<'s, 'p>,
|
||||
WasmRadioTarget,
|
||||
RadioTarget<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmRadioTarget<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmRadioTarget {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::RadioTarget(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmRegularLink<'s, 'p>,
|
||||
WasmRegularLink,
|
||||
RegularLink<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmRegularLink<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmRegularLink {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::RegularLink(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
pub(crate) additional_properties: AdditionalProperties,
|
||||
pub(crate) children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
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::<WasmAstNode<'_, '_>>::into)
|
||||
.map(Into::<WasmAstNode>::into)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
@ -45,14 +45,14 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmSection<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> 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()
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmSpecialBlock<'s, 'p>,
|
||||
WasmSpecialBlock,
|
||||
SpecialBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmSpecialBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmSpecialBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::SpecialBlock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmSrcBlock<'s, 'p>,
|
||||
WasmSrcBlock,
|
||||
SrcBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmSrcBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmSrcBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::SrcBlock(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmStatisticsCookie<'s, 'p>,
|
||||
WasmStatisticsCookie,
|
||||
StatisticsCookie<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmStatisticsCookie<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmStatisticsCookie {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::StatisticsCookie(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmStrikeThrough<'s, 'p>,
|
||||
WasmStrikeThrough,
|
||||
StrikeThrough<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmStrikeThrough<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmStrikeThrough {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::StrikeThrough(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmSubscript<'s, 'p>,
|
||||
WasmSubscript,
|
||||
Subscript<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmSubscript<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmSubscript {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Subscript(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmSuperscript<'s, 'p>,
|
||||
WasmSuperscript,
|
||||
Superscript<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmSuperscript<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmSuperscript {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Superscript(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTable<'s, 'p>,
|
||||
WasmTable,
|
||||
Table<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmTable<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmTable {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Table(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTableCell<'s, 'p>,
|
||||
WasmTableCell,
|
||||
TableCell<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTableRow<'s, 'p>,
|
||||
WasmTableRow,
|
||||
TableRow<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTarget<'s, 'p>,
|
||||
WasmTarget,
|
||||
Target<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmTarget<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmTarget {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Target(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTimestamp<'s, 'p>,
|
||||
WasmTimestamp,
|
||||
Timestamp<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmTimestamp<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmTimestamp {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Timestamp(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<Self::Output, CustomError>;
|
||||
fn to_wasm(&self, full_document: ToWasmContext<'_>) -> Result<Self::Output, CustomError>;
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmUnderline<'s, 'p>,
|
||||
WasmUnderline,
|
||||
Underline<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmUnderline<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmUnderline {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Underline(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmVerbatim<'s, 'p>,
|
||||
WasmVerbatim,
|
||||
Verbatim<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmVerbatim<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmVerbatim {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Verbatim(self)
|
||||
}
|
||||
}
|
||||
|
@ -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<WasmAstNode<'s, 'p>>,
|
||||
children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmVerseBlock<'s, 'p>,
|
||||
WasmVerseBlock,
|
||||
VerseBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -29,8 +29,8 @@ to_wasm!(
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmVerseBlock<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
impl Into<WasmAstNode> for WasmVerseBlock {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::VerseBlock(self)
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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<WasmDiffResult<'s>, Box<dyn std::error::Error>>;
|
||||
}
|
@ -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<WasmDiffResult<'s>, Box<dyn std::error::Error>>
|
||||
where
|
||||
EI: Iterator<Item = &'b Token<'s>> + ExactSizeIterator,
|
||||
WI: Iterator<Item = WC> + 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<WasmDiffResult<'s>, Box<dyn std::error::Error>>
|
||||
// where
|
||||
// EI: Iterator<Item = &'b Token<'s>> + ExactSizeIterator,
|
||||
// WI: Iterator<Item = WC> + 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<str> + std::fmt::Debug,
|
||||
WG: Fn(W) -> Option<WV>,
|
||||
>(
|
||||
_source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
wasm_node: W,
|
||||
emacs_field: &str,
|
||||
wasm_value_getter: WG,
|
||||
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
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<str> + std::fmt::Debug,
|
||||
// WG: Fn(W) -> Option<WV>,
|
||||
// >(
|
||||
// _source: &'s str,
|
||||
// emacs: &'b Token<'s>,
|
||||
// wasm_node: W,
|
||||
// emacs_field: &str,
|
||||
// wasm_value_getter: WG,
|
||||
// ) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
// 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<Item = WV> + ExactSizeIterator,
|
||||
W,
|
||||
WV: AsRef<str> + std::fmt::Debug,
|
||||
WG: Fn(W) -> Option<WI>,
|
||||
>(
|
||||
_source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
wasm_node: W,
|
||||
emacs_field: &str,
|
||||
wasm_value_getter: WG,
|
||||
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
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<Item = WV> + ExactSizeIterator,
|
||||
// W,
|
||||
// WV: AsRef<str> + std::fmt::Debug,
|
||||
// WG: Fn(W) -> Option<WI>,
|
||||
// >(
|
||||
// _source: &'s str,
|
||||
// emacs: &'b Token<'s>,
|
||||
// wasm_node: W,
|
||||
// emacs_field: &str,
|
||||
// wasm_value_getter: WG,
|
||||
// ) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
// 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<str> + std::fmt::Debug,
|
||||
WOV: AsRef<str> + std::fmt::Debug,
|
||||
WG: Fn(W) -> Option<(Option<WOV>, WV)>,
|
||||
>(
|
||||
_source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
wasm_node: W,
|
||||
emacs_field: &str,
|
||||
wasm_value_getter: WG,
|
||||
) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
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<str> + std::fmt::Debug,
|
||||
// WOV: AsRef<str> + std::fmt::Debug,
|
||||
// WG: Fn(W) -> Option<(Option<WOV>, WV)>,
|
||||
// >(
|
||||
// _source: &'s str,
|
||||
// emacs: &'b Token<'s>,
|
||||
// wasm_node: W,
|
||||
// emacs_field: &str,
|
||||
// wasm_value_getter: WG,
|
||||
// ) -> Result<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
// 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<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
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<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
// 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<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
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<WasmDiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
// 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)
|
||||
// }
|
||||
|
@ -1,6 +1,5 @@
|
||||
mod compare;
|
||||
mod diff;
|
||||
mod elisp_compare;
|
||||
mod logic;
|
||||
mod macros;
|
||||
mod runner;
|
||||
|
@ -47,7 +47,7 @@ pub async fn wasm_run_anonymous_compare_with_settings<'g, 's, P: AsRef<str>>(
|
||||
}
|
||||
|
||||
// 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<Path>>(
|
||||
}
|
||||
|
||||
// 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)?;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user