1
2 """A line analyzer that generates a list of names"""
3
4 import re
5
6 from ContextLineAnalyzer import ContextLineAnalyzer
7
9 """Class that finds names depending on a context"""
10
11 - def __init__(self,trigger,analyze,idNr=1,nr=1):
12 """
13 @param trigger: The regular expression that has to match before data is collected
14 @param nr: The number of lines after the match that data is collected
15 @param analyze: The regular expression that is used for analysis
16 @param idNr: The id of the group that is used for analysis
17 """
18 ContextLineAnalyzer.__init__(self,trigger,nr=nr)
19
20 self.analyze=re.compile(analyze)
21 self.idNr=idNr
22
23 self.names=[]
24
26 m=self.analyze.match(line)
27 if m!=None:
28 val=m.group(self.idNr)
29 if val.find(' ')>=0:
30 val="\""+val+"\""
31 self.names.append(val)
32 self.callOnChange()
33
35 """
36 To be called if the name list changes
37 """
38 pass
39