mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2025-12-08 23:04:35 +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]
|
draw = draws[mapcode]
|
||||||
lastx, lasty = 0, 0
|
lastx, lasty = 0, 0
|
||||||
for l in file3d:
|
for l in file3d:
|
||||||
match = re.match(r'^(MOVE|LINE|NODE)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(-?[0-9.]+)(?:\s+\[(\S*)\])*(?:\s+(.*))*$', l)
|
match = re.match(r'''
|
||||||
#oldregex match = re.match(r'^(MOVE|LINE|NODE)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(?:[^[]*\[(.*)\] ?([^]]*)$)?', l)
|
^ #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:
|
if not match:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user