diff --git a/parser.py b/parser.py index c78ee74c8f2fa198525965c7f253b1c992e578b2..fee6709320eeb3b5e21924ac42a959299267881a 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):