subroutine dispatch_group(this, lines, n_lines, li, col, gname, prefix, &
group_seen, errors, n_err, path)
!! Resolve a group name to known / external / unknown and parse
!! (or skip) its body up to the terminating '/'.
type(nml_schema_t), intent(inout) :: this
character(len=*), intent(in) :: lines(:)
integer, intent(in) :: n_lines
integer, intent(inout) :: li, col
character(len=*), intent(in) :: gname, prefix, path
logical, allocatable, intent(inout) :: group_seen(:)
character(len=:), allocatable, intent(inout) :: errors(:)
integer, intent(inout) :: n_err
integer :: gidx
gidx = this%find_group(gname)
if (gidx > 0) then
if (group_seen(gidx)) then
call add_err(errors, n_err, prefix//"duplicate occurrence of group '"//gname//"'")
call skip_to_slash(lines, n_lines, li, col)
return
end if
group_seen(gidx) = .true.
this%groups(gidx)%found = .true.
call parse_group_body(this%groups(gidx), lines, n_lines, li, col, &
path, errors, n_err)
return
end if
if (this%is_external(gname)) then
call skip_to_slash(lines, n_lines, li, col)
return
end if
! Unknown group.
block
character(len=:), allocatable :: names(:)
character(len=:), allocatable :: sug
names = group_name_list(this)
sug = ""
if (size(names) > 0) sug = suggest(strip_nml(gname), names)
call add_err(errors, n_err, prefix//"unknown group '"//gname//"'"//sug)
end block
call skip_to_slash(lines, n_lines, li, col)
end subroutine dispatch_group