273 |
274 |
281 | """ % (
282 | capture_group_number,
283 | group_type,
284 | capture_group_number,
285 | self.replace_by_patterns(additional_info, self.EXPLANATION_SUBSTITUTIONS)
286 | )
287 |
288 | # Check for end of capture group
289 | group_end_match = re.match(r"end of (?:\\\d+|grouping|look-ahead)\s?(.*)", explanation)
290 |
291 | if group_end_match:
292 | self.was_actual_rule = False
293 |
294 | additional_info = group_end_match.group(1)
295 |
296 | footer = """
297 |
300 | """ % self.replace_by_patterns(additional_info, self.EXPLANATION_SUBSTITUTIONS)
301 |
302 | return """
303 | %s
304 | %s
305 |
306 |
307 | """ % (
308 | separator if additional_info else "",
309 | footer if additional_info else ""
310 | )
311 |
312 | self.was_actual_rule = True
313 |
314 | # Regular case
315 | return """
316 | %s
317 |