Disable the existing handling of affiliated keywords.
This commit is contained in:
parent
dd7184da54
commit
f5a6a26c43
@ -354,39 +354,39 @@ where
|
||||
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);
|
||||
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) => {
|
||||
let diff = compare_property_list_of_quoted_string(
|
||||
source,
|
||||
emacs,
|
||||
rust,
|
||||
emacs_property_name.as_str(),
|
||||
|_| Some(rust_value.iter()),
|
||||
)?;
|
||||
ret.push(diff);
|
||||
}
|
||||
AffiliatedKeywordValue::ListOfListsOfObjects(rust_value) => {
|
||||
let diff = compare_property_list_of_list_of_list_of_ast_nodes(
|
||||
source,
|
||||
emacs,
|
||||
rust,
|
||||
emacs_property_name.as_str(),
|
||||
|_| Some(rust_value),
|
||||
)?;
|
||||
ret.push(diff);
|
||||
}
|
||||
};
|
||||
// let emacs_property_name = format!(":{}", rust_name);
|
||||
// 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) => {
|
||||
// let diff = compare_property_list_of_quoted_string(
|
||||
// source,
|
||||
// emacs,
|
||||
// rust,
|
||||
// emacs_property_name.as_str(),
|
||||
// |_| Some(rust_value.iter()),
|
||||
// )?;
|
||||
// ret.push(diff);
|
||||
// }
|
||||
// AffiliatedKeywordValue::ListOfListsOfObjects(rust_value) => {
|
||||
// let diff = compare_property_list_of_list_of_list_of_ast_nodes(
|
||||
// source,
|
||||
// emacs,
|
||||
// rust,
|
||||
// emacs_property_name.as_str(),
|
||||
// |_| Some(rust_value),
|
||||
// )?;
|
||||
// ret.push(diff);
|
||||
// }
|
||||
// };
|
||||
}
|
||||
Ok(ret)
|
||||
}
|
||||
|
@ -35,75 +35,75 @@ where
|
||||
let mut ret = BTreeMap::new();
|
||||
for kw in input {
|
||||
let translated_name = translate_name(global_settings, kw.key);
|
||||
if is_single_string_keyword(global_settings, translated_name.as_str()) {
|
||||
ret.insert(
|
||||
translated_name,
|
||||
AffiliatedKeywordValue::SingleString(kw.value),
|
||||
);
|
||||
} else if is_list_of_single_string_keyword(global_settings, translated_name.as_str()) {
|
||||
let list_of_strings = ret
|
||||
.entry(translated_name)
|
||||
.or_insert_with(|| AffiliatedKeywordValue::ListOfStrings(Vec::with_capacity(1)));
|
||||
match list_of_strings {
|
||||
AffiliatedKeywordValue::ListOfStrings(list_of_strings)
|
||||
if list_of_strings.is_empty() =>
|
||||
{
|
||||
list_of_strings.push(kw.value);
|
||||
}
|
||||
AffiliatedKeywordValue::ListOfStrings(list_of_strings) => {
|
||||
list_of_strings.clear();
|
||||
list_of_strings.push(kw.value);
|
||||
}
|
||||
_ => panic!("Invalid AffiliatedKeywordValue type."),
|
||||
}
|
||||
} else if is_list_of_objects_keyword(global_settings, translated_name.as_str()) {
|
||||
let initial_context = ContextElement::document_context();
|
||||
let initial_context = Context::new(global_settings, List::new(&initial_context));
|
||||
// if is_single_string_keyword(global_settings, translated_name.as_str()) {
|
||||
// ret.insert(
|
||||
// translated_name,
|
||||
// AffiliatedKeywordValue::SingleString(kw.value),
|
||||
// );
|
||||
// } else if is_list_of_single_string_keyword(global_settings, translated_name.as_str()) {
|
||||
// let list_of_strings = ret
|
||||
// .entry(translated_name)
|
||||
// .or_insert_with(|| AffiliatedKeywordValue::ListOfStrings(Vec::with_capacity(1)));
|
||||
// match list_of_strings {
|
||||
// AffiliatedKeywordValue::ListOfStrings(list_of_strings)
|
||||
// if list_of_strings.is_empty() =>
|
||||
// {
|
||||
// list_of_strings.push(kw.value);
|
||||
// }
|
||||
// AffiliatedKeywordValue::ListOfStrings(list_of_strings) => {
|
||||
// list_of_strings.clear();
|
||||
// list_of_strings.push(kw.value);
|
||||
// }
|
||||
// _ => panic!("Invalid AffiliatedKeywordValue type."),
|
||||
// }
|
||||
// } else if is_list_of_objects_keyword(global_settings, translated_name.as_str()) {
|
||||
// let initial_context = ContextElement::document_context();
|
||||
// let initial_context = Context::new(global_settings, List::new(&initial_context));
|
||||
|
||||
let (_remaining, optional_objects) = opt(all_consuming(map(
|
||||
tuple((
|
||||
take_until("["),
|
||||
tag("["),
|
||||
map_parser(
|
||||
recognize(many_till(anychar, peek(tuple((tag("]"), eof))))),
|
||||
confine_context(|i| {
|
||||
all_consuming(many0(parser_with_context!(standard_set_object)(
|
||||
&initial_context,
|
||||
)))(i)
|
||||
}),
|
||||
),
|
||||
tag("]"),
|
||||
eof,
|
||||
)),
|
||||
|(_, _, objects, _, _)| objects,
|
||||
)))(kw.key.into())
|
||||
.expect("Object parser should always succeed.");
|
||||
// let (_remaining, optional_objects) = opt(all_consuming(map(
|
||||
// tuple((
|
||||
// take_until("["),
|
||||
// tag("["),
|
||||
// map_parser(
|
||||
// recognize(many_till(anychar, peek(tuple((tag("]"), eof))))),
|
||||
// confine_context(|i| {
|
||||
// all_consuming(many0(parser_with_context!(standard_set_object)(
|
||||
// &initial_context,
|
||||
// )))(i)
|
||||
// }),
|
||||
// ),
|
||||
// tag("]"),
|
||||
// eof,
|
||||
// )),
|
||||
// |(_, _, objects, _, _)| objects,
|
||||
// )))(kw.key.into())
|
||||
// .expect("Object parser should always succeed.");
|
||||
|
||||
// TODO: This should be omitting footnote references
|
||||
let (_remaining, objects) = all_consuming(many0(parser_with_context!(
|
||||
standard_set_object
|
||||
)(&initial_context)))(kw.value.into())
|
||||
.expect("Object parser should always succeed.");
|
||||
let list_of_lists = ret.entry(translated_name).or_insert_with(|| {
|
||||
AffiliatedKeywordValue::ListOfListsOfObjects(Vec::with_capacity(1))
|
||||
});
|
||||
match list_of_lists {
|
||||
AffiliatedKeywordValue::ListOfListsOfObjects(list_of_lists) => {
|
||||
list_of_lists.push((optional_objects, objects));
|
||||
}
|
||||
_ => panic!("Invalid AffiliatedKeywordValue type."),
|
||||
}
|
||||
} else {
|
||||
let list_of_strings = ret
|
||||
.entry(translated_name)
|
||||
.or_insert_with(|| AffiliatedKeywordValue::ListOfStrings(Vec::with_capacity(1)));
|
||||
match list_of_strings {
|
||||
AffiliatedKeywordValue::ListOfStrings(list_of_strings) => {
|
||||
list_of_strings.push(kw.value);
|
||||
}
|
||||
_ => panic!("Invalid AffiliatedKeywordValue type."),
|
||||
}
|
||||
}
|
||||
// // TODO: This should be omitting footnote references
|
||||
// let (_remaining, objects) = all_consuming(many0(parser_with_context!(
|
||||
// standard_set_object
|
||||
// )(&initial_context)))(kw.value.into())
|
||||
// .expect("Object parser should always succeed.");
|
||||
// let list_of_lists = ret.entry(translated_name).or_insert_with(|| {
|
||||
// AffiliatedKeywordValue::ListOfListsOfObjects(Vec::with_capacity(1))
|
||||
// });
|
||||
// match list_of_lists {
|
||||
// AffiliatedKeywordValue::ListOfListsOfObjects(list_of_lists) => {
|
||||
// list_of_lists.push((optional_objects, objects));
|
||||
// }
|
||||
// _ => panic!("Invalid AffiliatedKeywordValue type."),
|
||||
// }
|
||||
// } else {
|
||||
// let list_of_strings = ret
|
||||
// .entry(translated_name)
|
||||
// .or_insert_with(|| AffiliatedKeywordValue::ListOfStrings(Vec::with_capacity(1)));
|
||||
// match list_of_strings {
|
||||
// AffiliatedKeywordValue::ListOfStrings(list_of_strings) => {
|
||||
// list_of_strings.push(kw.value);
|
||||
// }
|
||||
// _ => panic!("Invalid AffiliatedKeywordValue type."),
|
||||
// }
|
||||
// }
|
||||
}
|
||||
AffiliatedKeywords { keywords: ret }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user