further tidying and documenting of the main 3ddump file regexp

This commit is contained in:
Wookey 2013-06-19 03:50:45 +01:00
parent d6ee94bf79
commit e7f536cfb7

View File

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