Comparing single string values.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use super::compare_field::compare_property_quoted_string;
|
||||
use super::compare_field::ComparePropertiesResult;
|
||||
use super::diff::DiffEntry;
|
||||
use super::diff::DiffStatus;
|
||||
@@ -7,6 +8,7 @@ use super::elisp_fact::GetElispFact;
|
||||
use super::sexp::Token;
|
||||
use crate::compare::diff::compare_ast_node;
|
||||
use crate::compare::sexp::unquote;
|
||||
use crate::types::AffiliatedKeywordValue;
|
||||
use crate::types::AstNode;
|
||||
use crate::types::GetAffiliatedKeywords;
|
||||
use crate::types::GetStandardProperties;
|
||||
@@ -340,28 +342,37 @@ where
|
||||
}
|
||||
|
||||
pub(crate) fn compare_affiliated_keywords<'b, 's, GAK>(
|
||||
source: &'s str,
|
||||
emacs: &'b Token<'s>,
|
||||
rust: &'b GAK,
|
||||
) -> Result<ComparePropertiesResult<'b, 's>, Box<dyn std::error::Error>>
|
||||
) -> Result<Vec<ComparePropertiesResult<'b, 's>>, Box<dyn std::error::Error>>
|
||||
where
|
||||
GAK: GetAffiliatedKeywords<'s>,
|
||||
{
|
||||
let mut ret = Vec::new();
|
||||
let affiliated_keywords = rust.get_affiliated_keywords();
|
||||
for (rust_name, rust_value) in affiliated_keywords.keywords.iter() {
|
||||
let emacs_property_name = format!(":{}", rust_name);
|
||||
let emacs_property = get_property(emacs, emacs_property_name.as_str())?;
|
||||
if let Some(emacs_property) = emacs_property {
|
||||
// foo
|
||||
} else {
|
||||
let this_status = DiffStatus::Bad;
|
||||
let message = Some(format!(
|
||||
"{} mismatch (emacs != rust) {:?} != {:?}",
|
||||
rust_name, emacs_property, rust_value
|
||||
));
|
||||
return Ok(ComparePropertiesResult::SelfChange(this_status, message));
|
||||
}
|
||||
match rust_value {
|
||||
AffiliatedKeywordValue::SingleString(rust_value) => {
|
||||
let diff = compare_property_quoted_string(
|
||||
source,
|
||||
emacs,
|
||||
rust,
|
||||
emacs_property_name.as_str(),
|
||||
|_| Some(*rust_value),
|
||||
)?;
|
||||
ret.push(diff);
|
||||
}
|
||||
AffiliatedKeywordValue::ListOfStrings(rust_value) => {
|
||||
// foo
|
||||
}
|
||||
AffiliatedKeywordValue::ListOfListsOfObjects(rust_value) => {
|
||||
// foo
|
||||
}
|
||||
};
|
||||
}
|
||||
Ok(ComparePropertiesResult::NoChange)
|
||||
Ok(ret)
|
||||
}
|
||||
|
||||
pub(crate) fn affiliated_keywords_names<'s, GAK>(rust: &'s GAK) -> impl Iterator<Item = String> + 's
|
||||
|
||||
Reference in New Issue
Block a user