Exemplo n.º 1
0
def t_NUMBER(t):
    r'[0-9\.]+[smh]?'
    try:
        t.value = number.unfix(t.value, {'s': 1, 'm': 60, 'h': 60**2})
    except ValueError:
        log.error('Integer value too large %d', t.value)
        t.value = 0
    return t
def t_NUMBER(t):
    r'[0-9\.]+[kmgKMG]?'
    try:
        t.value = number.unfix(t.value, {
                'k': 1024,
                'm': 1024**2,
                'g': 1024**3})
    except ValueError:
        log.error('Integer value too large %d', t.value)
        t.value = 0
    return t
Exemplo n.º 3
0
def t_NUMBER(t):
    r'[0-9\.]+[smh]?'
    try:
        t.value = number.unfix(t.value, {
                's': 1,
                'm': 60,
                'h': 60**2})
    except ValueError:
        log.error('Integer value too large %d', t.value)
        t.value = 0
    return t
def t_NUMBER(t):
    r'[0-9\.]+[kmgKMG]?'
    try:
        t.value = number.unfix(t.value, {
            'k': 1024,
            'm': 1024**2,
            'g': 1024**3
        })
    except ValueError:
        log.error('Integer value too large %d', t.value)
        t.value = 0
    return t