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,name,exp,idNr=None,idList=None,titles=[],doTimelines=True,doFiles=True):
17 """
18 @param name: name of the expression (needed for output)
19 @param exp: the regular expression
20 @param idNr: number of the pattern group that is used as an identifier
21 @param idList: numbers of the pattern group that are used from the expression
22 @param titles: titles for the data items"""
23 GeneralLineAnalyzer.__init__(self,titles=titles,doTimelines=doTimelines,doFiles=doFiles)
24
25 self.name=name
26 self.idNr=idNr
27 self.idList=idList
28 self.strExp=exp
29 self.exp=re.compile(self.strExp)
30
32 tm=self.parent.getTime()
33 if tm=="":
34 return
35
36 name=self.name
37 fdata=match.groups()
38 if self.idNr!=None:
39 ID=match.group(self.idNr)
40 name+="_"+ID
41 fdata=fdata[:self.idNr-1]+fdata[self.idNr:]
42
43 self.files.write(name,tm,fdata)
44
46 tm=self.parent.getTime()
47 if tm=="":
48 return
49
50 mLen=len(match.groups())
51 ids=self.idList
52 if ids==None:
53 ids=range(mLen)
54 for i in range(len(ids)):
55 ID=ids[i]
56 if ID>=mLen:
57 continue
58 name="%s_%d" % (self.name,ID)
59 if i<len(self.titles):
60 name=self.titles[i]
61 data=match.groups()[ID]
62 self.lines.setValue(name,data)
63
65 """Parses lines for an arbitrary regular expression
66
67 Differs from RegExpLineAnalyzer because it doesn't store its data"""
68
69 - def __init__(self,name,exp,idNr=None,titles=[]):
70 """
71 @param name: name of the expression (needed for output)
72 @param exp: the regular expression
73 @param idNr: number of the pattern group that is used as an identifier
74 @param titles: titles for the data items"""
75 GeneralSimpleLineAnalyzer.__init__(self,name,exp,idNr=idNr,titles=titles,doTimelines=False)
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
100 """Parses lines for an arbitrary regular expression"""
101
102 - def __init__(self,name,exp,idList=None,titles=[]):
103 """@param name: name of the expression (needed for output)
104 @param exp: the regular expression
105 @param idList: numbers of the pattern group that are used from the expression
106 @param titles: titles for the data items"""
107
108 GeneralSimpleLineAnalyzer.__init__(self,name,exp,idNr=idList,titles=titles,doFiles=False)
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141