Compare commits
7 Commits
172d72aa46
...
c46a935cfc
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c46a935cfc | ||
![]() |
f50415cb32 | ||
![]() |
4f1a151e97 | ||
![]() |
c8e3fdba51 | ||
![]() |
4b3fc20c62 | ||
![]() |
3131f8ac64 | ||
![]() |
60a4835590 |
@ -4,15 +4,17 @@ use serde::Serialize;
|
||||
use super::ast_node::WasmAstNode;
|
||||
use super::macros::to_wasm;
|
||||
use super::to_wasm::ToWasm;
|
||||
use super::AdditionalProperties;
|
||||
use crate::compare::ElispFact;
|
||||
use crate::types::Clock;
|
||||
use crate::types::ClockStatus;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct WasmClock {
|
||||
#[serde(flatten)]
|
||||
pub(crate) additional_properties: AdditionalProperties,
|
||||
#[serde(rename = "value")]
|
||||
pub(crate) timestamp: Box<WasmAstNode>,
|
||||
pub(crate) duration: Option<String>,
|
||||
pub(crate) status: String,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
@ -21,12 +23,20 @@ to_wasm!(
|
||||
original,
|
||||
wasm_context,
|
||||
{ WasmAstNode::Clock(original) },
|
||||
{ "TODO".into() },
|
||||
{ "clock".into() },
|
||||
{
|
||||
Ok((
|
||||
Vec::new(),
|
||||
WasmClock {
|
||||
additional_properties: AdditionalProperties::default(),
|
||||
timestamp: Box::new(Into::<WasmAstNode>::into(
|
||||
original.timestamp.to_wasm(wasm_context.clone())?,
|
||||
)),
|
||||
duration: original.duration.map(|s| s.to_owned()),
|
||||
status: match original.status {
|
||||
ClockStatus::Running => "running",
|
||||
ClockStatus::Closed => "closed",
|
||||
}
|
||||
.to_owned(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -7,12 +7,14 @@ use super::to_wasm::ToWasm;
|
||||
use super::AdditionalProperties;
|
||||
use crate::compare::ElispFact;
|
||||
use crate::types::CommentBlock;
|
||||
use crate::types::GetAffiliatedKeywords;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct WasmCommentBlock {
|
||||
#[serde(flatten)]
|
||||
pub(crate) additional_properties: AdditionalProperties,
|
||||
pub(crate) value: String,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
@ -21,12 +23,17 @@ to_wasm!(
|
||||
original,
|
||||
wasm_context,
|
||||
{ WasmAstNode::CommentBlock(original) },
|
||||
{ "TODO".into() },
|
||||
{ "comment-block".into() },
|
||||
{
|
||||
let additional_properties = original
|
||||
.get_affiliated_keywords()
|
||||
.to_wasm(wasm_context.clone())?;
|
||||
|
||||
Ok((
|
||||
Vec::new(),
|
||||
WasmCommentBlock {
|
||||
additional_properties: AdditionalProperties::default(),
|
||||
additional_properties,
|
||||
value: original.contents.to_owned(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -7,12 +7,14 @@ use super::to_wasm::ToWasm;
|
||||
use super::AdditionalProperties;
|
||||
use crate::compare::ElispFact;
|
||||
use crate::types::DiarySexp;
|
||||
use crate::types::GetAffiliatedKeywords;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct WasmDiarySexp {
|
||||
#[serde(flatten)]
|
||||
pub(crate) additional_properties: AdditionalProperties,
|
||||
pub(crate) value: String,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
@ -21,12 +23,17 @@ to_wasm!(
|
||||
original,
|
||||
wasm_context,
|
||||
{ WasmAstNode::DiarySexp(original) },
|
||||
{ "TODO".into() },
|
||||
{ "diary-sexp".into() },
|
||||
{
|
||||
let additional_properties = original
|
||||
.get_affiliated_keywords()
|
||||
.to_wasm(wasm_context.clone())?;
|
||||
|
||||
Ok((
|
||||
Vec::new(),
|
||||
WasmDiarySexp {
|
||||
additional_properties: AdditionalProperties::default(),
|
||||
additional_properties,
|
||||
value: original.value.to_owned(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -7,12 +7,15 @@ use super::to_wasm::ToWasm;
|
||||
use super::AdditionalProperties;
|
||||
use crate::compare::ElispFact;
|
||||
use crate::types::Drawer;
|
||||
use crate::types::GetAffiliatedKeywords;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct WasmDrawer {
|
||||
#[serde(flatten)]
|
||||
pub(crate) additional_properties: AdditionalProperties,
|
||||
#[serde(rename = "drawer-name")]
|
||||
pub(crate) drawer_name: String,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
@ -21,8 +24,12 @@ to_wasm!(
|
||||
original,
|
||||
wasm_context,
|
||||
{ WasmAstNode::Drawer(original) },
|
||||
{ "TODO".into() },
|
||||
{ "drawer".into() },
|
||||
{
|
||||
let additional_properties = original
|
||||
.get_affiliated_keywords()
|
||||
.to_wasm(wasm_context.clone())?;
|
||||
|
||||
let children = original
|
||||
.children
|
||||
.iter()
|
||||
@ -36,7 +43,8 @@ to_wasm!(
|
||||
Ok((
|
||||
children,
|
||||
WasmDrawer {
|
||||
additional_properties: AdditionalProperties::default(),
|
||||
additional_properties,
|
||||
drawer_name: original.drawer_name.to_owned(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -3,16 +3,35 @@ use serde::Serialize;
|
||||
|
||||
use super::ast_node::WasmAstNode;
|
||||
use super::macros::to_wasm;
|
||||
use super::src_block::WasmNumberLines;
|
||||
use super::src_block::WasmNumberLinesWrapper;
|
||||
use super::src_block::WasmRetainLabels;
|
||||
use super::to_wasm::ToWasm;
|
||||
use super::AdditionalProperties;
|
||||
use crate::compare::ElispFact;
|
||||
use crate::types::CharOffsetInLine;
|
||||
use crate::types::ExampleBlock;
|
||||
use crate::types::GetAffiliatedKeywords;
|
||||
use crate::types::RetainLabels;
|
||||
use crate::types::SwitchNumberLines;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct WasmExampleBlock {
|
||||
#[serde(flatten)]
|
||||
pub(crate) additional_properties: AdditionalProperties,
|
||||
pub(crate) value: String,
|
||||
pub(crate) switches: Option<String>,
|
||||
#[serde(rename = "number-lines")]
|
||||
pub(crate) number_lines: Option<WasmNumberLinesWrapper>,
|
||||
#[serde(rename = "preserve-indent")]
|
||||
pub(crate) preserve_indent: Option<CharOffsetInLine>,
|
||||
#[serde(rename = "retain-labels")]
|
||||
pub(crate) retain_labels: WasmRetainLabels,
|
||||
#[serde(rename = "use-labels")]
|
||||
pub(crate) use_labels: bool,
|
||||
#[serde(rename = "label-fmt")]
|
||||
pub(crate) label_format: Option<String>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
@ -21,12 +40,35 @@ to_wasm!(
|
||||
original,
|
||||
wasm_context,
|
||||
{ WasmAstNode::ExampleBlock(original) },
|
||||
{ "TODO".into() },
|
||||
{ "example-block".into() },
|
||||
{
|
||||
let additional_properties = original
|
||||
.get_affiliated_keywords()
|
||||
.to_wasm(wasm_context.clone())?;
|
||||
|
||||
Ok((
|
||||
Vec::new(),
|
||||
WasmExampleBlock {
|
||||
additional_properties: AdditionalProperties::default(),
|
||||
additional_properties,
|
||||
value: original.get_value().into_owned(),
|
||||
switches: original.switches.map(|s| s.to_owned()),
|
||||
number_lines: match original.number_lines {
|
||||
None => None,
|
||||
Some(SwitchNumberLines::New(n)) => Some(WasmNumberLinesWrapper {
|
||||
inner: WasmNumberLines::New(n),
|
||||
}),
|
||||
Some(SwitchNumberLines::Continued(n)) => Some(WasmNumberLinesWrapper {
|
||||
inner: WasmNumberLines::continued(n),
|
||||
}),
|
||||
},
|
||||
preserve_indent: original.preserve_indent,
|
||||
retain_labels: match original.retain_labels {
|
||||
RetainLabels::No => WasmRetainLabels::YesNo(false),
|
||||
RetainLabels::Yes => WasmRetainLabels::YesNo(true),
|
||||
RetainLabels::Keep(n) => WasmRetainLabels::Keep(n),
|
||||
},
|
||||
use_labels: original.use_labels,
|
||||
label_format: original.label_format.map(|s| s.to_owned()),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -7,12 +7,16 @@ use super::to_wasm::ToWasm;
|
||||
use super::AdditionalProperties;
|
||||
use crate::compare::ElispFact;
|
||||
use crate::types::ExportBlock;
|
||||
use crate::types::GetAffiliatedKeywords;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct WasmExportBlock {
|
||||
#[serde(flatten)]
|
||||
pub(crate) additional_properties: AdditionalProperties,
|
||||
#[serde(rename = "type")]
|
||||
pub(crate) export_type: Option<String>,
|
||||
pub(crate) value: String,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
@ -21,12 +25,18 @@ to_wasm!(
|
||||
original,
|
||||
wasm_context,
|
||||
{ WasmAstNode::ExportBlock(original) },
|
||||
{ "TODO".into() },
|
||||
{ "export-block".into() },
|
||||
{
|
||||
let additional_properties = original
|
||||
.get_affiliated_keywords()
|
||||
.to_wasm(wasm_context.clone())?;
|
||||
|
||||
Ok((
|
||||
Vec::new(),
|
||||
WasmExportBlock {
|
||||
additional_properties: AdditionalProperties::default(),
|
||||
additional_properties,
|
||||
export_type: original.get_export_type(),
|
||||
value: original.get_value().into_owned(),
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ use super::macros::to_wasm;
|
||||
use super::to_wasm::ToWasm;
|
||||
use super::AdditionalProperties;
|
||||
use crate::compare::ElispFact;
|
||||
use crate::types::GetAffiliatedKeywords;
|
||||
use crate::types::HorizontalRule;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
|
||||
@ -21,12 +22,16 @@ to_wasm!(
|
||||
original,
|
||||
wasm_context,
|
||||
{ WasmAstNode::HorizontalRule(original) },
|
||||
{ "TODO".into() },
|
||||
{ "horizontal-rule".into() },
|
||||
{
|
||||
let additional_properties = original
|
||||
.get_affiliated_keywords()
|
||||
.to_wasm(wasm_context.clone())?;
|
||||
|
||||
Ok((
|
||||
Vec::new(),
|
||||
WasmHorizontalRule {
|
||||
additional_properties: AdditionalProperties::default(),
|
||||
additional_properties,
|
||||
},
|
||||
))
|
||||
}
|
||||
|
@ -36,13 +36,13 @@ pub struct WasmSrcBlock {
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
enum WasmRetainLabels {
|
||||
pub(crate) enum WasmRetainLabels {
|
||||
YesNo(bool),
|
||||
Keep(CharOffsetInLine),
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
enum WasmNumberLines {
|
||||
pub(crate) enum WasmNumberLines {
|
||||
#[serde(rename = "new")]
|
||||
New(LineNumber),
|
||||
#[serde(rename = "continued")]
|
||||
@ -52,9 +52,9 @@ enum WasmNumberLines {
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename = "number-lines")]
|
||||
#[serde(tag = "number-lines")]
|
||||
struct WasmNumberLinesWrapper {
|
||||
pub(crate) struct WasmNumberLinesWrapper {
|
||||
#[serde(flatten)]
|
||||
inner: WasmNumberLines,
|
||||
pub(crate) inner: WasmNumberLines,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
|
@ -520,10 +520,10 @@ fn compare_optional_pair<'e, 's, 'w>(
|
||||
});
|
||||
}
|
||||
let emacs_optval = emacs
|
||||
.first()
|
||||
.get(2)
|
||||
.expect("If-statement proves this will be Some.");
|
||||
let emacs_val = emacs
|
||||
.get(2)
|
||||
.first()
|
||||
.expect("If-statement proves this will be Some.");
|
||||
result.extend(compare_json_value(source, emacs_optval, wasm_optval)?)?;
|
||||
result.extend(compare_json_value(source, emacs_val, wasm_val)?)?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user