scope_stack_t Derived Type

type, private :: scope_stack_t

The open constructs, outermost first.


Inherits

type~~scope_stack_t~~InheritsGraph type~scope_stack_t scope_stack_t type~scope_t scope_t type~scope_stack_t->type~scope_t s

Components

Type Visibility Attributes Name Initial
type(scope_t), public, allocatable :: s(:)

storage; only s(1:top) is in use

integer, public :: top = 0

number of open constructs


Type-Bound Procedures

procedure, public :: push => stack_push

open a construct

  • private pure subroutine stack_push(self, sc)

    Open construct sc, growing the storage as needed.

    Arguments

    Type IntentOptional Attributes Name
    class(scope_stack_t), intent(inout) :: self

    the stack

    type(scope_t), intent(in) :: sc

    the construct to open

procedure, public :: restore => stack_restore

replace the open constructs by saved ones

  • private pure subroutine stack_restore(self, scopes)

    Replace the open constructs by scopes (outermost first).

    Arguments

    Type IntentOptional Attributes Name
    class(scope_stack_t), intent(inout) :: self

    the stack

    type(scope_t), intent(in) :: scopes(:)

    a saved stack (see stack_snapshot)

procedure, public :: snapshot => stack_snapshot

the open constructs, to save

  • private pure function stack_snapshot(self) result(scopes)

    The open constructs, outermost first.

    Arguments

    Type IntentOptional Attributes Name
    class(scope_stack_t), intent(in) :: self

    the stack

    Return Value type(scope_t), allocatable, (:)

Source Code

type :: scope_stack_t
    !! The open constructs, outermost first.
    type(scope_t), allocatable :: s(:)   !! storage; only `s(1:top)` is in use
    integer :: top = 0                   !! number of open constructs
contains
    procedure :: push => stack_push          !! open a construct
    procedure :: restore => stack_restore    !! replace the open constructs by saved ones
    procedure :: snapshot => stack_snapshot  !! the open constructs, to save
end type scope_stack_t