Fix capgen Fortran parser to recognize nested subroutines/functions #424
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #359 (#359).
The
capgen
Fortran parser is updated to know whether it is inside acontains
section of a CCPP scheme. If so, the contents is ignored until anend subroutine scheme_name_ccpp_phase
(e.g.end subroutine mp_thompson_run
) is found.Note that this fix requires that
end subroutine
statements are labeled with the subroutine name, i.e.subroutine mp_thompson_run
requires the end statement to beend subroutine mp_thompson_run
and not justend_subroutine
). This has been a soft requirement forccpp_prebuild.py
, which warns users that an unlabeledend subroutine
statement was found, but in must cases was able to proceed.A more complicated solution that does not require labeled
end subroutine
statements would require counting the number of[begin] subroutine
andend subroutine
statements insidecontains
regions.User interface changes?: No (since labeled
end subroutine
statements have been a soft requirement forccpp_prebuild.py
from the beginning)Fixes #359.
Testing: The existing test of scheme
temp_calc_adjust
was extended to include acontains
section intemp_calc_adjust_run
. Without the changes toscripts/fortran_tools/parse_fortran_file.py
in this PR, thecapgen
test for this scheme failed. After making the changes suggested here, all tests pass (cd tests && ./run_test.sh
).