1 """Do analysis for simple expressions"""
2
3 import re
4
5
6
7
8 from GeneralLineAnalyzer import GeneralLineAnalyzer
9
11 """Parses lines for an arbitrary regular expression
12
13 Differs from RegExpLineAnalyzer because it doesn't store its data"""
14
15 - def __init__(self,name,exp,idNr=None,idList=None,titles=[],doTimelines=True,doFiles=True):
16 """
17 @param name: name of the expression (needed for output)
18 @param exp: the regular expression
19 @param idNr: number of the pattern group that is used as an identifier
20 @param idList: numbers of the pattern group that are used from the expression
21 @param titles: titles for the data items"""
22 GeneralLineAnalyzer.__init__(self,titles=titles,doTimelines=doTimelines,doFiles=doFiles)
23
24 self.name=name
25 self.idNr=idNr
26 self.idList=idList
27 self.strExp=exp
28 self.exp=re.compile(self.strExp)
29
31 tm=self.parent.getTime()
32 if tm=="":
33 return
34
35 name=self.name
36 fdata=match.groups()
37 if self.idNr!=None:
38 ID=match.group(self.idNr)
39 name+="_"+ID
40 fdata=fdata[:self.idNr-1]+fdata[self.idNr:]
41
42 self.files.write(name,tm,fdata)
43
45 tm=self.parent.getTime()
46 if tm=="":
47 return
48
49 mLen=len(match.groups())
50 ids=self.idList
51 if ids==None:
52 ids=range(mLen)
53 for i in range(len(ids)):
54 ID=ids[i]
55 if ID>=mLen:
56 continue
57 name="%s_%d" % (self.name,ID)
58 if i<len(self.titles):
59 name=self.titles[i]
60 data=match.groups()[ID]
61 self.lines.setValue(name,data)
62
64 """Parses lines for an arbitrary regular expression
65
66 Differs from RegExpLineAnalyzer because it doesn't store its data"""
67
68 - def __init__(self,name,exp,idNr=None,titles=[]):
69 """
70 @param name: name of the expression (needed for output)
71 @param exp: the regular expression
72 @param idNr: number of the pattern group that is used as an identifier
73 @param titles: titles for the data items"""
74 GeneralSimpleLineAnalyzer.__init__(self,name,exp,idNr=idNr,titles=titles,doTimelines=False)
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
99 """Parses lines for an arbitrary regular expression"""
100
101 - def __init__(self,name,exp,idList=None,titles=[]):
102 """@param name: name of the expression (needed for output)
103 @param exp: the regular expression
104 @param idList: numbers of the pattern group that are used from the expression
105 @param titles: titles for the data items"""
106
107 GeneralSimpleLineAnalyzer.__init__(self,name,exp,idNr=idList,titles=titles,doFiles=False)
108
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