104104 NAT_VAR_REGEX ,
105105 NON_DEF_REGEX ,
106106 PARAMETER_VAL_REGEX ,
107+ PP_ANY_REGEX ,
107108 PP_DEF_REGEX ,
108109 PP_INCLUDE_REGEX ,
109110 PP_REGEX ,
@@ -978,7 +979,7 @@ def get_code_line(
978979 line_ind -= 1
979980 else : # Free format file
980981 opt_cont_match = FREE_CONT_REGEX .match (curr_line )
981- if opt_cont_match is not None :
982+ if opt_cont_match :
982983 curr_line = (
983984 " " * opt_cont_match .end (0 ) + curr_line [opt_cont_match .end (0 ) :]
984985 )
@@ -989,7 +990,7 @@ def get_code_line(
989990 tmp_no_comm = tmp_line .split ("!" )[0 ]
990991 cont_ind = tmp_no_comm .rfind ("&" )
991992 opt_cont_match = FREE_CONT_REGEX .match (tmp_no_comm )
992- if opt_cont_match is not None :
993+ if opt_cont_match :
993994 if cont_ind == opt_cont_match .end (0 ) - 1 :
994995 break
995996 tmp_no_comm = (
@@ -1022,21 +1023,27 @@ def get_code_line(
10221023 if iComm < 0 :
10231024 iComm = iAmper + 1
10241025 next_line = ""
1026+ # Read the next line if needed
10251027 while (iAmper >= 0 ) and (iAmper < iComm ):
10261028 if line_ind == line_number + 1 :
10271029 curr_line = curr_line [:iAmper ]
10281030 elif next_line != "" :
10291031 post_lines [- 1 ] = next_line [:iAmper ]
10301032 next_line = self .get_line (line_ind , pp_content )
10311033 line_ind += 1
1034+ # Skip any preprocessor statements when seeking the next line
1035+ if PP_ANY_REGEX .match (next_line ):
1036+ next_line = ""
1037+ post_lines .append ("" )
1038+ continue
10321039 # Skip empty or comment lines
10331040 match = FREE_COMMENT_LINE_MATCH .match (next_line )
1034- if ( next_line .rstrip () == "" ) or ( match is not None ) :
1041+ if next_line .rstrip () == "" or match :
10351042 next_line = ""
10361043 post_lines .append ("" )
10371044 continue
10381045 opt_cont_match = FREE_CONT_REGEX .match (next_line )
1039- if opt_cont_match is not None :
1046+ if opt_cont_match :
10401047 next_line = (
10411048 " " * opt_cont_match .end (0 )
10421049 + next_line [opt_cont_match .end (0 ) :]
@@ -1056,9 +1063,7 @@ def get_code_line(
10561063 def strip_comment (self , line : str ) -> str :
10571064 """Strip comment from line"""
10581065 if self .fixed :
1059- if (FIXED_COMMENT_LINE_MATCH .match (line ) is not None ) and (
1060- FIXED_OPENMP_MATCH .match (line ) is not None
1061- ):
1066+ if FIXED_COMMENT_LINE_MATCH .match (line ) and FIXED_OPENMP_MATCH .match (line ):
10621067 return ""
10631068 else :
10641069 if FREE_OPENMP_MATCH .match (line ) is None :
0 commit comments