header.py

changeset 76
c73432653fd9
parent 69
a24c4490d9f2
child 77
d98502ae1f33
--- a/header.py	Sun Jun 23 00:50:22 2019 +0300
+++ b/header.py	Sun Jun 23 00:55:21 2019 +0300
@@ -104,7 +104,9 @@
         self.skip_to_next()
         result.name = self.parse_pattern(r'^Name: (.+)$', 'name')[0]
         self.skip_to_next()
-        result.author, result.username = self.parse_pattern(r'^Author: ([^ \[]*[^\[]+) (?:\[([^\]]+)\])?', 'author')
+        result.author, result.username = self.parse_pattern(r'^Author: (?:([^ \[]*[^\[]+) )?(?:\[([^\]]+)\])?', 'author')
+        if not result.author and not result.username:
+            self.parse_error('author line does not contain a name nor username')
         for header_entry in self.get_more_header_stuff():
             if self.try_to_match(
                 r'^!LDRAW_ORG ' \

mercurial