@@ -101,7 +101,8 @@ def any(iterable):
101
101
ENDMOD_RE = re .compile (SOL_STR + r"END\s*MODULE(\s+\w+)?" + EOL_STR , RE_FLAGS )
102
102
103
103
TYPE_RE = re .compile (
104
- SOL_STR + r"TYPE(\s*,\s*BIND\s*\(\s*C\s*\))?(\s*::\s*|\s+)\w+" + EOL_STR ,
104
+ SOL_STR +
105
+ r"TYPE(\s*,\s*(BIND\s*\(\s*C\s*\)|EXTENDS\s*\(.*\)))?(\s*::\s*|\s+)\w+" + EOL_STR ,
105
106
RE_FLAGS )
106
107
ENDTYPE_RE = re .compile (SOL_STR + r"END\s*TYPE(\s+\w+)?" + EOL_STR , RE_FLAGS )
107
108
@@ -116,6 +117,11 @@ def any(iterable):
116
117
117
118
CONTAINS_RE = re .compile (SOL_STR + r"CONTAINS" + EOL_STR , RE_FLAGS )
118
119
120
+ ENUM_RE = re .compile (
121
+ SOL_STR + r"ENUM(\s*,\s*(BIND\s*\(\s*C\s*\)))?(\s*::\s*|\s+)\w+" + EOL_STR ,
122
+ RE_FLAGS )
123
+ ENDENUM_RE = re .compile (SOL_STR + r"END\s*ENUM(\s+\w+)?" + EOL_STR , RE_FLAGS )
124
+
119
125
PUBLIC_RE = re .compile (SOL_STR + r"PUBLIC\s*::" , RE_FLAGS )
120
126
121
127
# intrinsic statements with parenthesis notation that are not functions
@@ -152,11 +158,11 @@ def any(iterable):
152
158
153
159
# combine regex that define subunits
154
160
NEW_SCOPE_RE = [IF_RE , DO_RE , SELCASE_RE , SUBR_RE ,
155
- FCT_RE , MOD_RE , PROG_RE , INTERFACE_RE , TYPE_RE ]
161
+ FCT_RE , MOD_RE , PROG_RE , INTERFACE_RE , TYPE_RE , ENUM_RE ]
156
162
CONTINUE_SCOPE_RE = [ELSE_RE , None , CASE_RE , CONTAINS_RE ,
157
- CONTAINS_RE , CONTAINS_RE , CONTAINS_RE , None , None ]
163
+ CONTAINS_RE , CONTAINS_RE , CONTAINS_RE , None , CONTAINS_RE , None ]
158
164
END_SCOPE_RE = [ENDIF_RE , ENDDO_RE , ENDSEL_RE , ENDSUBR_RE ,
159
- ENDFCT_RE , ENDMOD_RE , ENDPROG_RE , ENDINTERFACE_RE , ENDTYPE_RE ]
165
+ ENDFCT_RE , ENDMOD_RE , ENDPROG_RE , ENDINTERFACE_RE , ENDTYPE_RE , ENDENUM_RE ]
160
166
161
167
162
168
class F90Indenter (object ):
@@ -252,7 +258,8 @@ def process_lines_of_fline(self, f_line, lines, rel_ind, rel_ind_con,
252
258
253
259
elif is_con :
254
260
if not valid_con :
255
- logger .debug ('%s:%d invalid continue statement' , filename , line_nr )
261
+ logger .debug ('%s:%d invalid continue statement' ,
262
+ filename , line_nr )
256
263
line_indents = [ind + indents [- 2 ] for ind in line_indents ]
257
264
258
265
elif is_end :
@@ -326,7 +333,8 @@ def process_lines_of_fline(self, f_line, lines, rel_ind, line_nr):
326
333
327
334
if len (self ._br_indent_list ) > 2 or self ._level :
328
335
logger = logging .getLogger ('prettify-logger' )
329
- logger .debug ('%s:%d unpaired bracket delimiters' , self ._filename , self ._line_nr )
336
+ logger .debug ('%s:%d unpaired bracket delimiters' ,
337
+ self ._filename , self ._line_nr )
330
338
331
339
def get_lines_indent (self ):
332
340
"""
@@ -378,7 +386,8 @@ def __align_line_continuations(self, line, is_decl, indent_size, line_nr):
378
386
level += - 1
379
387
indent_list .pop ()
380
388
else :
381
- logger .debug ('%s:%d unpaired bracket delimiters' , filename , line_nr )
389
+ logger .debug (
390
+ '%s:%d unpaired bracket delimiters' , filename , line_nr )
382
391
383
392
if pos_ldelim :
384
393
pos_ldelim .pop ()
@@ -391,7 +400,8 @@ def __align_line_continuations(self, line, is_decl, indent_size, line_nr):
391
400
if what_del_open == r"[" :
392
401
valid = what_del_close == r"]"
393
402
if not valid :
394
- logger .debug ('%s:%d unpaired bracket delimiters' , filename , line_nr )
403
+ logger .debug (
404
+ '%s:%d unpaired bracket delimiters' , filename , line_nr )
395
405
else :
396
406
pos_rdelim .append (pos )
397
407
rdelim .append (what_del_close )
@@ -571,7 +581,8 @@ def format_single_fline(f_line, whitespace, linebreak_pos, ampersand_sep,
571
581
if level > 0 :
572
582
level += - 1 # close scope
573
583
else :
574
- logger .debug ('%s:%d unpaired bracket delimiters' , filename , line_nr )
584
+ logger .debug (
585
+ '%s:%d unpaired bracket delimiters' , filename , line_nr )
575
586
# add separating whitespace after closing delimiter
576
587
# with some exceptions:
577
588
if not re .search (r"^\s*(" + DEL_CLOSE_STR + r"|[,%:/\*])" ,
0 commit comments