Report badly formatted ;QM lines

This commit is contained in:
Philip Sargent 2022-07-08 20:08:42 +03:00
parent d3572e18c3
commit ca5586fc42

View File

@ -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'