Apply more suggestions.

This commit is contained in:
Tom Alexander
2023-10-16 18:29:21 -04:00
parent 4b6c717812
commit 3069711447
22 changed files with 86 additions and 114 deletions

View File

@@ -16,7 +16,7 @@ use nom::sequence::tuple;
use super::object_parser::standard_set_object;
use super::util::confine_context;
use crate::context::parser_with_context;
use crate::context::bind_context;
use crate::context::Context;
use crate::context::ContextElement;
use crate::context::GlobalSettings;
@@ -64,7 +64,7 @@ where
eof,
)),
|(_, _, objects, _, _)| objects,
)))(kw.key.into())
)))(kw.key)
.expect("Parser should always succeed.");
ret.insert(
translated_name,
@@ -85,8 +85,9 @@ where
map_parser(
recognize(many_till(anychar, peek(tuple((tag("]"), eof))))),
confine_context(|i| {
all_consuming(many0(parser_with_context!(standard_set_object)(
&initial_context,
all_consuming(many0(bind_context!(
standard_set_object,
&initial_context
)))(i)
}),
),
@@ -98,11 +99,11 @@ where
.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 (_remaining, objects) = all_consuming(many0(bind_context!(
standard_set_object,
&initial_context
)))(kw.value.into())
.expect("Object parser should always succeed.");
let entry_per_keyword_list = ret
.entry(translated_name)
@@ -121,7 +122,7 @@ where
fn translate_name<'g, 's>(global_settings: &'g GlobalSettings<'g, 's>, name: &'s str) -> String {
let name_until_optval = name
.split_once("[")
.split_once('[')
.map(|(before, _after)| before)
.unwrap_or(name);
for (src, dst) in global_settings.element_keyword_translation_alist {