Invoking wasm_compare_document.
This commit is contained in:
9
src/wasm_test/compare.rs
Normal file
9
src/wasm_test/compare.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use crate::compare::Token;
|
||||
use crate::wasm::WasmDocument;
|
||||
|
||||
pub fn wasm_compare_document<'b, 's>(
|
||||
emacs: &'b Token<'s>,
|
||||
wasm: &'b WasmDocument<'s>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
todo!()
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
mod compare;
|
||||
mod runner;
|
||||
|
||||
pub use runner::wasm_run_anonymous_compare;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use super::compare::wasm_compare_document;
|
||||
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::print_versions;
|
||||
use crate::wasm::ParseResult;
|
||||
use crate::wasm::ToWasm;
|
||||
use crate::wasm::ToWasmContext;
|
||||
|
||||
@@ -26,10 +26,9 @@ pub async fn wasm_run_anonymous_compare_with_settings<'g, 's, P: AsRef<str>>(
|
||||
}
|
||||
let rust_parsed = parse_with_settings(org_contents, global_settings)?;
|
||||
let to_wasm_context = ToWasmContext::new(org_contents);
|
||||
let wasm_parsed = match rust_parsed.to_wasm(to_wasm_context) {
|
||||
Ok(wasm_document) => ParseResult::Success(wasm_document),
|
||||
Err(err) => ParseResult::Error(format!("{:?}", err)),
|
||||
};
|
||||
let wasm_parsed = rust_parsed
|
||||
.to_wasm(to_wasm_context)
|
||||
.map_err(|_e| "Failed to convert to wasm.")?;
|
||||
let org_sexp = emacs_parse_anonymous_org_document(org_contents, global_settings).await?;
|
||||
let (_remaining, parsed_sexp) = sexp(org_sexp.as_str()).map_err(|e| e.to_string())?;
|
||||
|
||||
@@ -41,7 +40,7 @@ pub async fn wasm_run_anonymous_compare_with_settings<'g, 's, P: AsRef<str>>(
|
||||
}
|
||||
|
||||
// We do the diffing after printing out both parsed forms in case the diffing panics
|
||||
// let diff_result = compare_document(&parsed_sexp, &rust_parsed)?;
|
||||
let diff_result = wasm_compare_document(&parsed_sexp, &wasm_parsed)?;
|
||||
// if !silent {
|
||||
// diff_result.print(org_contents)?;
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user