def t_NUMBER(self, t):
        r'\d+\.?\d*'
        if t.value.find(".") != -1:
            t.value = float(t.value)
        else:
            t.value = int(t.value)
        return t
def t_NUMBER ( self , t ) : if t . value . find ( "." ) != - 1 : t . value = float ( t . value ) else : t . value = int ( t . value ) return t
r'\d+\.?\d*