Parse val correctly into int or float.

def tokenize_number(val, line):
    """Parse val correctly into int or float."""
    try:
        num = int(val)
        typ = TokenType.int
    except ValueError:
        num = float(val)
        typ = TokenType.float

    return {'type': typ, 'value': num, 'line': line}