#! /usr/bin/env python

from lab.parser import Parser

#TODO add pattern for p_star, handle not occurring patterns. 

def checkAttribute(content, props, attribute, default_value):
    if props.get(attribute) is None:
        props[attribute] = default_value

parser = Parser()
parser.add_pattern('wvc', 'WVC = (\d+)', type=int)
parser.add_pattern('c_star', 'C* = (\d+)', type=int)
parser.add_pattern('p_star', 'p* = (\d+\.\d+)', type=float)
parser.add_pattern('error', 'Error Occurred = (.+)', type=str)
parser.add_function(lambda x,y : checkAttribute(x,y,'error','False'))
parser.parse()
