Utilities/ClassBrowsers/idlclbr.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3039
8dd0165d805d
child 3145
a9de05d4a22f
equal deleted inserted replaced
3058:0a02c433f52d 3060:5883ce99ee12
83 ) 83 )
84 84
85 | (?P<End> 85 | (?P<End>
86 [ \t]* } [ \t]* ; 86 [ \t]* } [ \t]* ;
87 ) 87 )
88 """, re.VERBOSE | re.DOTALL | re.MULTILINE).search 88 """, re.VERBOSE | re.DOTALL | re.MULTILINE).search # __IGNORE_WARNING__
89 89
90 # function to replace comments 90 # function to replace comments
91 _commentsub = re.compile(r"""//[^\n]*\n|//[^\n]*$""").sub 91 _commentsub = re.compile(r"""//[^\n]*\n|//[^\n]*$""").sub
92 # function to normalize whitespace 92 # function to normalize whitespace
93 _normalize = re.compile(r"""[ \t]{2,}""").sub 93 _normalize = re.compile(r"""[ \t]{2,}""").sub
238 meth_sig = _normalize(' ', meth_sig) 238 meth_sig = _normalize(' ', meth_sig)
239 lineno = lineno + src.count('\n', last_lineno_pos, start) 239 lineno = lineno + src.count('\n', last_lineno_pos, start)
240 last_lineno_pos = start 240 last_lineno_pos = start
241 # close all interfaces/modules indented at least as much 241 # close all interfaces/modules indented at least as much
242 while classstack and \ 242 while classstack and \
243 classstack[-1][1] >= thisindent: 243 classstack[-1][1] >= thisindent:
244 if classstack[-1][0] is not None: 244 if classstack[-1][0] is not None:
245 # record the end line 245 # record the end line
246 classstack[-1][0].setEndLine(lineno - 1) 246 classstack[-1][0].setEndLine(lineno - 1)
247 del classstack[-1] 247 del classstack[-1]
248 if classstack: 248 if classstack:
287 # we found an interface definition 287 # we found an interface definition
288 thisindent = indent 288 thisindent = indent
289 indent += 1 289 indent += 1
290 # close all interfaces/modules indented at least as much 290 # close all interfaces/modules indented at least as much
291 while classstack and \ 291 while classstack and \
292 classstack[-1][1] >= thisindent: 292 classstack[-1][1] >= thisindent:
293 if classstack[-1][0] is not None: 293 if classstack[-1][0] is not None:
294 # record the end line 294 # record the end line
295 classstack[-1][0].setEndLine(lineno - 1) 295 classstack[-1][0].setEndLine(lineno - 1)
296 del classstack[-1] 296 del classstack[-1]
297 lineno = lineno + src.count('\n', last_lineno_pos, start) 297 lineno = lineno + src.count('\n', last_lineno_pos, start)
323 # we found a module definition 323 # we found a module definition
324 thisindent = indent 324 thisindent = indent
325 indent += 1 325 indent += 1
326 # close all interfaces/modules indented at least as much 326 # close all interfaces/modules indented at least as much
327 while classstack and \ 327 while classstack and \
328 classstack[-1][1] >= thisindent: 328 classstack[-1][1] >= thisindent:
329 if classstack[-1][0] is not None: 329 if classstack[-1][0] is not None:
330 # record the end line 330 # record the end line
331 classstack[-1][0].setEndLine(lineno - 1) 331 classstack[-1][0].setEndLine(lineno - 1)
332 del classstack[-1] 332 del classstack[-1]
333 lineno = lineno + src.count('\n', last_lineno_pos, start) 333 lineno = lineno + src.count('\n', last_lineno_pos, start)

eric ide

mercurial