Define number regex patterns in regex.py
devWhen defining NUM_PATTERN in regex.py, you must ensure the regex string contains specific formatting groups enclosed in braces {}. These groups allow the global parser to extract components like decimals and scales.
Example of the required group structure:
{number}: The required digits and sign.{decimals}: The optional decimal part.{scale}: The optional exponent/multiplier part.{fraction}: The optional fraction part.
Additionally, when writing patterns that require literal braces, escape them using double braces (e.g., {{3}} will be interpreted as {3}).
# Example of the required structure for NUM_PATTERN
(?{number}[+-]?\.?\d+)
(?{decimals}[{decimal_operators}]\d+)?
(?{scale}(?:{multipliers})?(?{base}(E|e|\d+)\^?)(?{exponent}[+-]?\d+|[{superscript}]))?
(?{fraction}\ \d+/\d+|\ ?[{unicode_fract}]|/\d+)?