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