comparison mx/outputparser.py @ 7570:2025455e7d80

added collection of compilation speed metric for C1 and C2 to bench command
author Doug Simon <doug.simon@oracle.com>
date Wed, 30 Jan 2013 22:39:51 +0100
parents a8bc60aeacb8
children dc3c8df55905
comparison
equal deleted inserted replaced
7569:7cae58134ff7 7570:2025455e7d80
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 # or visit www.oracle.com if you need additional information or have any 21 # or visit www.oracle.com if you need additional information or have any
22 # questions. 22 # questions.
23 # 23 #
24 # ---------------------------------------------------------------------------------------------------- 24 # ----------------------------------------------------------------------------------------------------
25
26 import re
25 27
26 class OutputParser: 28 class OutputParser:
27 29
28 def __init__(self): 30 def __init__(self):
29 self.matchers = [] 31 self.matchers = []
60 assert not valueMap.has_key(key), key 62 assert not valueMap.has_key(key), key
61 valueMap[key] = value 63 valueMap[key] = value
62 valueMaps.append(valueMap) 64 valueMaps.append(valueMap)
63 65
64 def get_template_value(self, match, template): 66 def get_template_value(self, match, template):
65 if template.startswith('<'): 67 def replace_var(m):
66 assert template.endswith('>') 68 groupName = m.group(1)
67 groupName = template[1:-1]
68 return match.group(groupName) 69 return match.group(groupName)
69 else: 70
70 return template 71 return re.sub(r'<([\w]+)>', replace_var, template)