Add a spacing check
This commit is contained in:
parent
6692bfdee9
commit
c5ffeaad20
|
@ -80,6 +80,10 @@ fn lines_read_noempty<T: BufRead>(lines: &mut Lines<T>) -> Result<Option<String>
|
|||
|
||||
fn unfuck_cif_number(number: &str) -> Result<u32> {
|
||||
let mut buf = ArrayString::<2048>::new();
|
||||
// the split later will discard leading/trailing whitespace information, so we first check if it's there
|
||||
if number.is_empty() || number.as_bytes()[0] == 32 || number.as_bytes()[number.len()-1] == 32 {
|
||||
return Err(GrammarError(number.to_string()));
|
||||
}
|
||||
let split = number.split_whitespace().collect::<ArrayVec<_, 64>>();
|
||||
let splitlen = split.len();
|
||||
for (i, word) in split.iter().enumerate() {
|
||||
|
|
Loading…
Reference in a new issue