diff options
-rw-r--r-- | parsers/survex.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/parsers/survex.py b/parsers/survex.py index e4ec8b3..acc76dd 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -118,6 +118,7 @@ class LoadingSurvex(): rx_teammem = re.compile(r"(?i)"+instruments+"?(?:es|s)?\s+(.*)"+instruments+"?(?:es|s)?$") rx_person = re.compile(r"(?i) and | / |, | & | \+ |^both$|^none$") rx_qm = re.compile(r'(?i)^\s*QM(\d)\s+?([a-dA-DxX])\s+([\w\-]+)\.(\d+)\s+(([\w\-]+)\.(\d+)|\-)\s+(.+)$') + rx_qm0 = re.compile(r'(?i)^\s*QM(\d)\s+(.+)$') # remember there is also QM_PATTERN used in views.other and set in settings.py rx_tapelng = re.compile(r'(?i).*(tape|length).*$') @@ -508,6 +509,7 @@ class LoadingSurvex(): def LoadSurvexQM(self, survexblock, qmline): insp = self.insp + qm_no = qmline.group(1) # this may not be unique across multiple survex files qm_grade = qmline.group(2) @@ -820,9 +822,16 @@ class LoadingSurvex(): if implicitline: self.LoadSurvexRef(survexblock, comment) - qmline = self.rx_qm.match(comment) - if qmline: - self.LoadSurvexQM(survexblock, qmline) + qml = self.rx_qm0.match(comment) + if qml: + qmline = self.rx_qm.match(comment) + if qmline: + self.LoadSurvexQM(survexblock, qmline) + else: + message = f' ! QM Unrecognised as a valid QM in "{survexblock.survexfile.path}" {qml}' + print(message) + DataIssue.objects.create(parser='survex', message=message) + included = self.rx_comminc.match(comment) # ;*include means 'we have been included'; whereas *include means 'proceed to include' |