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