|
17 | 17 | # the structure of the headers for anybody reading it for the first |
18 | 18 | # time, it's more of a guide to point which parts are this and that. |
19 | 19 | # |
20 | | -# 2. Update the dates in the banner, example: "1.9 (Septmber 2024)" |
| 20 | +# 2. Update the dates in the banner, example: "1.9 (September 2024)" |
21 | 21 | # |
22 | 22 | # =============================================================== |
23 | 23 | # |
@@ -308,16 +308,45 @@ def fetch_lib_info(enum_list): |
308 | 308 | end_ptr = index |
309 | 309 | break |
310 | 310 |
|
| 311 | + |
| 312 | + if start_ptr == -1: |
| 313 | + print(f"start position for technique table not found, aborting") |
| 314 | + sys.exit(1) |
| 315 | + |
| 316 | + if end_ptr == -1: |
| 317 | + print(f"end position for technique table not found, aborting") |
| 318 | + sys.exit(1) |
| 319 | + |
| 320 | + raw_technique_list = [] |
| 321 | + |
| 322 | + if end_ptr > start_ptr: |
| 323 | + raw_technique_list = [line.strip() for line in file_content[start_ptr+1:end_ptr]] |
| 324 | + |
311 | 325 | technique_list = [] |
312 | | - if start_ptr != -1 and end_ptr != -1 and end_ptr > start_ptr: |
313 | | - technique_list = [line.strip() for line in file_content[start_ptr+1:end_ptr]] |
| 326 | + |
| 327 | + for line in raw_technique_list: |
| 328 | + if line.startswith("#"): |
| 329 | + continue |
| 330 | + |
| 331 | + if line == "": |
| 332 | + continue |
| 333 | + |
| 334 | + technique_list.append(line) |
314 | 335 |
|
315 | 336 | for enum in enum_list: |
316 | 337 | for enum_line in technique_list: |
317 | 338 | if enum in enum_line: |
318 | | - match = re.search(r'technique\((\d+)', enum_line) |
319 | | - if match: |
320 | | - technique[enum].score = int(match.group(1)) |
| 339 | + matches = re.findall(r'\d+', enum_line) |
| 340 | + |
| 341 | + if len(matches) == 0: |
| 342 | + print(f"could not find score number in technique table line, aborting") |
| 343 | + sys.exit(1) |
| 344 | + |
| 345 | + if len(matches) > 2: |
| 346 | + print(f"found multiple score numbers in technique table line, aborting") |
| 347 | + sys.exit(1) |
| 348 | + |
| 349 | + technique[enum].score = int(matches[0]) |
321 | 350 | break |
322 | 351 |
|
323 | 352 | # fetch more stuff, comment block surrounding the implementation line |
|
0 commit comments