From 47ede2e6925a164c174e12c09ee116eb6141d61a Mon Sep 17 00:00:00 2001
From: FSMPI Admin-Team <admin@fsmpi.rwth-aachen.de>
Date: Fri, 3 Mar 2017 22:04:11 +0100
Subject: [PATCH] Do not match an emptystring to content, which resulted in a
 infinite loop

---
 parser.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/parser.py b/parser.py
index c78ee74..fee6709 100644
--- a/parser.py
+++ b/parser.py
@@ -156,7 +156,9 @@ class Content(Element):
     # v2: does not require the semicolon, but the newline
     #PATTERN = r"\s*(?<content>(?:[^\[\];\r\n]+)?(?:\[[^\]\r\n]+\][^;\[\]\r\n]*)*);?"
     # v3: does not allow braces in the content
-    PATTERN = r"\s*(?<content>(?:[^\[\];\r\n{}]+)?(?:\[[^\]\r\n{}]+\][^;\[\]\r\n{}]*)*);?"
+    #PATTERN = r"\s*(?<content>(?:[^\[\];\r\n{}]+)?(?:\[[^\]\r\n{}]+\][^;\[\]\r\n{}]*)*);?"
+    # v4: do not allow empty match (require either the first or the second part to be non-empty)
+    PATTERN = r"\s*(?<content>(?:(?:[^\[\];\r\n{}]+)|(?:[^\[\];\r\n{}]+)?(?:\[[^\]\r\n{}]+\][^;\[\]\r\n{}]*)+));?"
 
 class Text:
     def __init__(self, text, linenumber, fork):
-- 
GitLab