handle default internally
This commit is contained in:
parent
e2a0e98267
commit
fdf7887b47
|
@ -34,10 +34,9 @@ end subroutine YAML_init
|
||||||
!> @brief reads the flow style string and stores it in the form of dictionaries, lists and scalars.
|
!> @brief reads the flow style string and stores it in the form of dictionaries, lists and scalars.
|
||||||
!> @details A node type pointer can either point to a dictionary, list or scalar type entities.
|
!> @details A node type pointer can either point to a dictionary, list or scalar type entities.
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
recursive function parse_flow(flow_string,defaultVal) result(node)
|
recursive function parse_flow(flow_string) result(node)
|
||||||
|
|
||||||
character(len=*), intent(inout) :: flow_string
|
character(len=*), intent(inout) :: flow_string
|
||||||
class(tDict), intent(in), optional, target :: defaultVal
|
|
||||||
class (tNode), pointer :: node
|
class (tNode), pointer :: node
|
||||||
|
|
||||||
class (tNode), pointer :: myVal
|
class (tNode), pointer :: myVal
|
||||||
|
@ -48,8 +47,8 @@ recursive function parse_flow(flow_string,defaultVal) result(node)
|
||||||
d !> position of key: value separator (':')
|
d !> position of key: value separator (':')
|
||||||
|
|
||||||
flow_string = trim(adjustl(flow_string(:)))
|
flow_string = trim(adjustl(flow_string(:)))
|
||||||
if (len_trim(flow_string) == 0 .and. present(defaultVal)) then
|
if (len_trim(flow_string) == 0) then
|
||||||
node => defaultVal
|
node => emptyDict
|
||||||
return
|
return
|
||||||
elseif (flow_string(1:1) == '{') then ! start of a dictionary
|
elseif (flow_string(1:1) == '{') then ! start of a dictionary
|
||||||
e = 1
|
e = 1
|
||||||
|
|
|
@ -70,7 +70,7 @@ subroutine numerics_init
|
||||||
flush(6)
|
flush(6)
|
||||||
numerics_input = IO_read('numerics.yaml')
|
numerics_input = IO_read('numerics.yaml')
|
||||||
numerics_inFlow = to_flow(numerics_input)
|
numerics_inFlow = to_flow(numerics_input)
|
||||||
numerics_root => parse_flow(numerics_inFlow,defaultVal=emptyDict)
|
numerics_root => parse_flow(numerics_inFlow)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue