mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2025-12-08 14:54:28 +00:00
Use verbose option for regex to lay it out with comments so not
utterly cryptic
This commit is contained in:
@@ -345,8 +345,16 @@ for fnm in ("../all.3d", "../alltracks.3d"):
|
||||
draw = draws[mapcode]
|
||||
lastx, lasty = 0, 0
|
||||
for l in file3d:
|
||||
match = re.match(r'^(MOVE|LINE|NODE)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(-?[0-9.]+)(?:\s+\[(\S*)\])*(?:\s+(.*))*$', l)
|
||||
#oldregex match = re.match(r'^(MOVE|LINE|NODE)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(?:[^[]*\[(.*)\] ?([^]]*)$)?', l)
|
||||
match = re.match(r'''
|
||||
^ #start
|
||||
(MOVE|LINE|NODE) #command type
|
||||
\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
|
||||
''', l, re.VERBOSE)
|
||||
if not match:
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user