reset_node_state Subroutine

subroutine reset_node_state(state)

Reset the reusable node parser state.

Arguments

Type IntentOptional Attributes Name
type(json_node_state_type), intent(inout) :: state

Node parser state to reset


Source Code

  subroutine reset_node_state(state)
    !! Reset the reusable node parser state.
    implicit none

    ! Arguments
    type(json_node_state_type), intent(inout) :: state
    !! Node parser state to reset

    state%in_object = .false.
    state%in_attribute = .false.
    state%attribute_bracket_depth = 0
    state%name = ''
    state%op_type = ''
    state%num_inputs = 0
    state%num_outputs = 0
    state%active_string_array = ''
    state%num_attrs = 0

    if(.not.allocated(state%inputs)) allocate(state%inputs(100))
    if(.not.allocated(state%outputs)) allocate(state%outputs(100))
    if(allocated(state%attrs)) deallocate(state%attrs)
    allocate(state%attrs(0))

  end subroutine reset_node_state