@@ -383,6 +383,9 @@ def __init__(self, output_file_path, logger_name=None):
383383
384384 with open (self .output_file_path , encoding = 'utf-8' ) as f :
385385 self ._lines = list (f .readlines ())
386+
387+ self .is_ags_clgs_style_output = '***AGS/CLGS STYLE OUTPUT***' in [_l .strip () for _l in self ._lines ]
388+
386389 self ._lines_by_category = self ._get_lines_by_category ()
387390
388391 # TODO generic-er result value map
@@ -394,15 +397,16 @@ def __init__(self, output_file_path, logger_name=None):
394397
395398 self .result [category ] = {}
396399 category_lines = self ._lines_by_category .get (category , [])
400+ search_lines = category_lines if not self .is_ags_clgs_style_output else self ._lines
397401
398402 for field in fields :
399403 if isinstance (field , _EqualSignDelimitedField ):
400404 self .result [category ][field .field_name ] = self ._get_equal_sign_delimited_field (
401- field .field_name , search_lines = category_lines
405+ field .field_name , search_lines = search_lines
402406 )
403407 elif isinstance (field , _UnlabeledStringField ):
404408 self .result [category ][field .field_name ] = self ._get_unlabeled_string_field (
405- field .field_name , field .marker_prefixes , search_lines = category_lines
409+ field .field_name , field .marker_prefixes , search_lines = search_lines
406410 )
407411 else :
408412 is_string_field = isinstance (field , _StringValueField )
@@ -412,7 +416,7 @@ def __init__(self, output_file_path, logger_name=None):
412416 field_name ,
413417 is_string_value_field = is_string_field ,
414418 min_indentation_spaces = indent ,
415- search_lines = category_lines ,
419+ search_lines = search_lines ,
416420 )
417421
418422 try :
@@ -465,6 +469,12 @@ def _get_lines_by_category(self) -> dict[str, list[str]]:
465469 for line in self ._lines :
466470
467471 def get_header_content (h_ : str ) -> str :
472+ """
473+ TODO adjust this to also work with AGS/CLGS-style headers like '### Cost Results ###'
474+ For now, AGS-style results are parsed from all lines according to the categories defined in
475+ _RESULT_FIELDS_BY_CATEGORY.
476+ """
477+
468478 if h_ == 'Simulation Metadata' :
469479 return h_
470480 return f'***{ h_ } ***'
0 commit comments