closed_construct Function

public pure function closed_construct(second, third) result(construct)

The construct that end second third closes (C_ANY for a bare end), or C_NONE if second names no construct, so that the end is not a closing statement.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: second

the word after end, in lowercase, or ''

character(len=*), intent(in) :: third

the word after that, or '' (data in end block data)

Return Value integer


Called by

proc~~closed_construct~~CalledByGraph proc~closed_construct closed_construct proc~classify_statement classify_statement proc~classify_statement->proc~closed_construct proc~analyze_structure analyze_structure proc~analyze_structure->proc~classify_statement proc~format_pass format_pass proc~format_pass->proc~analyze_structure proc~format_text format_text proc~format_text->proc~format_pass proc~relayout relayout proc~format_text->proc~relayout proc~relayout->proc~format_pass proc~process_text process_text proc~process_text->proc~format_text proc~process_file process_file proc~process_file->proc~process_text proc~process_stdin process_stdin proc~process_stdin->proc~process_text proc~run run proc~run->proc~process_file proc~run->proc~process_stdin

Source Code

pure integer function closed_construct(second, third) result(construct)
    !! The construct that `end second third` closes (`C_ANY` for a bare `end`), or `C_NONE` if
    !! `second` names no construct, so that the `end` is not a closing statement.
    character(len=*), intent(in) :: second   !! the word after `end`, in lowercase, or `''`
    character(len=*), intent(in) :: third    !! the word after that, or `''` (`data` in `end block data`)
    select case (second)
    case ('')
        construct = C_ANY
    case ('if')
        construct = C_IF
    case ('do')
        construct = C_DO
    case ('select')
        construct = C_SELECT
    case ('associate')
        construct = C_ASSOCIATE
    case ('block')
        construct = merge(C_BLOCK_DATA, C_BLOCK, third == 'data')
    case ('blockdata')
        construct = C_BLOCK_DATA
    case ('critical')
        construct = C_CRITICAL
    case ('team')
        construct = C_TEAM
    case ('where')
        construct = C_WHERE
    case ('forall')
        construct = C_FORALL
    case ('enum')
        construct = C_ENUM
    case ('enumeration')
        construct = merge(C_ENUMERATION, C_NONE, third == 'type')
    case ('interface')
        construct = C_INTERFACE
    case ('type')
        construct = C_TYPE
    case ('function')
        construct = C_FUNCTION
    case ('subroutine')
        construct = C_SUBROUTINE
    case ('procedure')
        construct = C_PROCEDURE
    case ('module')
        construct = C_MODULE
    case ('submodule')
        construct = C_SUBMODULE
    case ('program')
        construct = C_PROGRAM
    case default
        construct = C_NONE
    end select
end function closed_construct