264 @rtype int |
264 @rtype int |
265 """ |
265 """ |
266 # convert lineno to be zero based |
266 # convert lineno to be zero based |
267 lineno -= 1 |
267 lineno -= 1 |
268 # 1. search for opening brace '{' |
268 # 1. search for opening brace '{' |
269 while lineno < len(lines) and not "{" in lines[lineno]: |
269 while lineno < len(lines) and "{" not in lines[lineno]: |
270 lineno += 1 |
270 lineno += 1 |
271 depth = lines[lineno].count("{") - lines[lineno].count("}") |
271 depth = lines[lineno].count("{") - lines[lineno].count("}") |
272 # 2. search for ending line, i.e. matching closing brace '}' |
272 # 2. search for ending line, i.e. matching closing brace '}' |
273 while depth > 0 and lineno < len(lines) - 1: |
273 while depth > 0 and lineno < len(lines) - 1: |
274 lineno += 1 |
274 lineno += 1 |
291 @return end line (one based) |
291 @return end line (one based) |
292 @rtype int |
292 @rtype int |
293 """ |
293 """ |
294 # convert lineno to be zero based |
294 # convert lineno to be zero based |
295 lineno -= 1 |
295 lineno -= 1 |
296 while lineno < len(lines) and not ";" in lines[lineno]: |
296 while lineno < len(lines) and ";" not in lines[lineno]: |
297 lineno += 1 |
297 lineno += 1 |
298 if ";" in lines[lineno]: |
298 if ";" in lines[lineno]: |
299 # found an end indicator, i.e. ';' |
299 # found an end indicator, i.e. ';' |
300 return lineno + 1 |
300 return lineno + 1 |
301 else: |
301 else: |