aboutsummaryrefslogtreecommitdiff
path: root/fpm/src/fpm_sources.f90
diff options
context:
space:
mode:
Diffstat (limited to 'fpm/src/fpm_sources.f90')
-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