refactor/ptx ~ polish spelling (comments, names, and exceptions)

This commit is contained in:
Roy Ivy III 2021-05-30 18:35:46 -05:00
parent 324605c78c
commit 13561cb5ae

View file

@ -246,7 +246,7 @@ fn read_input(input_files: &[String], config: &Config) -> FileMap {
file_map
}
/// Go through every lines in the input files and record each match occurance as a `WordRef`.
/// Go through every lines in the input files and record each match occurrence as a `WordRef`.
fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) -> BTreeSet<WordRef> {
let reg = Regex::new(&filter.word_regex).unwrap();
let ref_reg = Regex::new(&config.context_regex).unwrap();
@ -412,7 +412,7 @@ fn get_output_chunks(
0,
) as usize;
// the tail chunk takes text starting from where the after chunk ends (with whitespaces trimmed).
// the tail chunk takes text starting from where the after chunk ends (with whitespace trimmed).
let (tail_beg, _) = trim_idx(all_after, after_end, all_after.len());
// end = begin + max length
@ -493,10 +493,10 @@ fn format_tex_line(
output.push_str(&format!("\\{} ", config.macro_name));
let all_before = if config.input_ref {
let before = &line[0..word_ref.position];
let before_start_trimoff =
let before_start_trim_offset =
word_ref.position - before.trim_start_matches(reference).trim_start().len();
let before_end_index = before.len();
&chars_line[before_start_trimoff..cmp::max(before_end_index, before_start_trimoff)]
&chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)]
} else {
let before_chars_trim_idx = (0, word_ref.position);
&chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]
@ -536,10 +536,10 @@ fn format_roff_line(
output.push_str(&format!(".{}", config.macro_name));
let all_before = if config.input_ref {
let before = &line[0..word_ref.position];
let before_start_trimoff =
let before_start_trim_offset =
word_ref.position - before.trim_start_matches(reference).trim_start().len();
let before_end_index = before.len();
&chars_line[before_start_trimoff..cmp::max(before_end_index, before_start_trimoff)]
&chars_line[before_start_trim_offset..cmp::max(before_end_index, before_start_trim_offset)]
} else {
let before_chars_trim_idx = (0, word_ref.position);
&chars_line[before_chars_trim_idx.0..before_chars_trim_idx.1]