1
2 """Analyzes lines with regular expressions and changes the phase if it fits"""
3
4 import re
5
6 from .GeneralLineAnalyzer import GeneralLineAnalyzer
7
9 """Parses lines for an arbitrary regular expression
10 and sets the phase if it fits
11 """
12
13
14 - def __init__(self,
15 exp,
16 idNr=None):
17 """
18 @param name: name of the expression (needed for output
19 @param exp: that holds the phase name
20 @param idNr: number of the pattern group that is used as the phase name
21 """
22 GeneralLineAnalyzer.__init__(self,
23 doTimelines=False,
24 doFiles=False)
25
26 self.idNr=idNr
27 self.exp=re.compile(exp)
28
30 """Look for the pattern. If it matches set the phase name"""
31
32 m=self.exp.match(line)
33 if m!=None:
34 self.setPhase(m.group(self.idNr))
35
36
37