Compare commits

..

No commits in common. "36b80dc093ba72388f6ec4ddc255a67d11587f83" and "99376515efbfa69250f03123fb28a6de774cb079" have entirely different histories.

71 changed files with 696 additions and 651 deletions

View File

@ -36,7 +36,7 @@ wasm:
.PHONY: run_wasm .PHONY: run_wasm
run_wasm: run_wasm:
> cat /tmp/test.org | cargo run --profile wasm --bin wasm_test --features wasm_test > cat /tmp/test.org | cargo run --profile wasm --bin wasm_test --features wasm_test | jq
.PHONY: clean .PHONY: clean
clean: clean:

View File

@ -1,28 +1,10 @@
use organic::parser::parse_with_settings; use organic::wasm::wasm_parse_org;
use organic::settings::GlobalSettings;
use organic::wasm::ParseResult;
use organic::wasm::ToWasm;
use organic::wasm::ToWasmContext;
use wasm_bindgen::prelude::wasm_bindgen; use wasm_bindgen::prelude::wasm_bindgen;
#[wasm_bindgen] #[wasm_bindgen]
pub fn parse_org(org_contents: &str) -> wasm_bindgen::JsValue { pub fn parse_org(org_contents: &str) -> wasm_bindgen::JsValue {
let rust_parsed = match parse_with_settings(org_contents, &GlobalSettings::default()) { let rust_parsed = wasm_parse_org(org_contents);
Ok(document) => document, serde_wasm_bindgen::to_value(&rust_parsed).unwrap()
Err(err) => {
return serde_wasm_bindgen::to_value(&ParseResult::Error(format!("{:?}", err)))
.unwrap();
}
};
let to_wasm_context = ToWasmContext::new(org_contents);
let wasm_document = match rust_parsed.to_wasm(to_wasm_context) {
Ok(document) => document,
Err(err) => {
return serde_wasm_bindgen::to_value(&ParseResult::Error(format!("{:?}", err)))
.unwrap();
}
};
serde_wasm_bindgen::to_value(&ParseResult::Success(wasm_document)).unwrap()
} }
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {

View File

@ -9,9 +9,7 @@ use crate::parser::parse_file_with_settings;
use crate::parser::parse_with_settings; use crate::parser::parse_with_settings;
use crate::util::emacs_parse_anonymous_org_document; use crate::util::emacs_parse_anonymous_org_document;
use crate::util::emacs_parse_file_org_document; use crate::util::emacs_parse_file_org_document;
use crate::util::foreground_color;
use crate::util::print_versions; use crate::util::print_versions;
use crate::util::reset_color;
pub async fn run_anonymous_compare<P: AsRef<str>>( pub async fn run_anonymous_compare<P: AsRef<str>>(
org_contents: P, org_contents: P,
@ -69,8 +67,8 @@ pub async fn run_anonymous_compare_with_settings<'g, 's, P: AsRef<str>>(
} else if !silent { } else if !silent {
println!( println!(
"{color}Entire document passes.{reset}", "{color}Entire document passes.{reset}",
color = foreground_color(0, 255, 0), color = DiffResult::foreground_color(0, 255, 0),
reset = reset_color(), reset = DiffResult::reset_color(),
); );
} }
@ -122,8 +120,8 @@ pub async fn run_compare_on_file_with_settings<'g, 's, P: AsRef<Path>>(
} else if !silent { } else if !silent {
println!( println!(
"{color}Entire document passes.{reset}", "{color}Entire document passes.{reset}",
color = foreground_color(0, 255, 0), color = DiffResult::foreground_color(0, 255, 0),
reset = reset_color(), reset = DiffResult::reset_color(),
); );
} }

View File

@ -109,8 +109,6 @@ use crate::types::Verbatim;
use crate::types::VerseBlock; use crate::types::VerseBlock;
use crate::types::WarningDelayType; use crate::types::WarningDelayType;
use crate::types::Year; use crate::types::Year;
use crate::util::foreground_color;
use crate::util::reset_color;
#[derive(Debug)] #[derive(Debug)]
pub enum DiffEntry<'b, 's> { pub enum DiffEntry<'b, 's> {
@ -202,21 +200,21 @@ impl<'b, 's> DiffResult<'b, 's> {
if self.has_bad_children() { if self.has_bad_children() {
format!( format!(
"{color}BADCHILD{reset}", "{color}BADCHILD{reset}",
color = foreground_color(255, 255, 0), color = DiffResult::foreground_color(255, 255, 0),
reset = reset_color(), reset = DiffResult::reset_color(),
) )
} else { } else {
format!( format!(
"{color}GOOD{reset}", "{color}GOOD{reset}",
color = foreground_color(0, 255, 0), color = DiffResult::foreground_color(0, 255, 0),
reset = reset_color(), reset = DiffResult::reset_color(),
) )
} }
} }
DiffStatus::Bad => format!( DiffStatus::Bad => format!(
"{color}BAD{reset}", "{color}BAD{reset}",
color = foreground_color(255, 0, 0), color = DiffResult::foreground_color(255, 0, 0),
reset = reset_color(), reset = DiffResult::reset_color(),
), ),
} }
}; };
@ -241,6 +239,45 @@ impl<'b, 's> DiffResult<'b, 's> {
.iter() .iter()
.any(|child| child.is_immediately_bad() || child.has_bad_children()) .any(|child| child.is_immediately_bad() || child.has_bad_children())
} }
pub(crate) fn foreground_color(red: u8, green: u8, blue: u8) -> String {
if DiffResult::should_use_color() {
format!(
"\x1b[38;2;{red};{green};{blue}m",
red = red,
green = green,
blue = blue
)
} else {
String::new()
}
}
#[allow(dead_code)]
pub(crate) fn background_color(red: u8, green: u8, blue: u8) -> String {
if DiffResult::should_use_color() {
format!(
"\x1b[48;2;{red};{green};{blue}m",
red = red,
green = green,
blue = blue
)
} else {
String::new()
}
}
pub(crate) fn reset_color() -> &'static str {
if DiffResult::should_use_color() {
"\x1b[0m"
} else {
""
}
}
fn should_use_color() -> bool {
!std::env::var("NO_COLOR").is_ok_and(|val| !val.is_empty())
}
} }
impl<'b, 's> DiffLayer<'b, 's> { impl<'b, 's> DiffLayer<'b, 's> {
@ -258,14 +295,14 @@ impl<'b, 's> DiffLayer<'b, 's> {
let status_text = if self.has_bad_children() { let status_text = if self.has_bad_children() {
format!( format!(
"{color}BADCHILD{reset}", "{color}BADCHILD{reset}",
color = foreground_color(255, 255, 0), color = DiffResult::foreground_color(255, 255, 0),
reset = reset_color(), reset = DiffResult::reset_color(),
) )
} else { } else {
format!( format!(
"{color}GOOD{reset}", "{color}GOOD{reset}",
color = foreground_color(0, 255, 0), color = DiffResult::foreground_color(0, 255, 0),
reset = reset_color(), reset = DiffResult::reset_color(),
) )
}; };
println!( println!(

View File

@ -1,4 +1,3 @@
use std::borrow::Cow;
use std::path::Path; use std::path::Path;
use tokio::process::Command; use tokio::process::Command;
@ -190,44 +189,3 @@ fn global_settings_elisp(global_settings: &GlobalSettings) -> String {
} }
ret ret
} }
fn should_use_color() -> bool {
!std::env::var("NO_COLOR").is_ok_and(|val| !val.is_empty())
}
pub(crate) fn foreground_color(red: u8, green: u8, blue: u8) -> Cow<'static, str> {
if should_use_color() {
format!(
"\x1b[38;2;{red};{green};{blue}m",
red = red,
green = green,
blue = blue
)
.into()
} else {
Cow::from("")
}
}
#[allow(dead_code)]
pub(crate) fn background_color(red: u8, green: u8, blue: u8) -> Cow<'static, str> {
if should_use_color() {
format!(
"\x1b[48;2;{red};{green};{blue}m",
red = red,
green = green,
blue = blue
)
.into()
} else {
Cow::from("")
}
}
pub(crate) fn reset_color() -> &'static str {
if should_use_color() {
"\x1b[0m"
} else {
""
}
}

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::AngleLink;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::AngleLink;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmAngleLink<'s, 'p> { pub(crate) struct WasmAngleLink<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmAngleLink<'s, 'p>, WasmAngleLink<'s>,
AngleLink<'s>, AngleLink<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmAngleLink { Ok(WasmAngleLink {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -61,68 +61,68 @@ use super::verse_block::WasmVerseBlock;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum WasmAstNode<'s, 'p> { pub enum WasmAstNode<'s> {
// Document Nodes // Document Nodes
Document(WasmDocument<'s, 'p>), Document(WasmDocument<'s>),
Headline(WasmHeadline<'s, 'p>), Headline(WasmHeadline<'s>),
Section(WasmSection<'s, 'p>), Section(WasmSection<'s>),
// Elements // Elements
Paragraph(WasmParagraph<'s, 'p>), Paragraph(WasmParagraph<'s>),
PlainList(WasmPlainList<'s, 'p>), PlainList(WasmPlainList<'s>),
PlainListItem(WasmPlainListItem<'s, 'p>), PlainListItem(WasmPlainListItem<'s>),
CenterBlock(WasmCenterBlock<'s, 'p>), CenterBlock(WasmCenterBlock<'s>),
QuoteBlock(WasmQuoteBlock<'s, 'p>), QuoteBlock(WasmQuoteBlock<'s>),
SpecialBlock(WasmSpecialBlock<'s, 'p>), SpecialBlock(WasmSpecialBlock<'s>),
DynamicBlock(WasmDynamicBlock<'s, 'p>), DynamicBlock(WasmDynamicBlock<'s>),
FootnoteDefinition(WasmFootnoteDefinition<'s, 'p>), FootnoteDefinition(WasmFootnoteDefinition<'s>),
Comment(WasmComment<'s, 'p>), Comment(WasmComment<'s>),
Drawer(WasmDrawer<'s, 'p>), Drawer(WasmDrawer<'s>),
PropertyDrawer(WasmPropertyDrawer<'s, 'p>), PropertyDrawer(WasmPropertyDrawer<'s>),
NodeProperty(WasmNodeProperty<'s, 'p>), NodeProperty(WasmNodeProperty<'s>),
Table(WasmTable<'s, 'p>), Table(WasmTable<'s>),
TableRow(WasmTableRow<'s, 'p>), TableRow(WasmTableRow<'s>),
VerseBlock(WasmVerseBlock<'s, 'p>), VerseBlock(WasmVerseBlock<'s>),
CommentBlock(WasmCommentBlock<'s, 'p>), CommentBlock(WasmCommentBlock<'s>),
ExampleBlock(WasmExampleBlock<'s, 'p>), ExampleBlock(WasmExampleBlock<'s>),
ExportBlock(WasmExportBlock<'s, 'p>), ExportBlock(WasmExportBlock<'s>),
SrcBlock(WasmSrcBlock<'s, 'p>), SrcBlock(WasmSrcBlock<'s>),
Clock(WasmClock<'s, 'p>), Clock(WasmClock<'s>),
DiarySexp(WasmDiarySexp<'s, 'p>), DiarySexp(WasmDiarySexp<'s>),
Planning(WasmPlanning<'s, 'p>), Planning(WasmPlanning<'s>),
FixedWidthArea(WasmFixedWidthArea<'s, 'p>), FixedWidthArea(WasmFixedWidthArea<'s>),
HorizontalRule(WasmHorizontalRule<'s, 'p>), HorizontalRule(WasmHorizontalRule<'s>),
Keyword(WasmKeyword<'s, 'p>), Keyword(WasmKeyword<'s>),
BabelCall(WasmBabelCall<'s, 'p>), BabelCall(WasmBabelCall<'s>),
LatexEnvironment(WasmLatexEnvironment<'s, 'p>), LatexEnvironment(WasmLatexEnvironment<'s>),
// Objects // Objects
Bold(WasmBold<'s, 'p>), Bold(WasmBold<'s>),
Italic(WasmItalic<'s, 'p>), Italic(WasmItalic<'s>),
Underline(WasmUnderline<'s, 'p>), Underline(WasmUnderline<'s>),
StrikeThrough(WasmStrikeThrough<'s, 'p>), StrikeThrough(WasmStrikeThrough<'s>),
Code(WasmCode<'s, 'p>), Code(WasmCode<'s>),
Verbatim(WasmVerbatim<'s, 'p>), Verbatim(WasmVerbatim<'s>),
PlainText(WasmPlainText<'s, 'p>), PlainText(WasmPlainText<'s>),
RegularLink(WasmRegularLink<'s, 'p>), RegularLink(WasmRegularLink<'s>),
RadioLink(WasmRadioLink<'s, 'p>), RadioLink(WasmRadioLink<'s>),
RadioTarget(WasmRadioTarget<'s, 'p>), RadioTarget(WasmRadioTarget<'s>),
PlainLink(WasmPlainLink<'s, 'p>), PlainLink(WasmPlainLink<'s>),
AngleLink(WasmAngleLink<'s, 'p>), AngleLink(WasmAngleLink<'s>),
OrgMacro(WasmOrgMacro<'s, 'p>), OrgMacro(WasmOrgMacro<'s>),
Entity(WasmEntity<'s, 'p>), Entity(WasmEntity<'s>),
LatexFragment(WasmLatexFragment<'s, 'p>), LatexFragment(WasmLatexFragment<'s>),
ExportSnippet(WasmExportSnippet<'s, 'p>), ExportSnippet(WasmExportSnippet<'s>),
FootnoteReference(WasmFootnoteReference<'s, 'p>), FootnoteReference(WasmFootnoteReference<'s>),
Citation(WasmCitation<'s, 'p>), Citation(WasmCitation<'s>),
CitationReference(WasmCitationReference<'s, 'p>), CitationReference(WasmCitationReference<'s>),
InlineBabelCall(WasmInlineBabelCall<'s, 'p>), InlineBabelCall(WasmInlineBabelCall<'s>),
InlineSourceBlock(WasmInlineSourceBlock<'s, 'p>), InlineSourceBlock(WasmInlineSourceBlock<'s>),
LineBreak(WasmLineBreak<'s, 'p>), LineBreak(WasmLineBreak<'s>),
Target(WasmTarget<'s, 'p>), Target(WasmTarget<'s>),
StatisticsCookie(WasmStatisticsCookie<'s, 'p>), StatisticsCookie(WasmStatisticsCookie<'s>),
Subscript(WasmSubscript<'s, 'p>), Subscript(WasmSubscript<'s>),
Superscript(WasmSuperscript<'s, 'p>), Superscript(WasmSuperscript<'s>),
TableCell(WasmTableCell<'s, 'p>), TableCell(WasmTableCell<'s>),
Timestamp(WasmTimestamp<'s, 'p>), Timestamp(WasmTimestamp<'s>),
} }
impl<'s, 'p> WasmAstNode<'s, 'p> {} impl<'s> WasmAstNode<'s> {}

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::BabelCall;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::BabelCall;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmBabelCall<'s, 'p> { pub(crate) struct WasmBabelCall<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmBabelCall<'s, 'p>, WasmBabelCall<'s>,
BabelCall<'s>, BabelCall<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmBabelCall { Ok(WasmBabelCall {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,3 +1,6 @@
use std::marker::PhantomData;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
@ -5,18 +8,18 @@ use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Bold; use crate::types::Bold;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmBold<'s, 'p> { pub(crate) struct WasmBold<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmBold<'s, 'p>, WasmBold<'s>,
Bold<'s>, Bold<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmBold { Ok(WasmBold {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::CenterBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::CenterBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmCenterBlock<'s, 'p> { pub(crate) struct WasmCenterBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmCenterBlock<'s, 'p>, WasmCenterBlock<'s>,
CenterBlock<'s>, CenterBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmCenterBlock { Ok(WasmCenterBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Citation;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Citation;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmCitation<'s, 'p> { pub(crate) struct WasmCitation<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmCitation<'s, 'p>, WasmCitation<'s>,
Citation<'s>, Citation<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmCitation { Ok(WasmCitation {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::CitationReference;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::CitationReference;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmCitationReference<'s, 'p> { pub(crate) struct WasmCitationReference<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmCitationReference<'s, 'p>, WasmCitationReference<'s>,
CitationReference<'s>, CitationReference<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmCitationReference { Ok(WasmCitationReference {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Clock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Clock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmClock<'s, 'p> { pub(crate) struct WasmClock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmClock<'s, 'p>, WasmClock<'s>,
Clock<'s>, Clock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmClock { Ok(WasmClock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Code;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Code;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmCode<'s, 'p> { pub(crate) struct WasmCode<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmCode<'s, 'p>, WasmCode<'s>,
Code<'s>, Code<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmCode { Ok(WasmCode {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Comment;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Comment;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmComment<'s, 'p> { pub(crate) struct WasmComment<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmComment<'s, 'p>, WasmComment<'s>,
Comment<'s>, Comment<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmComment { Ok(WasmComment {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::CommentBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::CommentBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmCommentBlock<'s, 'p> { pub(crate) struct WasmCommentBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmCommentBlock<'s, 'p>, WasmCommentBlock<'s>,
CommentBlock<'s>, CommentBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmCommentBlock { Ok(WasmCommentBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::DiarySexp;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::DiarySexp;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmDiarySexp<'s, 'p> { pub(crate) struct WasmDiarySexp<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmDiarySexp<'s, 'p>, WasmDiarySexp<'s>,
DiarySexp<'s>, DiarySexp<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmDiarySexp { Ok(WasmDiarySexp {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,5 +1,3 @@
use std::path::PathBuf;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode; use super::ast_node::WasmAstNode;
@ -12,24 +10,19 @@ use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmDocument<'s, 'p> { pub struct WasmDocument<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
additional_properties: Vec<(String, &'s str)>, additional_properties: Vec<(String, &'s str)>,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<WasmAstNode<'s>>,
category: Option<&'p str>,
path: Option<PathBuf>,
} }
to_wasm!( to_wasm!(
WasmDocument<'s, 'p>, WasmDocument<'s>,
Document<'s>, Document<'s>,
original, original,
wasm_context, wasm_context,
standard_properties, standard_properties,
{ {
let category = original.category.as_ref().map(String::as_str);
let path = original.path.clone();
let additional_properties: Vec<(String, &str)> = original let additional_properties: Vec<(String, &str)> = original
.get_additional_properties() .get_additional_properties()
.map(|node_property| { .map(|node_property| {
@ -46,27 +39,34 @@ to_wasm!(
.map(|child| { .map(|child| {
child child
.to_wasm(wasm_context.clone()) .to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode<'_, '_>>::into) .map(Into::<WasmAstNode<'_>>::into)
}) })
.chain(original.children.iter().map(|child| { .chain(original.children.iter().map(|child| {
child child
.to_wasm(wasm_context.clone()) .to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode<'_, '_>>::into) .map(Into::<WasmAstNode<'_>>::into)
})) }))
.collect::<Result<Vec<_>, _>>()?; .collect::<Result<Vec<_>, _>>()?;
// let children = original
// .children
// .iter()
// .map(|child| {
// child
// .to_wasm(wasm_context.clone())
// .map(Into::<WasmAstNode<'_>>::into)
// })
// .collect::<Result<Vec<_>, _>>()?;
Ok(WasmDocument { Ok(WasmDocument {
standard_properties, standard_properties,
additional_properties, additional_properties,
children, children,
category,
path,
}) })
} }
); );
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmDocument<'s, 'p> { impl<'s> Into<WasmAstNode<'s>> for WasmDocument<'s> {
fn into(self) -> WasmAstNode<'s, 'p> { fn into(self) -> WasmAstNode<'s> {
WasmAstNode::Document(self) WasmAstNode::Document(self)
} }
} }

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Drawer;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Drawer;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmDrawer<'s, 'p> { pub(crate) struct WasmDrawer<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmDrawer<'s, 'p>, WasmDrawer<'s>,
Drawer<'s>, Drawer<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmDrawer { Ok(WasmDrawer {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::DynamicBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::DynamicBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmDynamicBlock<'s, 'p> { pub(crate) struct WasmDynamicBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmDynamicBlock<'s, 'p>, WasmDynamicBlock<'s>,
DynamicBlock<'s>, DynamicBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmDynamicBlock { Ok(WasmDynamicBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Entity;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Entity;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmEntity<'s, 'p> { pub(crate) struct WasmEntity<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmEntity<'s, 'p>, WasmEntity<'s>,
Entity<'s>, Entity<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmEntity { Ok(WasmEntity {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::ExampleBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::ExampleBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmExampleBlock<'s, 'p> { pub(crate) struct WasmExampleBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmExampleBlock<'s, 'p>, WasmExampleBlock<'s>,
ExampleBlock<'s>, ExampleBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmExampleBlock { Ok(WasmExampleBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::ExportBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::ExportBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmExportBlock<'s, 'p> { pub(crate) struct WasmExportBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmExportBlock<'s, 'p>, WasmExportBlock<'s>,
ExportBlock<'s>, ExportBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmExportBlock { Ok(WasmExportBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::ExportSnippet;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::ExportSnippet;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmExportSnippet<'s, 'p> { pub(crate) struct WasmExportSnippet<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmExportSnippet<'s, 'p>, WasmExportSnippet<'s>,
ExportSnippet<'s>, ExportSnippet<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmExportSnippet { Ok(WasmExportSnippet {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::FixedWidthArea;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::FixedWidthArea;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmFixedWidthArea<'s, 'p> { pub(crate) struct WasmFixedWidthArea<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmFixedWidthArea<'s, 'p>, WasmFixedWidthArea<'s>,
FixedWidthArea<'s>, FixedWidthArea<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmFixedWidthArea { Ok(WasmFixedWidthArea {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::FootnoteDefinition;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::FootnoteDefinition;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmFootnoteDefinition<'s, 'p> { pub(crate) struct WasmFootnoteDefinition<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmFootnoteDefinition<'s, 'p>, WasmFootnoteDefinition<'s>,
FootnoteDefinition<'s>, FootnoteDefinition<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmFootnoteDefinition { Ok(WasmFootnoteDefinition {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::FootnoteReference;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::FootnoteReference;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmFootnoteReference<'s, 'p> { pub(crate) struct WasmFootnoteReference<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmFootnoteReference<'s, 'p>, WasmFootnoteReference<'s>,
FootnoteReference<'s>, FootnoteReference<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmFootnoteReference { Ok(WasmFootnoteReference {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Heading;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode; use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Heading;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "headline")] #[serde(rename = "headline")]
pub struct WasmHeadline<'s, 'p> { pub(crate) struct WasmHeadline<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmHeadline<'s, 'p>, WasmHeadline<'s>,
Heading<'s>, Heading<'s>,
original, original,
wasm_context, wasm_context,
@ -25,12 +28,13 @@ to_wasm!(
Ok(WasmHeadline { Ok(WasmHeadline {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmHeadline<'s, 'p> { impl<'s> Into<WasmAstNode<'s>> for WasmHeadline<'s> {
fn into(self) -> WasmAstNode<'s, 'p> { fn into(self) -> WasmAstNode<'s> {
WasmAstNode::Headline(self) WasmAstNode::Headline(self)
} }
} }

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::HorizontalRule;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::HorizontalRule;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmHorizontalRule<'s, 'p> { pub(crate) struct WasmHorizontalRule<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmHorizontalRule<'s, 'p>, WasmHorizontalRule<'s>,
HorizontalRule<'s>, HorizontalRule<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmHorizontalRule { Ok(WasmHorizontalRule {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::InlineBabelCall;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::InlineBabelCall;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmInlineBabelCall<'s, 'p> { pub(crate) struct WasmInlineBabelCall<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmInlineBabelCall<'s, 'p>, WasmInlineBabelCall<'s>,
InlineBabelCall<'s>, InlineBabelCall<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmInlineBabelCall { Ok(WasmInlineBabelCall {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::InlineSourceBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::InlineSourceBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmInlineSourceBlock<'s, 'p> { pub(crate) struct WasmInlineSourceBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmInlineSourceBlock<'s, 'p>, WasmInlineSourceBlock<'s>,
InlineSourceBlock<'s>, InlineSourceBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmInlineSourceBlock { Ok(WasmInlineSourceBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Italic;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Italic;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmItalic<'s, 'p> { pub(crate) struct WasmItalic<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmItalic<'s, 'p>, WasmItalic<'s>,
Italic<'s>, Italic<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmItalic { Ok(WasmItalic {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Keyword;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Keyword;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmKeyword<'s, 'p> { pub(crate) struct WasmKeyword<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmKeyword<'s, 'p>, WasmKeyword<'s>,
Keyword<'s>, Keyword<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmKeyword { Ok(WasmKeyword {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::LatexEnvironment;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::LatexEnvironment;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmLatexEnvironment<'s, 'p> { pub(crate) struct WasmLatexEnvironment<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmLatexEnvironment<'s, 'p>, WasmLatexEnvironment<'s>,
LatexEnvironment<'s>, LatexEnvironment<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmLatexEnvironment { Ok(WasmLatexEnvironment {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::LatexFragment;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::LatexFragment;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmLatexFragment<'s, 'p> { pub(crate) struct WasmLatexFragment<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmLatexFragment<'s, 'p>, WasmLatexFragment<'s>,
LatexFragment<'s>, LatexFragment<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmLatexFragment { Ok(WasmLatexFragment {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::LineBreak;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::LineBreak;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmLineBreak<'s, 'p> { pub(crate) struct WasmLineBreak<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmLineBreak<'s, 'p>, WasmLineBreak<'s>,
LineBreak<'s>, LineBreak<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmLineBreak { Ok(WasmLineBreak {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -3,11 +3,11 @@
/// This exists to make changing the type signature easier. /// This exists to make changing the type signature easier.
macro_rules! to_wasm { macro_rules! to_wasm {
($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => { ($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; type Output = $ostruct;
fn to_wasm( fn to_wasm(
&'p self, &self,
$wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>, $wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>,
) -> Result<Self::Output, crate::error::CustomError> { ) -> Result<Self::Output, crate::error::CustomError> {
let $original = self; let $original = self;

View File

@ -62,8 +62,8 @@ mod underline;
mod verbatim; mod verbatim;
mod verse_block; mod verse_block;
pub use ast_node::WasmAstNode;
pub use document::WasmDocument; pub use document::WasmDocument;
pub use parse_result::wasm_parse_org;
pub use parse_result::ParseResult; pub use parse_result::ParseResult;
pub use to_wasm::ToWasm; pub(crate) use to_wasm::ToWasm;
pub use to_wasm::ToWasmContext; pub(crate) use to_wasm::ToWasmContext;

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::NodeProperty;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::NodeProperty;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmNodeProperty<'s, 'p> { pub(crate) struct WasmNodeProperty<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmNodeProperty<'s, 'p>, WasmNodeProperty<'s>,
NodeProperty<'s>, NodeProperty<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmNodeProperty { Ok(WasmNodeProperty {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::OrgMacro;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::OrgMacro;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmOrgMacro<'s, 'p> { pub(crate) struct WasmOrgMacro<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmOrgMacro<'s, 'p>, WasmOrgMacro<'s>,
OrgMacro<'s>, OrgMacro<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmOrgMacro { Ok(WasmOrgMacro {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Paragraph;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Paragraph;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmParagraph<'s, 'p> { pub(crate) struct WasmParagraph<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmParagraph<'s, 'p>, WasmParagraph<'s>,
Paragraph<'s>, Paragraph<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmParagraph { Ok(WasmParagraph {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,13 +1,32 @@
use serde::Serialize; use serde::Serialize;
use super::document::WasmDocument; use super::document::WasmDocument;
use super::ToWasm;
use super::ToWasmContext;
use crate::parser::parse_with_settings;
use crate::settings::GlobalSettings;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "status", content = "content")] #[serde(tag = "status", content = "content")]
pub enum ParseResult<'s, 'p> { pub enum ParseResult<'s> {
#[serde(rename = "success")] #[serde(rename = "success")]
Success(WasmDocument<'s, 'p>), Success(WasmDocument<'s>),
#[serde(rename = "error")] #[serde(rename = "error")]
Error(String), Error(String),
} }
pub fn wasm_parse_org(org_contents: &str) -> ParseResult<'_> {
let global_settings = GlobalSettings::default();
let to_wasm_context = ToWasmContext::new(org_contents);
let rust_parsed = match parse_with_settings(org_contents, &global_settings)
.map(|document| document.to_wasm(to_wasm_context))
.map(|wasm_document| match wasm_document {
Ok(wasm_document) => ParseResult::Success(wasm_document),
Err(err) => ParseResult::Error(format!("{:?}", err)),
}) {
Ok(wasm_document) => wasm_document,
Err(err) => ParseResult::Error(format!("{:?}", err)),
};
rust_parsed
}

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::PlainLink;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::PlainLink;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmPlainLink<'s, 'p> { pub(crate) struct WasmPlainLink<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmPlainLink<'s, 'p>, WasmPlainLink<'s>,
PlainLink<'s>, PlainLink<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmPlainLink { Ok(WasmPlainLink {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::PlainList;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::PlainList;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmPlainList<'s, 'p> { pub(crate) struct WasmPlainList<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmPlainList<'s, 'p>, WasmPlainList<'s>,
PlainList<'s>, PlainList<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmPlainList { Ok(WasmPlainList {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::PlainListItem;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::PlainListItem;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmPlainListItem<'s, 'p> { pub(crate) struct WasmPlainListItem<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmPlainListItem<'s, 'p>, WasmPlainListItem<'s>,
PlainListItem<'s>, PlainListItem<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmPlainListItem { Ok(WasmPlainListItem {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::PlainText;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::PlainText;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmPlainText<'s, 'p> { pub(crate) struct WasmPlainText<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmPlainText<'s, 'p>, WasmPlainText<'s>,
PlainText<'s>, PlainText<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmPlainText { Ok(WasmPlainText {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Planning;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Planning;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmPlanning<'s, 'p> { pub(crate) struct WasmPlanning<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmPlanning<'s, 'p>, WasmPlanning<'s>,
Planning<'s>, Planning<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmPlanning { Ok(WasmPlanning {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::PropertyDrawer;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::PropertyDrawer;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmPropertyDrawer<'s, 'p> { pub(crate) struct WasmPropertyDrawer<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmPropertyDrawer<'s, 'p>, WasmPropertyDrawer<'s>,
PropertyDrawer<'s>, PropertyDrawer<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmPropertyDrawer { Ok(WasmPropertyDrawer {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::QuoteBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::QuoteBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmQuoteBlock<'s, 'p> { pub(crate) struct WasmQuoteBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmQuoteBlock<'s, 'p>, WasmQuoteBlock<'s>,
QuoteBlock<'s>, QuoteBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmQuoteBlock { Ok(WasmQuoteBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::RadioLink;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::RadioLink;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmRadioLink<'s, 'p> { pub(crate) struct WasmRadioLink<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmRadioLink<'s, 'p>, WasmRadioLink<'s>,
RadioLink<'s>, RadioLink<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmRadioLink { Ok(WasmRadioLink {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::RadioTarget;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::RadioTarget;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmRadioTarget<'s, 'p> { pub(crate) struct WasmRadioTarget<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmRadioTarget<'s, 'p>, WasmRadioTarget<'s>,
RadioTarget<'s>, RadioTarget<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmRadioTarget { Ok(WasmRadioTarget {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::RegularLink;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::RegularLink;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmRegularLink<'s, 'p> { pub(crate) struct WasmRegularLink<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmRegularLink<'s, 'p>, WasmRegularLink<'s>,
RegularLink<'s>, RegularLink<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmRegularLink { Ok(WasmRegularLink {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Section;
use serde::Serialize; use serde::Serialize;
use super::ast_node::WasmAstNode; use super::ast_node::WasmAstNode;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Section;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "section")] #[serde(rename = "section")]
pub struct WasmSection<'s, 'p> { pub(crate) struct WasmSection<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmSection<'s, 'p>, WasmSection<'s>,
Section<'s>, Section<'s>,
original, original,
wasm_context, wasm_context,
@ -25,12 +28,13 @@ to_wasm!(
Ok(WasmSection { Ok(WasmSection {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmSection<'s, 'p> { impl<'s> Into<WasmAstNode<'s>> for WasmSection<'s> {
fn into(self) -> WasmAstNode<'s, 'p> { fn into(self) -> WasmAstNode<'s> {
WasmAstNode::Section(self) WasmAstNode::Section(self)
} }
} }

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::SpecialBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::SpecialBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmSpecialBlock<'s, 'p> { pub(crate) struct WasmSpecialBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmSpecialBlock<'s, 'p>, WasmSpecialBlock<'s>,
SpecialBlock<'s>, SpecialBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmSpecialBlock { Ok(WasmSpecialBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::SrcBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::SrcBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmSrcBlock<'s, 'p> { pub(crate) struct WasmSrcBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmSrcBlock<'s, 'p>, WasmSrcBlock<'s>,
SrcBlock<'s>, SrcBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmSrcBlock { Ok(WasmSrcBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,9 +1,10 @@
use crate::types::PostBlank;
use crate::types::StandardProperties;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::to_wasm::ToWasmContext; use super::to_wasm::ToWasmContext;
use super::to_wasm::ToWasmStandardProperties; use super::to_wasm::ToWasmStandardProperties;
use crate::types::PostBlank;
use crate::types::StandardProperties;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
pub(crate) struct WasmStandardProperties { pub(crate) struct WasmStandardProperties {

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::StatisticsCookie;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::StatisticsCookie;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmStatisticsCookie<'s, 'p> { pub(crate) struct WasmStatisticsCookie<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmStatisticsCookie<'s, 'p>, WasmStatisticsCookie<'s>,
StatisticsCookie<'s>, StatisticsCookie<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmStatisticsCookie { Ok(WasmStatisticsCookie {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::StrikeThrough;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::StrikeThrough;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmStrikeThrough<'s, 'p> { pub(crate) struct WasmStrikeThrough<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmStrikeThrough<'s, 'p>, WasmStrikeThrough<'s>,
StrikeThrough<'s>, StrikeThrough<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmStrikeThrough { Ok(WasmStrikeThrough {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Subscript;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Subscript;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmSubscript<'s, 'p> { pub(crate) struct WasmSubscript<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmSubscript<'s, 'p>, WasmSubscript<'s>,
Subscript<'s>, Subscript<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmSubscript { Ok(WasmSubscript {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Superscript;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Superscript;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmSuperscript<'s, 'p> { pub(crate) struct WasmSuperscript<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmSuperscript<'s, 'p>, WasmSuperscript<'s>,
Superscript<'s>, Superscript<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmSuperscript { Ok(WasmSuperscript {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Table;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Table;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmTable<'s, 'p> { pub(crate) struct WasmTable<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmTable<'s, 'p>, WasmTable<'s>,
Table<'s>, Table<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmTable { Ok(WasmTable {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::TableCell;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::TableCell;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmTableCell<'s, 'p> { pub(crate) struct WasmTableCell<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmTableCell<'s, 'p>, WasmTableCell<'s>,
TableCell<'s>, TableCell<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmTableCell { Ok(WasmTableCell {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::TableRow;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::TableRow;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmTableRow<'s, 'p> { pub(crate) struct WasmTableRow<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmTableRow<'s, 'p>, WasmTableRow<'s>,
TableRow<'s>, TableRow<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmTableRow { Ok(WasmTableRow {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Target;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Target;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmTarget<'s, 'p> { pub(crate) struct WasmTarget<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmTarget<'s, 'p>, WasmTarget<'s>,
Target<'s>, Target<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmTarget { Ok(WasmTarget {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Timestamp;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Timestamp;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmTimestamp<'s, 'p> { pub(crate) struct WasmTimestamp<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmTimestamp<'s, 'p>, WasmTimestamp<'s>,
Timestamp<'s>, Timestamp<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmTimestamp { Ok(WasmTimestamp {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,9 +1,9 @@
use crate::error::CustomError; use crate::error::CustomError;
pub trait ToWasm<'p> { pub(crate) trait ToWasm {
type Output; 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 { pub(crate) trait ToWasmStandardProperties {
@ -16,12 +16,12 @@ pub(crate) trait ToWasmStandardProperties {
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ToWasmContext<'s> { pub(crate) struct ToWasmContext<'s> {
pub(crate) full_document: &'s str, pub(crate) full_document: &'s str,
} }
impl<'s> ToWasmContext<'s> { impl<'s> ToWasmContext<'s> {
pub fn new(full_document: &'s str) -> ToWasmContext<'s> { pub(crate) fn new(full_document: &'s str) -> ToWasmContext<'s> {
ToWasmContext { full_document } ToWasmContext { full_document }
} }
} }

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Underline;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Underline;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmUnderline<'s, 'p> { pub(crate) struct WasmUnderline<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmUnderline<'s, 'p>, WasmUnderline<'s>,
Underline<'s>, Underline<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmUnderline { Ok(WasmUnderline {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::Verbatim;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::Verbatim;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmVerbatim<'s, 'p> { pub(crate) struct WasmVerbatim<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmVerbatim<'s, 'p>, WasmVerbatim<'s>,
Verbatim<'s>, Verbatim<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmVerbatim { Ok(WasmVerbatim {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,22 +1,25 @@
use std::marker::PhantomData;
use crate::types::VerseBlock;
use serde::Deserialize;
use serde::Serialize; use serde::Serialize;
use super::macros::to_wasm; use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties; use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm; use super::to_wasm::ToWasm;
use crate::types::VerseBlock;
use crate::wasm::to_wasm::ToWasmStandardProperties; use crate::wasm::to_wasm::ToWasmStandardProperties;
use crate::wasm::WasmAstNode;
#[derive(Debug, Serialize)] #[derive(Debug, Serialize)]
#[serde(tag = "ast_node")] #[serde(tag = "ast_node")]
#[serde(rename = "org-data")] #[serde(rename = "org-data")]
pub struct WasmVerseBlock<'s, 'p> { pub(crate) struct WasmVerseBlock<'s> {
standard_properties: WasmStandardProperties, standard_properties: WasmStandardProperties,
children: Vec<WasmAstNode<'s, 'p>>, children: Vec<()>,
phantom: PhantomData<&'s ()>,
} }
to_wasm!( to_wasm!(
WasmVerseBlock<'s, 'p>, WasmVerseBlock<'s>,
VerseBlock<'s>, VerseBlock<'s>,
original, original,
wasm_context, wasm_context,
@ -25,6 +28,7 @@ to_wasm!(
Ok(WasmVerseBlock { Ok(WasmVerseBlock {
standard_properties, standard_properties,
children: Vec::new(), children: Vec::new(),
phantom: PhantomData,
}) })
} }
); );

View File

@ -1,185 +1,9 @@
use std::borrow::Cow;
use crate::compare::Token; use crate::compare::Token;
use crate::wasm::WasmAstNode;
use crate::wasm::WasmDocument; use crate::wasm::WasmDocument;
pub fn wasm_compare_document<'b, 's, 'p>( pub fn wasm_compare_document<'b, 's>(
source: &'s str,
emacs: &'b Token<'s>, emacs: &'b Token<'s>,
wasm: WasmDocument<'s, 'p>, wasm: &'b WasmDocument<'s>,
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
// wasm_compare_ast_node(
todo!()
}
#[derive(Debug)]
pub enum WasmDiffEntry<'b, 's> {
WasmDiffResult(WasmDiffResult<'b, 's>),
WasmDiffLayer(WasmDiffLayer<'b, 's>),
}
#[derive(Debug)]
pub struct WasmDiffResult<'b, 's> {
status: WasmDiffStatus,
name: Cow<'s, str>,
message: Option<String>,
children: Vec<WasmDiffEntry<'b, 's>>,
rust_source: &'s str,
#[allow(dead_code)]
emacs_token: &'b Token<'s>,
}
#[derive(Debug)]
pub(crate) enum WasmDiffStatus {
Good,
Bad,
}
#[derive(Debug)]
pub struct WasmDiffLayer<'b, 's> {
name: Cow<'s, str>,
children: Vec<WasmDiffEntry<'b, 's>>,
}
impl<'b, 's> WasmDiffEntry<'b, 's> {
// fn has_bad_children(&self) -> bool {
// match self {
// DiffEntry::DiffResult(diff) => &diff.children,
// DiffEntry::DiffLayer(diff) => &diff.children,
// }
// .iter()
// .any(|child| child.is_immediately_bad() || child.has_bad_children())
// }
// fn is_immediately_bad(&self) -> bool {
// match self {
// DiffEntry::DiffResult(diff) => matches!(diff.status, DiffStatus::Bad),
// DiffEntry::DiffLayer(_) => false,
// }
// }
pub fn is_bad(&self) -> bool {
todo!()
// self.is_immediately_bad() || self.has_bad_children()
}
pub fn print(&self, original_document: &str) -> Result<(), Box<dyn std::error::Error>> {
self.print_indented(0, original_document)
}
fn print_indented(
&self,
indentation: usize,
original_document: &str,
) -> Result<(), Box<dyn std::error::Error>> { ) -> Result<(), Box<dyn std::error::Error>> {
todo!() todo!()
// match self {
// WasmDiffEntry::WasmDiffResult(diff) => {
// diff.print_indented(indentation, original_document)
// }
// WasmDiffEntry::WasmDiffLayer(diff) => {
// diff.print_indented(indentation, original_document)
// }
// }
}
}
fn wasm_compare_ast_node<'b, 's, 'p>(
source: &'s str,
emacs: &'b Token<'s>,
wasm: WasmAstNode<'s, 'p>,
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
match wasm {
WasmAstNode::Document(_) => todo!(),
WasmAstNode::Headline(_) => todo!(),
WasmAstNode::Section(_) => todo!(),
WasmAstNode::Paragraph(_) => todo!(),
WasmAstNode::PlainList(_) => todo!(),
WasmAstNode::PlainListItem(_) => todo!(),
WasmAstNode::CenterBlock(_) => todo!(),
WasmAstNode::QuoteBlock(_) => todo!(),
WasmAstNode::SpecialBlock(_) => todo!(),
WasmAstNode::DynamicBlock(_) => todo!(),
WasmAstNode::FootnoteDefinition(_) => todo!(),
WasmAstNode::Comment(_) => todo!(),
WasmAstNode::Drawer(_) => todo!(),
WasmAstNode::PropertyDrawer(_) => todo!(),
WasmAstNode::NodeProperty(_) => todo!(),
WasmAstNode::Table(_) => todo!(),
WasmAstNode::TableRow(_) => todo!(),
WasmAstNode::VerseBlock(_) => todo!(),
WasmAstNode::CommentBlock(_) => todo!(),
WasmAstNode::ExampleBlock(_) => todo!(),
WasmAstNode::ExportBlock(_) => todo!(),
WasmAstNode::SrcBlock(_) => todo!(),
WasmAstNode::Clock(_) => todo!(),
WasmAstNode::DiarySexp(_) => todo!(),
WasmAstNode::Planning(_) => todo!(),
WasmAstNode::FixedWidthArea(_) => todo!(),
WasmAstNode::HorizontalRule(_) => todo!(),
WasmAstNode::Keyword(_) => todo!(),
WasmAstNode::BabelCall(_) => todo!(),
WasmAstNode::LatexEnvironment(_) => todo!(),
WasmAstNode::Bold(_) => todo!(),
WasmAstNode::Italic(_) => todo!(),
WasmAstNode::Underline(_) => todo!(),
WasmAstNode::StrikeThrough(_) => todo!(),
WasmAstNode::Code(_) => todo!(),
WasmAstNode::Verbatim(_) => todo!(),
WasmAstNode::PlainText(_) => todo!(),
WasmAstNode::RegularLink(_) => todo!(),
WasmAstNode::RadioLink(_) => todo!(),
WasmAstNode::RadioTarget(_) => todo!(),
WasmAstNode::PlainLink(_) => todo!(),
WasmAstNode::AngleLink(_) => todo!(),
WasmAstNode::OrgMacro(_) => todo!(),
WasmAstNode::Entity(_) => todo!(),
WasmAstNode::LatexFragment(_) => todo!(),
WasmAstNode::ExportSnippet(_) => todo!(),
WasmAstNode::FootnoteReference(_) => todo!(),
WasmAstNode::Citation(_) => todo!(),
WasmAstNode::CitationReference(_) => todo!(),
WasmAstNode::InlineBabelCall(_) => todo!(),
WasmAstNode::InlineSourceBlock(_) => todo!(),
WasmAstNode::LineBreak(_) => todo!(),
WasmAstNode::Target(_) => todo!(),
WasmAstNode::StatisticsCookie(_) => todo!(),
WasmAstNode::Subscript(_) => todo!(),
WasmAstNode::Superscript(_) => todo!(),
WasmAstNode::TableCell(_) => todo!(),
WasmAstNode::Timestamp(_) => todo!(),
}
todo!()
}
// fn wasm_compare_list<'b, 's, EI, WI, WC>(
// source: &'s str,
// emacs: EI,
// wasm: WI,
// // emacs: &'b Token<'s>,
// // wasm: WasmDocument<'s>,
// ) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>>
// where
// EI: Iterator<Item = &'b Token<'s>> + ExactSizeIterator,
// WI: Iterator<Item = WC>,
// WasmAstNode<'b, 's>: From<WC>,
// {
// let mut this_status = WasmDiffStatus::Good;
// let mut child_status = Vec::new();
// let mut message = None;
// todo!()
// }
fn impl_wasm_compare_document<'b, 's, 'p>(
source: &'s str,
emacs: &'b Token<'s>,
wasm: WasmDocument<'s, 'p>,
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
let mut this_status = WasmDiffStatus::Good;
// let mut child_status = Vec::new();
// let mut message = None;
todo!()
} }

View File

@ -3,9 +3,7 @@ use crate::compare::sexp;
use crate::context::GlobalSettings; use crate::context::GlobalSettings;
use crate::parser::parse_with_settings; use crate::parser::parse_with_settings;
use crate::util::emacs_parse_anonymous_org_document; use crate::util::emacs_parse_anonymous_org_document;
use crate::util::foreground_color;
use crate::util::print_versions; use crate::util::print_versions;
use crate::util::reset_color;
use crate::wasm::ToWasm; use crate::wasm::ToWasm;
use crate::wasm::ToWasmContext; use crate::wasm::ToWasmContext;
@ -42,20 +40,20 @@ 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 // 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(&parsed_sexp, &wasm_parsed)?;
if !silent { // if !silent {
diff_result.print(org_contents)?; // diff_result.print(org_contents)?;
} // }
if diff_result.is_bad() { // if diff_result.is_bad() {
return Ok(false); // return Ok(false);
} else if !silent { // } else if !silent {
println!( // println!(
"{color}Entire document passes.{reset}", // "{color}Entire document passes.{reset}",
color = foreground_color(0, 255, 0), // color = DiffResult::foreground_color(0, 255, 0),
reset = reset_color(), // reset = DiffResult::reset_color(),
); // );
} // }
Ok(true) Ok(true)
} }