6
6
! >
7
7
! > Both functions additionally calculate and store a file digest (hash) which
8
8
! > is used by the backend ([[fpm_backend]]) to skip compilation of unmodified sources.
9
- ! >
10
- ! > Both functions return an instance of the [[srcfile_t]] type.
9
+ ! >
10
+ ! > Both functions return an instance of the [[srcfile_t]] type.
11
11
! >
12
12
! > For more information, please read the documentation for each function:
13
13
! >
@@ -38,7 +38,7 @@ module fpm_source_parsing
38
38
contains
39
39
40
40
! > Parsing of free-form fortran source files
41
- ! >
41
+ ! >
42
42
! > The following statements are recognised and parsed:
43
43
! >
44
44
! > - `Module`/`submodule`/`program` declaration
@@ -171,7 +171,7 @@ function parse_f_source(f_filename,error) result(f_source)
171
171
if (index (adjustl (file_lines(i)% s(ic+7 :)),' "' ) == 1 .or. &
172
172
index (adjustl (file_lines(i)% s(ic+7 :))," '" ) == 1 ) then
173
173
174
-
174
+
175
175
n_include = n_include + 1
176
176
177
177
if (pass == 2 ) then
@@ -264,7 +264,7 @@ function parse_f_source(f_filename,error) result(f_source)
264
264
if (index (temp_string,' :' ) > 0 ) then
265
265
266
266
temp_string = temp_string(index (temp_string,' :' )+ 1 :)
267
-
267
+
268
268
end if
269
269
270
270
if (.not. validate_name(temp_string)) then
@@ -288,7 +288,7 @@ function parse_f_source(f_filename,error) result(f_source)
288
288
289
289
temp_string = lower(split_n(file_lines(i)% s,n= 2 ,delims= ' ' ,stat= stat))
290
290
if (stat == 0 ) then
291
-
291
+
292
292
if (scan (temp_string,' =(' )>0 ) then
293
293
! Ignore:
294
294
! program =*
@@ -343,7 +343,7 @@ function validate_name(name) result(valid)
343
343
(name (i:i) >= ' 0' .and. name (i:i) <= ' 9' ).or. &
344
344
(lower(name (i:i)) >= ' a' .and. lower(name (i:i)) <= ' z' ).or. &
345
345
name (i:i) == ' _' ) ) then
346
-
346
+
347
347
valid = .false.
348
348
return
349
349
end if
@@ -359,7 +359,7 @@ end function parse_f_source
359
359
360
360
361
361
! > Parsing of c source files
362
- ! >
362
+ ! >
363
363
! > The following statements are recognised and parsed:
364
364
! >
365
365
! > - `#include` preprocessor statement
@@ -396,17 +396,17 @@ function parse_c_source(c_filename,error) result(c_source)
396
396
c_source% unit_type = FPM_UNIT_UNKNOWN
397
397
return
398
398
end if
399
-
399
+
400
400
c_source% digest = fnv_1a(file_lines)
401
-
401
+
402
402
do pass = 1 ,2
403
403
n_include = 0
404
404
file_loop: do i= 1 ,size (file_lines)
405
405
406
406
! Process 'INCLUDE' statements
407
407
if (index (adjustl (lower(file_lines(i)% s)),' #include' ) == 1 .and. &
408
408
index (file_lines(i)% s,' "' ) > 0 ) then
409
-
409
+
410
410
n_include = n_include + 1
411
411
412
412
if (pass == 2 ) then
@@ -440,7 +440,7 @@ end function parse_c_source
440
440
! > n=0 will return the last item
441
441
! > n=-1 will return the penultimate item etc.
442
442
! >
443
- ! > stat = 1 on return if the index
443
+ ! > stat = 1 on return if the index
444
444
! > is not found
445
445
! >
446
446
function split_n (string ,delims ,n ,stat ) result(substring)
0 commit comments