processNonDigit method
We've encountered a character that's not a digit. Go through our replacement rules looking for how to handle it. If we see something that's not a digit and doesn't have a replacement, then we're done and the number is probably invalid.
Implementation
void processNonDigit() {
// It might just be a prefix that we haven't skipped. We don't want to
// skip them initially because they might also be semantically meaningful,
// e.g. leading %. So we allow them through the loop, but only once.
var foundAnInterpretation = false;
if (input.atStart && !prefixesSkipped) {
prefixesSkipped = true;
checkPrefixes(skip: true);
foundAnInterpretation = true;
}
for (var key in replacements.keys) {
if (input.startsWith(key)) {
_normalized.write(replacements[key]!());
input.pop(key.length);
return;
}
}
// We haven't found either of these things, this seems invalid.
if (!foundAnInterpretation) {
done = true;
}
}