Introducing a trait for running compares.
This should enable us to invoke compares without needing a reference ast node type.
This commit is contained in:
parent
36b80dc093
commit
e83417b243
@ -1,5 +1,6 @@
|
|||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
use super::elisp_compare::WasmElispCompare;
|
||||||
use crate::compare::Token;
|
use crate::compare::Token;
|
||||||
use crate::wasm::WasmAstNode;
|
use crate::wasm::WasmAstNode;
|
||||||
use crate::wasm::WasmDocument;
|
use crate::wasm::WasmDocument;
|
||||||
@ -9,8 +10,7 @@ pub fn wasm_compare_document<'b, 's, 'p>(
|
|||||||
emacs: &'b Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
wasm: WasmDocument<'s, 'p>,
|
wasm: WasmDocument<'s, 'p>,
|
||||||
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||||
// wasm_compare_ast_node(
|
wasm.compare_ast_node(source, emacs)
|
||||||
todo!()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -153,33 +153,29 @@ fn wasm_compare_ast_node<'b, 's, 'p>(
|
|||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
// fn wasm_compare_list<'b, 's, EI, WI, WC>(
|
fn wasm_compare_list<'b, 's, 'p, 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,
|
source: &'s str,
|
||||||
emacs: &'b Token<'s>,
|
emacs: EI,
|
||||||
wasm: WasmDocument<'s, 'p>,
|
wasm: WI,
|
||||||
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>>
|
||||||
let mut this_status = WasmDiffStatus::Good;
|
where
|
||||||
|
EI: Iterator<Item = &'b Token<'s>> + ExactSizeIterator,
|
||||||
|
WI: Iterator<Item = WC> + ExactSizeIterator,
|
||||||
|
WC: WasmElispCompare<'s, 'p>,
|
||||||
|
{
|
||||||
|
// let mut this_status = WasmDiffStatus::Good;
|
||||||
// let mut child_status = Vec::new();
|
// let mut child_status = Vec::new();
|
||||||
// let mut message = None;
|
// let mut message = None;
|
||||||
|
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'s, 'p> WasmElispCompare<'s, 'p> for WasmDocument<'s, 'p> {
|
||||||
|
fn compare_ast_node<'b>(
|
||||||
|
&self,
|
||||||
|
source: &'s str,
|
||||||
|
emacs: &'b Token<'s>,
|
||||||
|
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
10
src/wasm_test/elisp_compare.rs
Normal file
10
src/wasm_test/elisp_compare.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
use super::compare::WasmDiffEntry;
|
||||||
|
use crate::compare::Token;
|
||||||
|
|
||||||
|
pub trait WasmElispCompare<'s, 'p> {
|
||||||
|
fn compare_ast_node<'b>(
|
||||||
|
&'p self,
|
||||||
|
source: &'s str,
|
||||||
|
emacs: &'b Token<'s>,
|
||||||
|
) -> Result<WasmDiffEntry<'b, 's>, Box<dyn std::error::Error>>;
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
mod compare;
|
mod compare;
|
||||||
|
mod elisp_compare;
|
||||||
mod runner;
|
mod runner;
|
||||||
|
|
||||||
pub use runner::wasm_run_anonymous_compare;
|
pub use runner::wasm_run_anonymous_compare;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user