from extract_lines import *

def storeDecimal(container, matchobj):
    container.append(int(matchobj.group(1))) 
    
if __name__ == "__main__":
    data = """
    int tens[8] = { 11, 12, 13,
            14, 15, 16, 17, 18};

    int twenties[12] = { 21, 22, 23, 24, 25,
    26, 27, 28, 29, 20, 21, 22};

    int thirties[4] = { 34, 35, 36, 37 };
    """
    # Split lines    
    lines = data.split("\n")
    
    # Allocate empty list to store results
    newData = []
    
    # Extract all integers
    newLines = extract_lines(lines,
        r"twenties\[.*\]", # Find start of twenties array"
        r";", # End on line with ";"
        '([0-9]+)', # Extract decimal values
        lambda matchobj: storeDecimal(newData, matchobj))

    # Print results for fun
    for item in newData:
        print item
