Print character offset from rust's parse perspective during compare.
This commit is contained in:
parent
ac313d093e
commit
3e6df7ba78
@ -48,6 +48,7 @@ use crate::parser::RadioLink;
|
||||
use crate::parser::RadioTarget;
|
||||
use crate::parser::RegularLink;
|
||||
use crate::parser::Section;
|
||||
use crate::parser::Source;
|
||||
use crate::parser::SrcBlock;
|
||||
use crate::parser::StatisticsCookie;
|
||||
use crate::parser::StrikeThrough;
|
||||
@ -63,11 +64,14 @@ use crate::parser::Verbatim;
|
||||
use crate::parser::VerseBlock;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DiffResult {
|
||||
pub struct DiffResult<'s> {
|
||||
status: DiffStatus,
|
||||
name: String,
|
||||
message: Option<String>,
|
||||
children: Vec<DiffResult>,
|
||||
children: Vec<DiffResult<'s>>,
|
||||
rust_source: &'s str,
|
||||
#[allow(dead_code)]
|
||||
emacs_token: &'s Token<'s>,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
@ -76,12 +80,16 @@ pub enum DiffStatus {
|
||||
Bad,
|
||||
}
|
||||
|
||||
impl DiffResult {
|
||||
pub fn print(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||
self.print_indented(0)
|
||||
impl<'s> DiffResult<'s> {
|
||||
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) -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn print_indented(
|
||||
&self,
|
||||
indentation: usize,
|
||||
original_document: &str,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let status_text = {
|
||||
match self.status {
|
||||
DiffStatus::Good => {
|
||||
@ -106,15 +114,17 @@ impl DiffResult {
|
||||
),
|
||||
}
|
||||
};
|
||||
let rust_offset = self.rust_source.as_ptr() as usize - original_document.as_ptr() as usize;
|
||||
println!(
|
||||
"{}{} {} {}",
|
||||
" ".repeat(indentation),
|
||||
status_text,
|
||||
self.name,
|
||||
self.message.as_ref().map(|m| m.as_str()).unwrap_or("")
|
||||
"{indentation}{status_text} {name} char({char_offset}) {message}",
|
||||
indentation = " ".repeat(indentation),
|
||||
status_text = status_text,
|
||||
name = self.name,
|
||||
char_offset = rust_offset,
|
||||
message = self.message.as_ref().map(|m| m.as_str()).unwrap_or("")
|
||||
);
|
||||
for child in self.children.iter() {
|
||||
child.print_indented(indentation + 1)?;
|
||||
child.print_indented(indentation + 1, original_document)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@ -176,7 +186,7 @@ fn compare_element<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Element<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let compare_result = match rust {
|
||||
Element::Paragraph(obj) => compare_paragraph(source, emacs, obj),
|
||||
Element::PlainList(obj) => compare_plain_list(source, emacs, obj),
|
||||
@ -207,6 +217,8 @@ fn compare_element<'s>(
|
||||
name: "error!".to_owned(),
|
||||
message: Some(e.to_string()),
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -215,7 +227,7 @@ fn compare_object<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Object<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let compare_result = match rust {
|
||||
Object::Bold(obj) => compare_bold(source, emacs, obj),
|
||||
Object::Italic(obj) => compare_italic(source, emacs, obj),
|
||||
@ -252,6 +264,8 @@ fn compare_object<'s>(
|
||||
name: "error!".to_owned(),
|
||||
message: Some(e.to_string()),
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -259,7 +273,7 @@ fn compare_object<'s>(
|
||||
pub fn compare_document<'s>(
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Document<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -303,6 +317,8 @@ pub fn compare_document<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -310,7 +326,7 @@ fn compare_section<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Section<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let mut child_status = Vec::new();
|
||||
@ -332,6 +348,8 @@ fn compare_section<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -339,7 +357,7 @@ fn compare_heading<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Heading<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -427,6 +445,8 @@ fn compare_heading<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -467,7 +487,7 @@ fn compare_paragraph<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Paragraph<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -489,6 +509,8 @@ fn compare_paragraph<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -496,7 +518,7 @@ fn compare_plain_list<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s PlainList<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -518,6 +540,8 @@ fn compare_plain_list<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -525,7 +549,7 @@ fn compare_plain_list_item<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s PlainListItem<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -547,6 +571,8 @@ fn compare_plain_list_item<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -554,7 +580,7 @@ fn compare_greater_block<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s GreaterBlock<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -580,6 +606,8 @@ fn compare_greater_block<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -587,7 +615,7 @@ fn compare_dynamic_block<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s DynamicBlock<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -608,6 +636,8 @@ fn compare_dynamic_block<'s>(
|
||||
name: "dynamic-block".to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -615,7 +645,7 @@ fn compare_footnote_definition<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s FootnoteDefinition<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -637,6 +667,8 @@ fn compare_footnote_definition<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -644,7 +676,7 @@ fn compare_comment<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Comment<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "comment";
|
||||
@ -661,6 +693,8 @@ fn compare_comment<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -668,7 +702,7 @@ fn compare_drawer<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Drawer<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -690,6 +724,8 @@ fn compare_drawer<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -697,7 +733,7 @@ fn compare_property_drawer<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s PropertyDrawer<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -720,6 +756,8 @@ fn compare_property_drawer<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -727,7 +765,7 @@ fn compare_table<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Table<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -749,6 +787,8 @@ fn compare_table<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -756,7 +796,7 @@ fn compare_table_row<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s TableRow<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let mut child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -778,6 +818,8 @@ fn compare_table_row<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -785,7 +827,7 @@ fn compare_table_cell<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s TableCell<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -805,6 +847,8 @@ fn compare_table_cell<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -812,7 +856,7 @@ fn compare_verse_block<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s VerseBlock<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let children = emacs.as_list()?;
|
||||
let child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
@ -832,6 +876,8 @@ fn compare_verse_block<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -839,7 +885,7 @@ fn compare_comment_block<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s CommentBlock<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "comment-block";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -855,6 +901,8 @@ fn compare_comment_block<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -862,7 +910,7 @@ fn compare_example_block<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s ExampleBlock<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "example-block";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -878,6 +926,8 @@ fn compare_example_block<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -885,7 +935,7 @@ fn compare_export_block<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s ExportBlock<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "export-block";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -901,6 +951,8 @@ fn compare_export_block<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -908,7 +960,7 @@ fn compare_src_block<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s SrcBlock<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "src-block";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -924,6 +976,8 @@ fn compare_src_block<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -931,7 +985,7 @@ fn compare_clock<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Clock<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "clock";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -947,6 +1001,8 @@ fn compare_clock<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -954,7 +1010,7 @@ fn compare_diary_sexp<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s DiarySexp<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "diary-sexp";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -970,6 +1026,8 @@ fn compare_diary_sexp<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -977,7 +1035,7 @@ fn compare_planning<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Planning<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "planning";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -993,6 +1051,8 @@ fn compare_planning<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1000,7 +1060,7 @@ fn compare_fixed_width_area<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s FixedWidthArea<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "fixed-width";
|
||||
@ -1017,6 +1077,8 @@ fn compare_fixed_width_area<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1024,7 +1086,7 @@ fn compare_horizontal_rule<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s HorizontalRule<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "horizontal-rule";
|
||||
@ -1041,6 +1103,8 @@ fn compare_horizontal_rule<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1048,7 +1112,7 @@ fn compare_keyword<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Keyword<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "keyword";
|
||||
@ -1065,6 +1129,8 @@ fn compare_keyword<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1072,7 +1138,7 @@ fn compare_latex_environment<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s LatexEnvironment<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let child_status = Vec::new();
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "latex-environment";
|
||||
@ -1089,6 +1155,8 @@ fn compare_latex_environment<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: child_status,
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1096,7 +1164,7 @@ fn compare_plain_text<'s>(
|
||||
_source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s PlainText<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let mut message = None;
|
||||
let text = emacs.as_text()?;
|
||||
@ -1135,6 +1203,8 @@ fn compare_plain_text<'s>(
|
||||
name: "plain-text".to_owned(),
|
||||
message,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1142,7 +1212,7 @@ fn compare_bold<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Bold<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "bold";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1158,6 +1228,8 @@ fn compare_bold<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1165,7 +1237,7 @@ fn compare_italic<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Italic<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "italic";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1181,6 +1253,8 @@ fn compare_italic<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1188,7 +1262,7 @@ fn compare_underline<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Underline<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "underline";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1204,6 +1278,8 @@ fn compare_underline<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1211,7 +1287,7 @@ fn compare_verbatim<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Verbatim<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "verbatim";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1227,6 +1303,8 @@ fn compare_verbatim<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1234,7 +1312,7 @@ fn compare_code<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Code<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "code";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1250,6 +1328,8 @@ fn compare_code<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1257,7 +1337,7 @@ fn compare_strike_through<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s StrikeThrough<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "strike-through";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1273,6 +1353,8 @@ fn compare_strike_through<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1280,7 +1362,7 @@ fn compare_regular_link<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s RegularLink<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "link";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1296,6 +1378,8 @@ fn compare_regular_link<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1303,7 +1387,7 @@ fn compare_radio_link<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s RadioLink<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "link";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1319,6 +1403,8 @@ fn compare_radio_link<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1326,7 +1412,7 @@ fn compare_radio_target<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s RadioTarget<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "radio-target";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1342,6 +1428,8 @@ fn compare_radio_target<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1349,7 +1437,7 @@ fn compare_plain_link<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s PlainLink<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "link";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1365,6 +1453,8 @@ fn compare_plain_link<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1372,7 +1462,7 @@ fn compare_angle_link<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s AngleLink<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "link";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1388,6 +1478,8 @@ fn compare_angle_link<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1395,7 +1487,7 @@ fn compare_org_macro<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s OrgMacro<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "macro";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1411,6 +1503,8 @@ fn compare_org_macro<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1418,7 +1512,7 @@ fn compare_entity<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Entity<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "entity";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1434,6 +1528,8 @@ fn compare_entity<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1441,7 +1537,7 @@ fn compare_latex_fragment<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s LatexFragment<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "latex-fragment";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1457,6 +1553,8 @@ fn compare_latex_fragment<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1464,7 +1562,7 @@ fn compare_export_snippet<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s ExportSnippet<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "export-snippet";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1480,6 +1578,8 @@ fn compare_export_snippet<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1487,7 +1587,7 @@ fn compare_footnote_reference<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s FootnoteReference<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "footnote-reference";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1503,6 +1603,8 @@ fn compare_footnote_reference<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1510,7 +1612,7 @@ fn compare_citation<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Citation<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "citation";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1526,6 +1628,8 @@ fn compare_citation<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1533,7 +1637,7 @@ fn compare_citation_reference<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s CitationReference<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "citation-reference";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1549,6 +1653,8 @@ fn compare_citation_reference<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1556,7 +1662,7 @@ fn compare_inline_babel_call<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s InlineBabelCall<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "inline-babel-call";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1572,6 +1678,8 @@ fn compare_inline_babel_call<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1579,7 +1687,7 @@ fn compare_inline_source_block<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s InlineSourceBlock<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "inline-src-block";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1595,6 +1703,8 @@ fn compare_inline_source_block<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1602,7 +1712,7 @@ fn compare_line_break<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s LineBreak<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "line-break";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1618,6 +1728,8 @@ fn compare_line_break<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1625,7 +1737,7 @@ fn compare_target<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Target<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "target";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1641,6 +1753,8 @@ fn compare_target<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1648,7 +1762,7 @@ fn compare_statistics_cookie<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s StatisticsCookie<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "statistics-cookie";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1664,6 +1778,8 @@ fn compare_statistics_cookie<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1671,7 +1787,7 @@ fn compare_subscript<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Subscript<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "subscript";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1687,6 +1803,8 @@ fn compare_subscript<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1694,7 +1812,7 @@ fn compare_superscript<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Superscript<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "superscript";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1710,6 +1828,8 @@ fn compare_superscript<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
||||
@ -1717,7 +1837,7 @@ fn compare_timestamp<'s>(
|
||||
source: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s Timestamp<'s>,
|
||||
) -> Result<DiffResult, Box<dyn std::error::Error>> {
|
||||
) -> Result<DiffResult<'s>, Box<dyn std::error::Error>> {
|
||||
let mut this_status = DiffStatus::Good;
|
||||
let emacs_name = "timestamp";
|
||||
if assert_name(emacs, emacs_name).is_err() {
|
||||
@ -1733,5 +1853,7 @@ fn compare_timestamp<'s>(
|
||||
name: emacs_name.to_owned(),
|
||||
message: None,
|
||||
children: Vec::new(),
|
||||
rust_source: rust.get_source(),
|
||||
emacs_token: emacs,
|
||||
})
|
||||
}
|
||||
|
@ -55,20 +55,21 @@ fn read_stdin_to_string() -> Result<String, Box<dyn std::error::Error>> {
|
||||
fn run_compare<P: AsRef<str>>(org_contents: P) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let emacs_version = get_emacs_version()?;
|
||||
let org_mode_version = get_org_mode_version()?;
|
||||
let org_contents = org_contents.as_ref();
|
||||
eprintln!("Using emacs version: {}", emacs_version.trim());
|
||||
eprintln!("Using org-mode version: {}", org_mode_version.trim());
|
||||
let (remaining, rust_parsed) = document(org_contents.as_ref()).map_err(|e| e.to_string())?;
|
||||
let org_sexp = emacs_parse_org_document(org_contents.as_ref())?;
|
||||
let (remaining, rust_parsed) = document(org_contents).map_err(|e| e.to_string())?;
|
||||
let org_sexp = emacs_parse_org_document(org_contents)?;
|
||||
let (_remaining, parsed_sexp) =
|
||||
sexp_with_padding(org_sexp.as_str()).map_err(|e| e.to_string())?;
|
||||
|
||||
println!("{}\n\n\n", org_contents.as_ref());
|
||||
println!("{}\n\n\n", org_contents);
|
||||
println!("{}", org_sexp);
|
||||
println!("{:#?}", rust_parsed);
|
||||
|
||||
// We do the diffing after printing out both parsed forms in case the diffing panics
|
||||
let diff_result = compare_document(&parsed_sexp, &rust_parsed)?;
|
||||
diff_result.print()?;
|
||||
diff_result.print(org_contents)?;
|
||||
|
||||
if diff_result.is_bad() {
|
||||
Err("Diff results do not match.")?;
|
||||
|
@ -374,3 +374,9 @@ impl<'s> Source<'s> for Timestamp<'s> {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> Source<'s> for PlainText<'s> {
|
||||
fn get_source(&'s self) -> &'s str {
|
||||
self.source
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user