Compare commits
7 Commits
99376515ef
...
36b80dc093
Author | SHA1 | Date | |
---|---|---|---|
![]() |
36b80dc093 | ||
![]() |
1812b1a56e | ||
![]() |
1a70b3d2c0 | ||
![]() |
abf066701e | ||
![]() |
4984ea4179 | ||
![]() |
3cb251ea6c | ||
![]() |
4bfea41291 |
2
Makefile
2
Makefile
@ -36,7 +36,7 @@ wasm:
|
||||
|
||||
.PHONY: run_wasm
|
||||
run_wasm:
|
||||
> cat /tmp/test.org | cargo run --profile wasm --bin wasm_test --features wasm_test | jq
|
||||
> cat /tmp/test.org | cargo run --profile wasm --bin wasm_test --features wasm_test
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
@ -1,10 +1,28 @@
|
||||
use organic::wasm::wasm_parse_org;
|
||||
use organic::parser::parse_with_settings;
|
||||
use organic::settings::GlobalSettings;
|
||||
use organic::wasm::ParseResult;
|
||||
use organic::wasm::ToWasm;
|
||||
use organic::wasm::ToWasmContext;
|
||||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn parse_org(org_contents: &str) -> wasm_bindgen::JsValue {
|
||||
let rust_parsed = wasm_parse_org(org_contents);
|
||||
serde_wasm_bindgen::to_value(&rust_parsed).unwrap()
|
||||
let rust_parsed = match parse_with_settings(org_contents, &GlobalSettings::default()) {
|
||||
Ok(document) => document,
|
||||
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>> {
|
||||
|
@ -9,7 +9,9 @@ use crate::parser::parse_file_with_settings;
|
||||
use crate::parser::parse_with_settings;
|
||||
use crate::util::emacs_parse_anonymous_org_document;
|
||||
use crate::util::emacs_parse_file_org_document;
|
||||
use crate::util::foreground_color;
|
||||
use crate::util::print_versions;
|
||||
use crate::util::reset_color;
|
||||
|
||||
pub async fn run_anonymous_compare<P: AsRef<str>>(
|
||||
org_contents: P,
|
||||
@ -67,8 +69,8 @@ pub async fn run_anonymous_compare_with_settings<'g, 's, P: AsRef<str>>(
|
||||
} else if !silent {
|
||||
println!(
|
||||
"{color}Entire document passes.{reset}",
|
||||
color = DiffResult::foreground_color(0, 255, 0),
|
||||
reset = DiffResult::reset_color(),
|
||||
color = foreground_color(0, 255, 0),
|
||||
reset = reset_color(),
|
||||
);
|
||||
}
|
||||
|
||||
@ -120,8 +122,8 @@ pub async fn run_compare_on_file_with_settings<'g, 's, P: AsRef<Path>>(
|
||||
} else if !silent {
|
||||
println!(
|
||||
"{color}Entire document passes.{reset}",
|
||||
color = DiffResult::foreground_color(0, 255, 0),
|
||||
reset = DiffResult::reset_color(),
|
||||
color = foreground_color(0, 255, 0),
|
||||
reset = reset_color(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -109,6 +109,8 @@ use crate::types::Verbatim;
|
||||
use crate::types::VerseBlock;
|
||||
use crate::types::WarningDelayType;
|
||||
use crate::types::Year;
|
||||
use crate::util::foreground_color;
|
||||
use crate::util::reset_color;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum DiffEntry<'b, 's> {
|
||||
@ -200,21 +202,21 @@ impl<'b, 's> DiffResult<'b, 's> {
|
||||
if self.has_bad_children() {
|
||||
format!(
|
||||
"{color}BADCHILD{reset}",
|
||||
color = DiffResult::foreground_color(255, 255, 0),
|
||||
reset = DiffResult::reset_color(),
|
||||
color = foreground_color(255, 255, 0),
|
||||
reset = reset_color(),
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"{color}GOOD{reset}",
|
||||
color = DiffResult::foreground_color(0, 255, 0),
|
||||
reset = DiffResult::reset_color(),
|
||||
color = foreground_color(0, 255, 0),
|
||||
reset = reset_color(),
|
||||
)
|
||||
}
|
||||
}
|
||||
DiffStatus::Bad => format!(
|
||||
"{color}BAD{reset}",
|
||||
color = DiffResult::foreground_color(255, 0, 0),
|
||||
reset = DiffResult::reset_color(),
|
||||
color = foreground_color(255, 0, 0),
|
||||
reset = reset_color(),
|
||||
),
|
||||
}
|
||||
};
|
||||
@ -239,45 +241,6 @@ impl<'b, 's> DiffResult<'b, 's> {
|
||||
.iter()
|
||||
.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> {
|
||||
@ -295,14 +258,14 @@ impl<'b, 's> DiffLayer<'b, 's> {
|
||||
let status_text = if self.has_bad_children() {
|
||||
format!(
|
||||
"{color}BADCHILD{reset}",
|
||||
color = DiffResult::foreground_color(255, 255, 0),
|
||||
reset = DiffResult::reset_color(),
|
||||
color = foreground_color(255, 255, 0),
|
||||
reset = reset_color(),
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
"{color}GOOD{reset}",
|
||||
color = DiffResult::foreground_color(0, 255, 0),
|
||||
reset = DiffResult::reset_color(),
|
||||
color = foreground_color(0, 255, 0),
|
||||
reset = reset_color(),
|
||||
)
|
||||
};
|
||||
println!(
|
||||
|
@ -1,3 +1,4 @@
|
||||
use std::borrow::Cow;
|
||||
use std::path::Path;
|
||||
|
||||
use tokio::process::Command;
|
||||
@ -189,3 +190,44 @@ fn global_settings_elisp(global_settings: &GlobalSettings) -> String {
|
||||
}
|
||||
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 {
|
||||
""
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::AngleLink;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::AngleLink;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmAngleLink<'s> {
|
||||
pub struct WasmAngleLink<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmAngleLink<'s>,
|
||||
WasmAngleLink<'s, 'p>,
|
||||
AngleLink<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmAngleLink {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -61,68 +61,68 @@ use super::verse_block::WasmVerseBlock;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum WasmAstNode<'s> {
|
||||
pub enum WasmAstNode<'s, 'p> {
|
||||
// Document Nodes
|
||||
Document(WasmDocument<'s>),
|
||||
Headline(WasmHeadline<'s>),
|
||||
Section(WasmSection<'s>),
|
||||
Document(WasmDocument<'s, 'p>),
|
||||
Headline(WasmHeadline<'s, 'p>),
|
||||
Section(WasmSection<'s, 'p>),
|
||||
// Elements
|
||||
Paragraph(WasmParagraph<'s>),
|
||||
PlainList(WasmPlainList<'s>),
|
||||
PlainListItem(WasmPlainListItem<'s>),
|
||||
CenterBlock(WasmCenterBlock<'s>),
|
||||
QuoteBlock(WasmQuoteBlock<'s>),
|
||||
SpecialBlock(WasmSpecialBlock<'s>),
|
||||
DynamicBlock(WasmDynamicBlock<'s>),
|
||||
FootnoteDefinition(WasmFootnoteDefinition<'s>),
|
||||
Comment(WasmComment<'s>),
|
||||
Drawer(WasmDrawer<'s>),
|
||||
PropertyDrawer(WasmPropertyDrawer<'s>),
|
||||
NodeProperty(WasmNodeProperty<'s>),
|
||||
Table(WasmTable<'s>),
|
||||
TableRow(WasmTableRow<'s>),
|
||||
VerseBlock(WasmVerseBlock<'s>),
|
||||
CommentBlock(WasmCommentBlock<'s>),
|
||||
ExampleBlock(WasmExampleBlock<'s>),
|
||||
ExportBlock(WasmExportBlock<'s>),
|
||||
SrcBlock(WasmSrcBlock<'s>),
|
||||
Clock(WasmClock<'s>),
|
||||
DiarySexp(WasmDiarySexp<'s>),
|
||||
Planning(WasmPlanning<'s>),
|
||||
FixedWidthArea(WasmFixedWidthArea<'s>),
|
||||
HorizontalRule(WasmHorizontalRule<'s>),
|
||||
Keyword(WasmKeyword<'s>),
|
||||
BabelCall(WasmBabelCall<'s>),
|
||||
LatexEnvironment(WasmLatexEnvironment<'s>),
|
||||
Paragraph(WasmParagraph<'s, 'p>),
|
||||
PlainList(WasmPlainList<'s, 'p>),
|
||||
PlainListItem(WasmPlainListItem<'s, 'p>),
|
||||
CenterBlock(WasmCenterBlock<'s, 'p>),
|
||||
QuoteBlock(WasmQuoteBlock<'s, 'p>),
|
||||
SpecialBlock(WasmSpecialBlock<'s, 'p>),
|
||||
DynamicBlock(WasmDynamicBlock<'s, 'p>),
|
||||
FootnoteDefinition(WasmFootnoteDefinition<'s, 'p>),
|
||||
Comment(WasmComment<'s, 'p>),
|
||||
Drawer(WasmDrawer<'s, 'p>),
|
||||
PropertyDrawer(WasmPropertyDrawer<'s, 'p>),
|
||||
NodeProperty(WasmNodeProperty<'s, 'p>),
|
||||
Table(WasmTable<'s, 'p>),
|
||||
TableRow(WasmTableRow<'s, 'p>),
|
||||
VerseBlock(WasmVerseBlock<'s, 'p>),
|
||||
CommentBlock(WasmCommentBlock<'s, 'p>),
|
||||
ExampleBlock(WasmExampleBlock<'s, 'p>),
|
||||
ExportBlock(WasmExportBlock<'s, 'p>),
|
||||
SrcBlock(WasmSrcBlock<'s, 'p>),
|
||||
Clock(WasmClock<'s, 'p>),
|
||||
DiarySexp(WasmDiarySexp<'s, 'p>),
|
||||
Planning(WasmPlanning<'s, 'p>),
|
||||
FixedWidthArea(WasmFixedWidthArea<'s, 'p>),
|
||||
HorizontalRule(WasmHorizontalRule<'s, 'p>),
|
||||
Keyword(WasmKeyword<'s, 'p>),
|
||||
BabelCall(WasmBabelCall<'s, 'p>),
|
||||
LatexEnvironment(WasmLatexEnvironment<'s, 'p>),
|
||||
// Objects
|
||||
Bold(WasmBold<'s>),
|
||||
Italic(WasmItalic<'s>),
|
||||
Underline(WasmUnderline<'s>),
|
||||
StrikeThrough(WasmStrikeThrough<'s>),
|
||||
Code(WasmCode<'s>),
|
||||
Verbatim(WasmVerbatim<'s>),
|
||||
PlainText(WasmPlainText<'s>),
|
||||
RegularLink(WasmRegularLink<'s>),
|
||||
RadioLink(WasmRadioLink<'s>),
|
||||
RadioTarget(WasmRadioTarget<'s>),
|
||||
PlainLink(WasmPlainLink<'s>),
|
||||
AngleLink(WasmAngleLink<'s>),
|
||||
OrgMacro(WasmOrgMacro<'s>),
|
||||
Entity(WasmEntity<'s>),
|
||||
LatexFragment(WasmLatexFragment<'s>),
|
||||
ExportSnippet(WasmExportSnippet<'s>),
|
||||
FootnoteReference(WasmFootnoteReference<'s>),
|
||||
Citation(WasmCitation<'s>),
|
||||
CitationReference(WasmCitationReference<'s>),
|
||||
InlineBabelCall(WasmInlineBabelCall<'s>),
|
||||
InlineSourceBlock(WasmInlineSourceBlock<'s>),
|
||||
LineBreak(WasmLineBreak<'s>),
|
||||
Target(WasmTarget<'s>),
|
||||
StatisticsCookie(WasmStatisticsCookie<'s>),
|
||||
Subscript(WasmSubscript<'s>),
|
||||
Superscript(WasmSuperscript<'s>),
|
||||
TableCell(WasmTableCell<'s>),
|
||||
Timestamp(WasmTimestamp<'s>),
|
||||
Bold(WasmBold<'s, 'p>),
|
||||
Italic(WasmItalic<'s, 'p>),
|
||||
Underline(WasmUnderline<'s, 'p>),
|
||||
StrikeThrough(WasmStrikeThrough<'s, 'p>),
|
||||
Code(WasmCode<'s, 'p>),
|
||||
Verbatim(WasmVerbatim<'s, 'p>),
|
||||
PlainText(WasmPlainText<'s, 'p>),
|
||||
RegularLink(WasmRegularLink<'s, 'p>),
|
||||
RadioLink(WasmRadioLink<'s, 'p>),
|
||||
RadioTarget(WasmRadioTarget<'s, 'p>),
|
||||
PlainLink(WasmPlainLink<'s, 'p>),
|
||||
AngleLink(WasmAngleLink<'s, 'p>),
|
||||
OrgMacro(WasmOrgMacro<'s, 'p>),
|
||||
Entity(WasmEntity<'s, 'p>),
|
||||
LatexFragment(WasmLatexFragment<'s, 'p>),
|
||||
ExportSnippet(WasmExportSnippet<'s, 'p>),
|
||||
FootnoteReference(WasmFootnoteReference<'s, 'p>),
|
||||
Citation(WasmCitation<'s, 'p>),
|
||||
CitationReference(WasmCitationReference<'s, 'p>),
|
||||
InlineBabelCall(WasmInlineBabelCall<'s, 'p>),
|
||||
InlineSourceBlock(WasmInlineSourceBlock<'s, 'p>),
|
||||
LineBreak(WasmLineBreak<'s, 'p>),
|
||||
Target(WasmTarget<'s, 'p>),
|
||||
StatisticsCookie(WasmStatisticsCookie<'s, 'p>),
|
||||
Subscript(WasmSubscript<'s, 'p>),
|
||||
Superscript(WasmSuperscript<'s, 'p>),
|
||||
TableCell(WasmTableCell<'s, 'p>),
|
||||
Timestamp(WasmTimestamp<'s, 'p>),
|
||||
}
|
||||
|
||||
impl<'s> WasmAstNode<'s> {}
|
||||
impl<'s, 'p> WasmAstNode<'s, 'p> {}
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::BabelCall;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::BabelCall;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmBabelCall<'s> {
|
||||
pub struct WasmBabelCall<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmBabelCall<'s>,
|
||||
WasmBabelCall<'s, 'p>,
|
||||
BabelCall<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmBabelCall {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,6 +1,3 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
@ -8,18 +5,18 @@ use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Bold;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmBold<'s> {
|
||||
pub struct WasmBold<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmBold<'s>,
|
||||
WasmBold<'s, 'p>,
|
||||
Bold<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmBold {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::CenterBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::CenterBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmCenterBlock<'s> {
|
||||
pub struct WasmCenterBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCenterBlock<'s>,
|
||||
WasmCenterBlock<'s, 'p>,
|
||||
CenterBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmCenterBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Citation;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Citation;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmCitation<'s> {
|
||||
pub struct WasmCitation<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCitation<'s>,
|
||||
WasmCitation<'s, 'p>,
|
||||
Citation<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmCitation {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::CitationReference;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::CitationReference;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmCitationReference<'s> {
|
||||
pub struct WasmCitationReference<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCitationReference<'s>,
|
||||
WasmCitationReference<'s, 'p>,
|
||||
CitationReference<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmCitationReference {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Clock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Clock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmClock<'s> {
|
||||
pub struct WasmClock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmClock<'s>,
|
||||
WasmClock<'s, 'p>,
|
||||
Clock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmClock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Code;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Code;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmCode<'s> {
|
||||
pub struct WasmCode<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCode<'s>,
|
||||
WasmCode<'s, 'p>,
|
||||
Code<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmCode {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Comment;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Comment;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmComment<'s> {
|
||||
pub struct WasmComment<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmComment<'s>,
|
||||
WasmComment<'s, 'p>,
|
||||
Comment<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmComment {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::CommentBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::CommentBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmCommentBlock<'s> {
|
||||
pub struct WasmCommentBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmCommentBlock<'s>,
|
||||
WasmCommentBlock<'s, 'p>,
|
||||
CommentBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmCommentBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::DiarySexp;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::DiarySexp;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmDiarySexp<'s> {
|
||||
pub struct WasmDiarySexp<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmDiarySexp<'s>,
|
||||
WasmDiarySexp<'s, 'p>,
|
||||
DiarySexp<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmDiarySexp {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,3 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use super::ast_node::WasmAstNode;
|
||||
@ -10,19 +12,24 @@ use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub struct WasmDocument<'s> {
|
||||
pub struct WasmDocument<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
additional_properties: Vec<(String, &'s str)>,
|
||||
children: Vec<WasmAstNode<'s>>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
category: Option<&'p str>,
|
||||
path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmDocument<'s>,
|
||||
WasmDocument<'s, 'p>,
|
||||
Document<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
standard_properties,
|
||||
{
|
||||
let category = original.category.as_ref().map(String::as_str);
|
||||
let path = original.path.clone();
|
||||
|
||||
let additional_properties: Vec<(String, &str)> = original
|
||||
.get_additional_properties()
|
||||
.map(|node_property| {
|
||||
@ -39,34 +46,27 @@ to_wasm!(
|
||||
.map(|child| {
|
||||
child
|
||||
.to_wasm(wasm_context.clone())
|
||||
.map(Into::<WasmAstNode<'_>>::into)
|
||||
.map(Into::<WasmAstNode<'_, '_>>::into)
|
||||
})
|
||||
.chain(original.children.iter().map(|child| {
|
||||
child
|
||||
.to_wasm(wasm_context.clone())
|
||||
.map(Into::<WasmAstNode<'_>>::into)
|
||||
.map(Into::<WasmAstNode<'_, '_>>::into)
|
||||
}))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
// let children = original
|
||||
// .children
|
||||
// .iter()
|
||||
// .map(|child| {
|
||||
// child
|
||||
// .to_wasm(wasm_context.clone())
|
||||
// .map(Into::<WasmAstNode<'_>>::into)
|
||||
// })
|
||||
// .collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
Ok(WasmDocument {
|
||||
standard_properties,
|
||||
additional_properties,
|
||||
children,
|
||||
category,
|
||||
path,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s> Into<WasmAstNode<'s>> for WasmDocument<'s> {
|
||||
fn into(self) -> WasmAstNode<'s> {
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmDocument<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
WasmAstNode::Document(self)
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Drawer;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Drawer;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmDrawer<'s> {
|
||||
pub struct WasmDrawer<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmDrawer<'s>,
|
||||
WasmDrawer<'s, 'p>,
|
||||
Drawer<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmDrawer {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::DynamicBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::DynamicBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmDynamicBlock<'s> {
|
||||
pub struct WasmDynamicBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmDynamicBlock<'s>,
|
||||
WasmDynamicBlock<'s, 'p>,
|
||||
DynamicBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmDynamicBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Entity;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Entity;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmEntity<'s> {
|
||||
pub struct WasmEntity<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmEntity<'s>,
|
||||
WasmEntity<'s, 'p>,
|
||||
Entity<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmEntity {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::ExampleBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::ExampleBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmExampleBlock<'s> {
|
||||
pub struct WasmExampleBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmExampleBlock<'s>,
|
||||
WasmExampleBlock<'s, 'p>,
|
||||
ExampleBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmExampleBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::ExportBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::ExportBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmExportBlock<'s> {
|
||||
pub struct WasmExportBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmExportBlock<'s>,
|
||||
WasmExportBlock<'s, 'p>,
|
||||
ExportBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmExportBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::ExportSnippet;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::ExportSnippet;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmExportSnippet<'s> {
|
||||
pub struct WasmExportSnippet<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmExportSnippet<'s>,
|
||||
WasmExportSnippet<'s, 'p>,
|
||||
ExportSnippet<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmExportSnippet {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::FixedWidthArea;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::FixedWidthArea;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmFixedWidthArea<'s> {
|
||||
pub struct WasmFixedWidthArea<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmFixedWidthArea<'s>,
|
||||
WasmFixedWidthArea<'s, 'p>,
|
||||
FixedWidthArea<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmFixedWidthArea {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::FootnoteDefinition;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::FootnoteDefinition;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmFootnoteDefinition<'s> {
|
||||
pub struct WasmFootnoteDefinition<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmFootnoteDefinition<'s>,
|
||||
WasmFootnoteDefinition<'s, 'p>,
|
||||
FootnoteDefinition<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmFootnoteDefinition {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::FootnoteReference;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::FootnoteReference;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmFootnoteReference<'s> {
|
||||
pub struct WasmFootnoteReference<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmFootnoteReference<'s>,
|
||||
WasmFootnoteReference<'s, 'p>,
|
||||
FootnoteReference<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmFootnoteReference {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Heading;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::ast_node::WasmAstNode;
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Heading;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "headline")]
|
||||
pub(crate) struct WasmHeadline<'s> {
|
||||
pub struct WasmHeadline<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmHeadline<'s>,
|
||||
WasmHeadline<'s, 'p>,
|
||||
Heading<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,13 +25,12 @@ to_wasm!(
|
||||
Ok(WasmHeadline {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s> Into<WasmAstNode<'s>> for WasmHeadline<'s> {
|
||||
fn into(self) -> WasmAstNode<'s> {
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmHeadline<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
WasmAstNode::Headline(self)
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::HorizontalRule;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::HorizontalRule;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmHorizontalRule<'s> {
|
||||
pub struct WasmHorizontalRule<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmHorizontalRule<'s>,
|
||||
WasmHorizontalRule<'s, 'p>,
|
||||
HorizontalRule<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmHorizontalRule {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::InlineBabelCall;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::InlineBabelCall;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmInlineBabelCall<'s> {
|
||||
pub struct WasmInlineBabelCall<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmInlineBabelCall<'s>,
|
||||
WasmInlineBabelCall<'s, 'p>,
|
||||
InlineBabelCall<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmInlineBabelCall {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::InlineSourceBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::InlineSourceBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmInlineSourceBlock<'s> {
|
||||
pub struct WasmInlineSourceBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmInlineSourceBlock<'s>,
|
||||
WasmInlineSourceBlock<'s, 'p>,
|
||||
InlineSourceBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmInlineSourceBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Italic;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Italic;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmItalic<'s> {
|
||||
pub struct WasmItalic<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmItalic<'s>,
|
||||
WasmItalic<'s, 'p>,
|
||||
Italic<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmItalic {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Keyword;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Keyword;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmKeyword<'s> {
|
||||
pub struct WasmKeyword<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmKeyword<'s>,
|
||||
WasmKeyword<'s, 'p>,
|
||||
Keyword<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmKeyword {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::LatexEnvironment;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::LatexEnvironment;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmLatexEnvironment<'s> {
|
||||
pub struct WasmLatexEnvironment<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmLatexEnvironment<'s>,
|
||||
WasmLatexEnvironment<'s, 'p>,
|
||||
LatexEnvironment<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmLatexEnvironment {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::LatexFragment;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::LatexFragment;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmLatexFragment<'s> {
|
||||
pub struct WasmLatexFragment<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmLatexFragment<'s>,
|
||||
WasmLatexFragment<'s, 'p>,
|
||||
LatexFragment<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmLatexFragment {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::LineBreak;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::LineBreak;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmLineBreak<'s> {
|
||||
pub struct WasmLineBreak<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmLineBreak<'s>,
|
||||
WasmLineBreak<'s, 'p>,
|
||||
LineBreak<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmLineBreak {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -3,11 +3,11 @@
|
||||
/// This exists to make changing the type signature easier.
|
||||
macro_rules! to_wasm {
|
||||
($ostruct:ty, $istruct:ty, $original:ident, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => {
|
||||
impl<'s> ToWasm for $istruct {
|
||||
impl<'s, 'p> ToWasm<'p> for $istruct {
|
||||
type Output = $ostruct;
|
||||
|
||||
fn to_wasm(
|
||||
&self,
|
||||
&'p self,
|
||||
$wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>,
|
||||
) -> Result<Self::Output, crate::error::CustomError> {
|
||||
let $original = self;
|
||||
|
@ -62,8 +62,8 @@ mod underline;
|
||||
mod verbatim;
|
||||
mod verse_block;
|
||||
|
||||
pub use ast_node::WasmAstNode;
|
||||
pub use document::WasmDocument;
|
||||
pub use parse_result::wasm_parse_org;
|
||||
pub use parse_result::ParseResult;
|
||||
pub(crate) use to_wasm::ToWasm;
|
||||
pub(crate) use to_wasm::ToWasmContext;
|
||||
pub use to_wasm::ToWasm;
|
||||
pub use to_wasm::ToWasmContext;
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::NodeProperty;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::NodeProperty;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmNodeProperty<'s> {
|
||||
pub struct WasmNodeProperty<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmNodeProperty<'s>,
|
||||
WasmNodeProperty<'s, 'p>,
|
||||
NodeProperty<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmNodeProperty {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::OrgMacro;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::OrgMacro;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmOrgMacro<'s> {
|
||||
pub struct WasmOrgMacro<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmOrgMacro<'s>,
|
||||
WasmOrgMacro<'s, 'p>,
|
||||
OrgMacro<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmOrgMacro {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Paragraph;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Paragraph;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmParagraph<'s> {
|
||||
pub struct WasmParagraph<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmParagraph<'s>,
|
||||
WasmParagraph<'s, 'p>,
|
||||
Paragraph<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmParagraph {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,32 +1,13 @@
|
||||
use serde::Serialize;
|
||||
|
||||
use super::document::WasmDocument;
|
||||
use super::ToWasm;
|
||||
use super::ToWasmContext;
|
||||
use crate::parser::parse_with_settings;
|
||||
use crate::settings::GlobalSettings;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "status", content = "content")]
|
||||
pub enum ParseResult<'s> {
|
||||
pub enum ParseResult<'s, 'p> {
|
||||
#[serde(rename = "success")]
|
||||
Success(WasmDocument<'s>),
|
||||
Success(WasmDocument<'s, 'p>),
|
||||
|
||||
#[serde(rename = "error")]
|
||||
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
|
||||
}
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::PlainLink;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::PlainLink;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmPlainLink<'s> {
|
||||
pub struct WasmPlainLink<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlainLink<'s>,
|
||||
WasmPlainLink<'s, 'p>,
|
||||
PlainLink<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmPlainLink {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::PlainList;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::PlainList;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmPlainList<'s> {
|
||||
pub struct WasmPlainList<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlainList<'s>,
|
||||
WasmPlainList<'s, 'p>,
|
||||
PlainList<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmPlainList {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::PlainListItem;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::PlainListItem;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmPlainListItem<'s> {
|
||||
pub struct WasmPlainListItem<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlainListItem<'s>,
|
||||
WasmPlainListItem<'s, 'p>,
|
||||
PlainListItem<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmPlainListItem {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::PlainText;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::PlainText;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmPlainText<'s> {
|
||||
pub struct WasmPlainText<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlainText<'s>,
|
||||
WasmPlainText<'s, 'p>,
|
||||
PlainText<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmPlainText {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Planning;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Planning;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmPlanning<'s> {
|
||||
pub struct WasmPlanning<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPlanning<'s>,
|
||||
WasmPlanning<'s, 'p>,
|
||||
Planning<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmPlanning {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::PropertyDrawer;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::PropertyDrawer;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmPropertyDrawer<'s> {
|
||||
pub struct WasmPropertyDrawer<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmPropertyDrawer<'s>,
|
||||
WasmPropertyDrawer<'s, 'p>,
|
||||
PropertyDrawer<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmPropertyDrawer {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::QuoteBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::QuoteBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmQuoteBlock<'s> {
|
||||
pub struct WasmQuoteBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmQuoteBlock<'s>,
|
||||
WasmQuoteBlock<'s, 'p>,
|
||||
QuoteBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmQuoteBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::RadioLink;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::RadioLink;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmRadioLink<'s> {
|
||||
pub struct WasmRadioLink<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmRadioLink<'s>,
|
||||
WasmRadioLink<'s, 'p>,
|
||||
RadioLink<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmRadioLink {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::RadioTarget;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::RadioTarget;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmRadioTarget<'s> {
|
||||
pub struct WasmRadioTarget<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmRadioTarget<'s>,
|
||||
WasmRadioTarget<'s, 'p>,
|
||||
RadioTarget<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmRadioTarget {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::RegularLink;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::RegularLink;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmRegularLink<'s> {
|
||||
pub struct WasmRegularLink<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmRegularLink<'s>,
|
||||
WasmRegularLink<'s, 'p>,
|
||||
RegularLink<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmRegularLink {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Section;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::ast_node::WasmAstNode;
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Section;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "section")]
|
||||
pub(crate) struct WasmSection<'s> {
|
||||
pub struct WasmSection<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmSection<'s>,
|
||||
WasmSection<'s, 'p>,
|
||||
Section<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,13 +25,12 @@ to_wasm!(
|
||||
Ok(WasmSection {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
impl<'s> Into<WasmAstNode<'s>> for WasmSection<'s> {
|
||||
fn into(self) -> WasmAstNode<'s> {
|
||||
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmSection<'s, 'p> {
|
||||
fn into(self) -> WasmAstNode<'s, 'p> {
|
||||
WasmAstNode::Section(self)
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::SpecialBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::SpecialBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmSpecialBlock<'s> {
|
||||
pub struct WasmSpecialBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmSpecialBlock<'s>,
|
||||
WasmSpecialBlock<'s, 'p>,
|
||||
SpecialBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmSpecialBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::SrcBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::SrcBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmSrcBlock<'s> {
|
||||
pub struct WasmSrcBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmSrcBlock<'s>,
|
||||
WasmSrcBlock<'s, 'p>,
|
||||
SrcBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmSrcBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,10 +1,9 @@
|
||||
use crate::types::PostBlank;
|
||||
use crate::types::StandardProperties;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::to_wasm::ToWasmContext;
|
||||
use super::to_wasm::ToWasmStandardProperties;
|
||||
use crate::types::PostBlank;
|
||||
use crate::types::StandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) struct WasmStandardProperties {
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::StatisticsCookie;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::StatisticsCookie;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmStatisticsCookie<'s> {
|
||||
pub struct WasmStatisticsCookie<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmStatisticsCookie<'s>,
|
||||
WasmStatisticsCookie<'s, 'p>,
|
||||
StatisticsCookie<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmStatisticsCookie {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::StrikeThrough;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::StrikeThrough;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmStrikeThrough<'s> {
|
||||
pub struct WasmStrikeThrough<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmStrikeThrough<'s>,
|
||||
WasmStrikeThrough<'s, 'p>,
|
||||
StrikeThrough<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmStrikeThrough {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Subscript;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Subscript;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmSubscript<'s> {
|
||||
pub struct WasmSubscript<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmSubscript<'s>,
|
||||
WasmSubscript<'s, 'p>,
|
||||
Subscript<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmSubscript {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Superscript;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Superscript;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmSuperscript<'s> {
|
||||
pub struct WasmSuperscript<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmSuperscript<'s>,
|
||||
WasmSuperscript<'s, 'p>,
|
||||
Superscript<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmSuperscript {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Table;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Table;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmTable<'s> {
|
||||
pub struct WasmTable<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTable<'s>,
|
||||
WasmTable<'s, 'p>,
|
||||
Table<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmTable {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::TableCell;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::TableCell;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmTableCell<'s> {
|
||||
pub struct WasmTableCell<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTableCell<'s>,
|
||||
WasmTableCell<'s, 'p>,
|
||||
TableCell<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmTableCell {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::TableRow;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::TableRow;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmTableRow<'s> {
|
||||
pub struct WasmTableRow<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTableRow<'s>,
|
||||
WasmTableRow<'s, 'p>,
|
||||
TableRow<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmTableRow {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Target;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Target;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmTarget<'s> {
|
||||
pub struct WasmTarget<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTarget<'s>,
|
||||
WasmTarget<'s, 'p>,
|
||||
Target<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmTarget {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Timestamp;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Timestamp;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmTimestamp<'s> {
|
||||
pub struct WasmTimestamp<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmTimestamp<'s>,
|
||||
WasmTimestamp<'s, 'p>,
|
||||
Timestamp<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmTimestamp {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,9 +1,9 @@
|
||||
use crate::error::CustomError;
|
||||
|
||||
pub(crate) trait ToWasm {
|
||||
pub trait ToWasm<'p> {
|
||||
type Output;
|
||||
|
||||
fn to_wasm(&self, full_document: ToWasmContext<'_>) -> Result<Self::Output, CustomError>;
|
||||
fn to_wasm(&'p self, full_document: ToWasmContext<'_>) -> Result<Self::Output, CustomError>;
|
||||
}
|
||||
|
||||
pub(crate) trait ToWasmStandardProperties {
|
||||
@ -16,12 +16,12 @@ pub(crate) trait ToWasmStandardProperties {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct ToWasmContext<'s> {
|
||||
pub struct ToWasmContext<'s> {
|
||||
pub(crate) full_document: &'s str,
|
||||
}
|
||||
|
||||
impl<'s> ToWasmContext<'s> {
|
||||
pub(crate) fn new(full_document: &'s str) -> ToWasmContext<'s> {
|
||||
pub fn new(full_document: &'s str) -> ToWasmContext<'s> {
|
||||
ToWasmContext { full_document }
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Underline;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Underline;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmUnderline<'s> {
|
||||
pub struct WasmUnderline<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmUnderline<'s>,
|
||||
WasmUnderline<'s, 'p>,
|
||||
Underline<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmUnderline {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::Verbatim;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::Verbatim;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmVerbatim<'s> {
|
||||
pub struct WasmVerbatim<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmVerbatim<'s>,
|
||||
WasmVerbatim<'s, 'p>,
|
||||
Verbatim<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmVerbatim {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,25 +1,22 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use crate::types::VerseBlock;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use crate::types::VerseBlock;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "org-data")]
|
||||
pub(crate) struct WasmVerseBlock<'s> {
|
||||
pub struct WasmVerseBlock<'s, 'p> {
|
||||
standard_properties: WasmStandardProperties,
|
||||
children: Vec<()>,
|
||||
phantom: PhantomData<&'s ()>,
|
||||
children: Vec<WasmAstNode<'s, 'p>>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
WasmVerseBlock<'s>,
|
||||
WasmVerseBlock<'s, 'p>,
|
||||
VerseBlock<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
@ -28,7 +25,6 @@ to_wasm!(
|
||||
Ok(WasmVerseBlock {
|
||||
standard_properties,
|
||||
children: Vec::new(),
|
||||
phantom: PhantomData,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -1,9 +1,185 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use crate::compare::Token;
|
||||
use crate::wasm::WasmAstNode;
|
||||
use crate::wasm::WasmDocument;
|
||||
|
||||
pub fn wasm_compare_document<'b, 's>(
|
||||
pub fn wasm_compare_document<'b, 's, 'p>(
|
||||
source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
wasm: &'b WasmDocument<'s>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
wasm: WasmDocument<'s, 'p>,
|
||||
) -> 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>> {
|
||||
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!()
|
||||
}
|
||||
|
@ -3,7 +3,9 @@ use crate::compare::sexp;
|
||||
use crate::context::GlobalSettings;
|
||||
use crate::parser::parse_with_settings;
|
||||
use crate::util::emacs_parse_anonymous_org_document;
|
||||
use crate::util::foreground_color;
|
||||
use crate::util::print_versions;
|
||||
use crate::util::reset_color;
|
||||
use crate::wasm::ToWasm;
|
||||
use crate::wasm::ToWasmContext;
|
||||
|
||||
@ -40,20 +42,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
|
||||
let diff_result = wasm_compare_document(&parsed_sexp, &wasm_parsed)?;
|
||||
// if !silent {
|
||||
// diff_result.print(org_contents)?;
|
||||
// }
|
||||
let diff_result = wasm_compare_document(org_contents, &parsed_sexp, wasm_parsed)?;
|
||||
if !silent {
|
||||
diff_result.print(org_contents)?;
|
||||
}
|
||||
|
||||
// if diff_result.is_bad() {
|
||||
// return Ok(false);
|
||||
// } else if !silent {
|
||||
// println!(
|
||||
// "{color}Entire document passes.{reset}",
|
||||
// color = DiffResult::foreground_color(0, 255, 0),
|
||||
// reset = DiffResult::reset_color(),
|
||||
// );
|
||||
// }
|
||||
if diff_result.is_bad() {
|
||||
return Ok(false);
|
||||
} else if !silent {
|
||||
println!(
|
||||
"{color}Entire document passes.{reset}",
|
||||
color = foreground_color(0, 255, 0),
|
||||
reset = reset_color(),
|
||||
);
|
||||
}
|
||||
|
||||
Ok(true)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user