header.py

changeset 101
745f2c3aec0a
parent 97
7b24ff111cb6
--- a/header.py	Tue Aug 25 22:20:15 2020 +0300
+++ b/header.py	Tue Aug 25 22:31:16 2020 +0300
@@ -21,7 +21,8 @@
         self.keywords = ''
         self.cmdline = None
         self.history = []
-        self.first_occurrence = dict()
+        from collections import defaultdict
+        self.occurrences = defaultdict(list)
     @property
     def valid(self):
         return True
@@ -272,8 +273,7 @@
         match = re.search(pattern, self.current())
         if match:
             self.order.append(description)
-            if description not in self.result.first_occurrence:
-                self.result.first_occurrence[description] = self.cursor
+            list.append(self.result.occurrences[description], self.cursor)
             return match.groups()
         else:
             self.parse_error(str.format("couldn't parse {}", description))

mercurial