from tokenize import tokenize

from io import BytesIO
import re

def group(*choices): return '(' + '|'.join(choices) + ')'
def any(*choices): return group(*choices) + '*'
def maybe(*choices): return group(*choices) + '?'

Exponent = r'[eE][-+]?[0-9](?:_?[0-9])*'
Pointfloat = group(r'[0-9](?:_?[0-9])*\.(?:[0-9](?:_?[0-9])*)?',
                   r'\.[0-9](?:_?[0-9])*') + maybe(Exponent)
Expfloat = r'[0-9](?:_?[0-9])*' + Exponent
Floatnumber = group(Pointfloat, Expfloat)

def isFloat(number):
    if re.match(Floatnumber, number):
        return True
    return False
    
def tokenizer(expr):
    return list(tokenize(BytesIO(expr.encode('utf-8')).readline))[1:]