refactor: standardize duplicate processes in parser ## Summary This PR refactors the `read_number` function to standardize duplicate code, improve readability, and enhance efficiency. ## Changes - Merged the logic for both `max_digits` cases into a single `read_atomically` closure - Simplified control flow and reduced code duplication