1
2 """Do analysis for simple expressions"""
3
4 import re
5
6
7
8
9 from .GeneralLineAnalyzer import GeneralLineAnalyzer
10
12 """Parses lines for an arbitrary regular expression
13
14 Differs from RegExpLineAnalyzer because it doesn't store its data"""
15
16 - def __init__(self,
17 name,
18 exp,
19 idNr=None,
20 idList=None,
21 titles=[],
22 doTimelines=True,
23 doFiles=True,
24 singleFile=False,
25 startTime=None,
26 endTime=None):
27 """
28 @param name: name of the expression (needed for output)
29 @param exp: the regular expression
30 @param idNr: number of the pattern group that is used as an identifier
31 @param idList: numbers of the pattern group that are used from the expression
32 @param titles: titles for the data items"""
33 GeneralLineAnalyzer.__init__(self,
34 titles=titles,
35 doTimelines=doTimelines,
36 doFiles=doFiles,
37 singleFile=singleFile,
38 startTime=startTime,
39 endTime=endTime)
40
41 self.name=name
42 self.idNr=idNr
43 self.idList=idList
44 self.strExp=exp
45 self.exp=re.compile(self.strExp)
46
48 tm=self.parent.getTime()
49 if tm=="":
50 return
51
52 name=self.fName(self.name)
53 fdata=match.groups()
54 if self.idNr!=None:
55 ID=match.group(self.idNr)
56 name+="_"+ID
57 fdata=fdata[:self.idNr-1]+fdata[self.idNr:]
58
59 self.files.write(name,tm,fdata)
60
79
81 """Parses lines for an arbitrary regular expression
82
83 Differs from RegExpLineAnalyzer because it doesn't store its data"""
84
85 - def __init__(self,name,exp,idNr=None,titles=[]):
86 """
87 @param name: name of the expression (needed for output)
88 @param exp: the regular expression
89 @param idNr: number of the pattern group that is used as an identifier
90 @param titles: titles for the data items"""
91 GeneralSimpleLineAnalyzer.__init__(self,name,exp,idNr=idNr,titles=titles,doTimelines=False)
92
94 """Parses lines for an arbitrary regular expression"""
95
96 - def __init__(self,name,exp,idList=None,titles=[]):
97 """@param name: name of the expression (needed for output)
98 @param exp: the regular expression
99 @param idList: numbers of the pattern group that are used from the expression
100 @param titles: titles for the data items"""
101
102 GeneralSimpleLineAnalyzer.__init__(self,name,exp,idNr=idList,titles=titles,doFiles=False)
103
104
105