From e7f536cfb7e17f284eb42a928b7fe03008d8bbc6 Mon Sep 17 00:00:00 2001 From: Wookey Date: Wed, 19 Jun 2013 03:50:45 +0100 Subject: [PATCH] further tidying and documenting of the main 3ddump file regexp --- .../make-prospectingguide-new.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/noinfo/prospecting_guide_scripts/make-prospectingguide-new.py b/noinfo/prospecting_guide_scripts/make-prospectingguide-new.py index 8b3a4a03e..f62c8ba67 100644 --- a/noinfo/prospecting_guide_scripts/make-prospectingguide-new.py +++ b/noinfo/prospecting_guide_scripts/make-prospectingguide-new.py @@ -347,13 +347,21 @@ for fnm in ("../all.3d", "../alltracks.3d"): for l in file3d: match = re.match(r''' ^ #start - (MOVE|LINE|NODE) #command type + (MOVE|LINE|NODE) #one of three command types \s+(-?[0-9.]+) #X-co-ord \s+(-?[0-9.]+) #Y-co-ord \s+(-?[0-9.]+) #altitude - (?:\s+\[(\S*)\])* #node name inside [] - (?:\s+(.*))* #all optional flags - $ #till the end of the line + (?: #grouping without saving result - for station name + \s+ #at least one space + \[ #opening [ + (\S*) #the station name we want to save + \] #closing ] + )? #end of optional station name group + (?: #grouping without saving result - for flags + \s+ #at least one space separating from [station] + (.*) #all the flags, including spaces + )? #end of optional flags group + $ #end of the line ''', l, re.VERBOSE) if not match: continue