mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 14:17:15 +00:00
fixing resolved QM regex
This commit is contained in:
@@ -271,6 +271,7 @@ class LoadingSurvex:
|
||||
rx_linelen = re.compile(r"[\d\-+.]+$")
|
||||
|
||||
# this extensive list of expo roles are now (after 24/2/2025) just comments and not legal survex code.
|
||||
# all now irrelevant as Olly restricted the list and survex now notices this.
|
||||
roles = "(assistant|bitch|bodger|bolt|bolter|bolting|book|clino|comp|compass|consultant|disto|distox|distox2|"
|
||||
roles += "dog|dogsbody|drawing|drill|gps|helper|inst|instr|instrument|length|monkey|nagging|nail|"
|
||||
roles += "nail_polish|nail_polish_bitch|nail_polish_monkey|nail_varnish|nail_varnish_bitch|note|notebook|"
|
||||
@@ -283,14 +284,7 @@ class LoadingSurvex:
|
||||
rx_teamabs = re.compile(r"(?i)^\s*(" + roles + r")?(?:es|s)?\s*$")
|
||||
rx_teamone = re.compile(r"(?i)^\s*(.*)\s*$")
|
||||
rx_person = re.compile(r"(?i) and |/| / |, | , |&| & | \+ |^both$|^none$")
|
||||
rx_qm = re.compile(
|
||||
# r"(?i)^\s*QM(\d+)\s+(.+)\s+([\w\-\_]+)\.([\w\.\-]+)\s+(([\w\-]+)\.([\w\.\-]+)|\-)\s+(.+)$"
|
||||
r"(?i)^\s*QM(\d+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+(.+)$"
|
||||
)
|
||||
# does not recognise non numeric suffix survey point ids
|
||||
rx_qm0 = re.compile(r"(?i)^\s*QM(\d+)\s+(.+)$")
|
||||
rx_qm_tick = re.compile(r"(?i)^\s*QM(\d+)\s+TICK\s([\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).*$")
|
||||
|
||||
rx_cave = re.compile(r"(?i)caves-(\d\d\d\d)/([-\d\w]+|\d\d\d\d-?\w+-\d+)")
|
||||
@@ -309,6 +303,17 @@ class LoadingSurvex:
|
||||
rx_commteam = re.compile(r"(?i)\s*(Messteam|Zeichner|LUSS Dead Mountains)\s*[:]?(.*)") # non-expo survex files
|
||||
rx_quotedtitle = re.compile(r'(?i)^"(.*)"$')
|
||||
|
||||
# QM recognizers
|
||||
# does not recognise non numeric suffix survey point ids
|
||||
rx_qm0 = re.compile(r"(?i)^\s*QM(\d+)\s+(.+)$")
|
||||
rx_qm_tick = re.compile(r"(?i)^\s*QM(\d+)\s+TICK\s([\d\-]+)\s(.*)$")
|
||||
# remember there is also QM_PATTERN used in views.other and set in settings.py
|
||||
|
||||
rx_qm = re.compile(
|
||||
r"^\s*QM(\d+)\s+([A-DVXa-dvx?])\s+([\w\-\_]+\.)?(([\w\.\-]+))\s*(\-|([\w\-]+)(\.([\w\.\-]+))?)(\s+(.*))$"
|
||||
)
|
||||
# This regex matches a QM survey line where station identifiers and locations may be optional or placeholders.
|
||||
|
||||
"""
|
||||
Regular expression explanation for rx_starref (MS CoPilot) - Not actually USED any more ?!
|
||||
|
||||
@@ -1626,9 +1631,18 @@ class LoadingSurvex:
|
||||
which is a QM new declaration or a QM TICK closing declaration.
|
||||
|
||||
It _should_ recognise a non-numeric survey station ID, but currently doesn't.
|
||||
Valid QM types are [a-dA-DvVxX?] A-D, V for Vertical, X for horrible and ? for unknown
|
||||
Valid QM types are [A-DvVxX?] A-D, V for Vertical, X for horrible and ? for unknown
|
||||
"""
|
||||
# rx_qm : r"(?i)^\s*QM(\d+)\s+?(.+)\s+([\w\-\_]+)(\.([\w\.\-]+)?)\s+(([\w\-]+)\.([\w\.\-]+)|\-)\s+(.+)$)
|
||||
# This regex parses strings that start with "QM" followed by digits, then extracts several structured parts:
|
||||
# (?i) : Case-insensitive matching
|
||||
# ^\s* : Start of line, optional leading whitespace
|
||||
# QM(\d+) : "QM" followed by a digit sequence (capture group 1)
|
||||
# \s+?(.+) : Minimal spaces, then a descriptive text (capture group 2)
|
||||
# \s+([\w\-_]+) : identifier prefix with word characters, hyphen or underscore (capture group 3)
|
||||
# (\.([\w.\-]+)?) : identifier starting with a dot (capture group 4 and 5)
|
||||
# \s+(([\w\-]+)\.([\w.\-]+)|\-?) : Either a pair of identifiers separated by a dot or an optional single dash (capture group 6, with 7 & 8 as subgroups)
|
||||
# \s+(.+)$ : Remaining text at the end (e.g., comments or summary) (capture group 9)
|
||||
qmline = self.rx_qm.match(comment)
|
||||
if qmline:
|
||||
self.LoadSurvexQM(survexblock, qmline)
|
||||
|
||||
Reference in New Issue
Block a user