aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLKedward <laurence.kedward@bristol.ac.uk>2020-09-18 10:51:36 +0100
committerLKedward <laurence.kedward@bristol.ac.uk>2020-09-18 11:19:42 +0100
commit507b315570d1d6521e2e15ad9579df205c53bc39 (patch)
treef6b447c2bdb6d93529fdded843ad6474c9406534
parent800289818fe97d5855ca8400f52080751b0f199f (diff)
downloadfpm-507b315570d1d6521e2e15ad9579df205c53bc39.tar.gz
fpm-507b315570d1d6521e2e15ad9579df205c53bc39.zip
Fix: add submodule name to modules_provided
-rw-r--r--fpm/src/fpm_sources.f9024
1 files changed, 21 insertions, 3 deletions
diff --git a/fpm/src/fpm_sources.f90 b/fpm/src/fpm_sources.f90
index dc50fd1..b104fa6 100644
--- a/fpm/src/fpm_sources.f90
+++ b/fpm/src/fpm_sources.f90
@@ -310,7 +310,7 @@ function parse_f_source(f_filename,error) result(f_source)
if (.not.validate_name(mod_name)) then
call file_parse_error(error,f_filename, &
'empty or invalid name for module',i, &
- file_lines(i)%s)
+ file_lines(i)%s, index(file_lines(i)%s,mod_name))
return
end if
@@ -327,6 +327,22 @@ function parse_f_source(f_filename,error) result(f_source)
! Extract name of submodule if is submodule
if (index(adjustl(lower(file_lines(i)%s)),'submodule') == 1) then
+ mod_name = split_n(file_lines(i)%s,n=3,delims='()',stat=stat)
+ if (stat /= 0) then
+ call file_parse_error(error,f_filename, &
+ 'unable to get submodule name',i, &
+ file_lines(i)%s)
+ return
+ end if
+ if (.not.validate_name(mod_name)) then
+ call file_parse_error(error,f_filename, &
+ 'empty or invalid name for submodule',i, &
+ file_lines(i)%s, index(file_lines(i)%s,mod_name))
+ return
+ end if
+
+ n_mod = n_mod + 1
+
temp_string = split_n(file_lines(i)%s,n=2,delims='()',stat=stat)
if (stat /= 0) then
call file_parse_error(error,f_filename, &
@@ -347,8 +363,6 @@ function parse_f_source(f_filename,error) result(f_source)
end if
- f_source%modules_used(n_use)%s = lower(temp_string)
-
if (.not.validate_name(temp_string)) then
call file_parse_error(error,f_filename, &
'empty or invalid name for submodule parent',i, &
@@ -356,6 +370,10 @@ function parse_f_source(f_filename,error) result(f_source)
return
end if
+ f_source%modules_used(n_use)%s = lower(temp_string)
+
+ f_source%modules_provided(n_mod)%s = lower(mod_name)
+
end if
end if