@@ -1677,11 +1677,11 @@ def parse(
1677
1677
message = f"Unexpected end of scope at line { error [0 ]} "
1678
1678
else :
1679
1679
message = "Unexpected end statement: No open scopes"
1680
- log .debug (f" { error [1 ]} : { message } " )
1680
+ log .debug ("%s: %s" , error [1 ], message )
1681
1681
if len (file_ast .parse_errors ) > 0 :
1682
1682
log .debug ("\n === Parsing Errors ===\n " )
1683
1683
for error in file_ast .parse_errors :
1684
- log .debug (f" { error [' range' ] } : { error [' message' ] } " )
1684
+ log .debug ("%s: %s" , error [" range" ], error [" message" ] )
1685
1685
return file_ast
1686
1686
1687
1687
def parse_imp_dim (self , line : str ):
@@ -1919,7 +1919,7 @@ def add_line_comment(file_ast: FortranAST, docs: list[str]):
1919
1919
# Handle dangling comments from previous line
1920
1920
if docs :
1921
1921
file_ast .add_doc (format (docs ))
1922
- log .debug (f" { format ( docs ) } !!! Doc string - Line:{ ln } " )
1922
+ log .debug ("%s !!! Doc string - Line:%d" , format ( docs ), ln )
1923
1923
docs [:] = [] # empty the documentation stack
1924
1924
1925
1925
# Check for comments in line
@@ -1940,7 +1940,7 @@ def add_line_comment(file_ast: FortranAST, docs: list[str]):
1940
1940
if len ("" .join (docs )) > 0 :
1941
1941
file_ast .add_doc (format (docs ), forward = predocmark )
1942
1942
for i , doc_line in enumerate (docs ):
1943
- log .debug (f" { doc_line } !!! Doc string - Line:{ _ln + i } " )
1943
+ log .debug ("%s !!! Doc string - Line:%d" , doc_line , _ln + i )
1944
1944
docs [:] = []
1945
1945
return ln
1946
1946
@@ -2143,10 +2143,10 @@ def append_multiline_macro(def_value: str | tuple, line: str):
2143
2143
if if_start :
2144
2144
if is_path :
2145
2145
pp_stack .append ([- 1 , - 1 ])
2146
- log .debug (f" { line . strip () } !!! Conditional TRUE({ i + 1 } )" )
2146
+ log .debug ("%s !!! Conditional TRUE(%d)" , line . strip (), i + 1 )
2147
2147
else :
2148
2148
pp_stack .append ([i + 1 , - 1 ])
2149
- log .debug (f" { line . strip () } !!! Conditional FALSE({ i + 1 } )" )
2149
+ log .debug ("%s !!! Conditional FALSE(%d)" , line . strip (), i + 1 )
2150
2150
continue
2151
2151
if len (pp_stack ) == 0 :
2152
2152
continue
@@ -2195,19 +2195,19 @@ def append_multiline_macro(def_value: str | tuple, line: str):
2195
2195
pp_stack_group .pop ()
2196
2196
if pp_stack [- 1 ][0 ] < 0 :
2197
2197
pp_stack .pop ()
2198
- log .debug (f" { line . strip () } !!! Conditional TRUE/END({ i + 1 } )" )
2198
+ log .debug ("%s !!! Conditional TRUE/END(%d)" , line . strip (), i + 1 )
2199
2199
continue
2200
2200
if pp_stack [- 1 ][1 ] < 0 :
2201
2201
pp_stack [- 1 ][1 ] = i + 1
2202
- log .debug (f" { line . strip () } !!! Conditional FALSE/END({ i + 1 } )" )
2202
+ log .debug ("%s !!! Conditional FALSE/END(%d)" , line . strip (), i + 1 )
2203
2203
pp_skips .append (pp_stack .pop ())
2204
2204
if debug :
2205
2205
if inc_start :
2206
- log .debug (f" { line . strip () } !!! Conditional TRUE({ i + 1 } )" )
2206
+ log .debug ("%s !!! Conditional TRUE(%d)" , line . strip (), i + 1 )
2207
2207
elif exc_start :
2208
- log .debug (f" { line . strip () } !!! Conditional FALSE({ i + 1 } )" )
2208
+ log .debug ("%s !!! Conditional FALSE(%d)" , line . strip (), i + 1 )
2209
2209
elif exc_continue :
2210
- log .debug (f" { line . strip () } !!! Conditional EXCLUDED({ i + 1 } )" )
2210
+ log .debug ("%s !!! Conditional EXCLUDED(%d)" , line . strip (), i + 1 )
2211
2211
continue
2212
2212
# Handle variable/macro definitions files
2213
2213
match = FRegex .PP_DEF .match (line )
@@ -2242,12 +2242,12 @@ def append_multiline_macro(def_value: str | tuple, line: str):
2242
2242
defs_tmp [def_name ] = def_value
2243
2243
elif (match .group (1 ) == "undef" ) and (def_name in defs_tmp ):
2244
2244
defs_tmp .pop (def_name , None )
2245
- log .debug (f" { line . strip () } !!! Define statement({ i + 1 } )" )
2245
+ log .debug ("%s !!! Define statement(%d)" , line . strip (), i + 1 )
2246
2246
continue
2247
2247
# Handle include files
2248
2248
match = FRegex .PP_INCLUDE .match (line )
2249
2249
if (match is not None ) and ((len (pp_stack ) == 0 ) or (pp_stack [- 1 ][0 ] < 0 )):
2250
- log .debug (f" { line . strip () } !!! Include statement({ i + 1 } )" )
2250
+ log .debug ("%s !!! Include statement(%d)" , line . strip (), i + 1 )
2251
2251
include_filename = match .group (1 ).replace ('"' , "" )
2252
2252
include_path = None
2253
2253
# Intentionally keep this as a list and not a set. There are cases
@@ -2263,7 +2263,7 @@ def append_multiline_macro(def_value: str | tuple, line: str):
2263
2263
include_file = FortranFile (include_path )
2264
2264
err_string , _ = include_file .load_from_disk ()
2265
2265
if err_string is None :
2266
- log .debug (f' \n !!! Parsing include file " { include_path } "' )
2266
+ log .debug (" \n !!! Parsing include file '%s'" , include_path )
2267
2267
_ , _ , _ , defs_tmp = preprocess_file (
2268
2268
include_file .contents_split ,
2269
2269
file_path = include_path ,
@@ -2274,13 +2274,15 @@ def append_multiline_macro(def_value: str | tuple, line: str):
2274
2274
log .debug ("!!! Completed parsing include file\n " )
2275
2275
2276
2276
else :
2277
- log .debug (f "!!! Failed to parse include file: { err_string } " )
2277
+ log .debug ("!!! Failed to parse include file: %s" , err_string )
2278
2278
2279
2279
except :
2280
2280
log .debug ("!!! Failed to parse include file: exception" )
2281
2281
2282
2282
else :
2283
- log .debug (f"{ line .strip ()} !!! Could not locate include file ({ i + 1 } )" )
2283
+ log .debug (
2284
+ "%s !!! Could not locate include file (%d)" , line .strip (), i + 1
2285
+ )
2284
2286
2285
2287
# Substitute (if any) read in preprocessor macros
2286
2288
for def_tmp , value in defs_tmp .items ():
@@ -2302,7 +2304,11 @@ def append_multiline_macro(def_value: str | tuple, line: str):
2302
2304
line_new , nsubs = def_regex .subn (value , line )
2303
2305
if nsubs > 0 :
2304
2306
log .debug (
2305
- f"{ line .strip ()} !!! Macro sub({ i + 1 } ) '{ def_tmp } ' -> { value } "
2307
+ "%s !!! Macro sub(%d) '%s' -> '%s'" ,
2308
+ line .strip (),
2309
+ i + 1 ,
2310
+ def_tmp ,
2311
+ value ,
2306
2312
)
2307
2313
line = line_new
2308
2314
output_file .append (line )
0 commit comments