Lines Matching refs:self

73     def __init__(self):
74 self.flags = 0
75 self.groupdict = {}
76 self.groupwidths = [None] # group 0
77 self.lookbehindgroups = None
78 self.grouprefpos = {}
80 def groups(self):
81 return len(self.groupwidths)
82 def opengroup(self, name=None):
83 gid = self.groups
84 self.groupwidths.append(None)
85 if self.groups > MAXGROUPS:
88 ogid = self.groupdict.get(name, None)
92 self.groupdict[name] = gid
94 def closegroup(self, gid, p):
95 self.groupwidths[gid] = p.getwidth()
96 def checkgroup(self, gid):
97 return gid < self.groups and self.groupwidths[gid] is not None
99 def checklookbehindgroup(self, gid, source):
100 if self.lookbehindgroups is not None:
101 if not self.checkgroup(gid):
103 if gid >= self.lookbehindgroups:
109 def __init__(self, state, data=None):
110 self.state = state
113 self.data = data
114 self.width = None
116 def dump(self, level=0):
119 for op, av in self.data:
156 def __repr__(self):
157 return repr(self.data)
158 def __len__(self):
159 return len(self.data)
160 def __delitem__(self, index):
161 del self.data[index]
162 def __getitem__(self, index):
164 return SubPattern(self.state, self.data[index])
165 return self.data[index]
166 def __setitem__(self, index, code):
167 self.data[index] = code
168 def insert(self, index, code):
169 self.data.insert(index, code)
170 def append(self, code):
171 self.data.append(code)
172 def getwidth(self):
174 if self.width is not None:
175 return self.width
177 for op, av in self.data:
203 i, j = self.state.groupwidths[av]
218 self.width = min(lo, MAXREPEAT - 1), min(hi, MAXREPEAT)
219 return self.width
222 def __init__(self, string):
223 self.istext = isinstance(string, str)
224 self.string = string
225 if not self.istext:
227 self.decoded_string = string
228 self.index = 0
229 self.next = None
230 self.__next()
231 def __next(self):
232 index = self.index
234 char = self.decoded_string[index]
236 self.next = None
241 char += self.decoded_string[index]
244 self.string, len(self.string) - 1) from None
245 self.index = index + 1
246 self.next = char
247 def match(self, char):
248 if char == self.next:
249 self.__next()
252 def get(self):
253 this = self.next
254 self.__next()
256 def getwhile(self, n, charset):
259 c = self.next
263 self.__next()
265 def getuntil(self, terminator, name):
268 c = self.next
269 self.__next()
272 raise self.error("missing " + name)
273 raise self.error("missing %s, unterminated name" % terminator,
277 raise self.error("missing " + name, 1)
282 def pos(self):
283 return self.index - len(self.next or '')
284 def tell(self):
285 return self.index - len(self.next or '')
286 def seek(self, index):
287 self.index = index
288 self.__next()
290 def error(self, msg, offset=0):
291 if not self.istext:
293 return error(msg, self.string, self.tell() - offset)
295 def checkgroupname(self, name, offset, nested):
298 raise self.error(msg, len(name) + offset)
299 if not (self.istext or name.isascii()):
303 (name, self.tell() - len(name) - offset),