schema_parse Subroutine

private subroutine schema_parse(this, path, status, errors)

Parse and validate the namelist file at path.

Error-return convention: if BOTH status and errors are present, collected messages return in errors (unallocated when none) and status = error count (0 = clean), no stop. If either is absent and any error occurs, each is logged via global_logger%error and the routine error stops.

Type Bound

nml_schema_t

Arguments

Type IntentOptional Attributes Name
class(nml_schema_t), intent(inout) :: this
character(len=*), intent(in) :: path
integer, intent(out), optional :: status
character(len=:), intent(out), optional, allocatable :: errors(:)

Calls

proc~~schema_parse~~CallsGraph proc~schema_parse nml_schema_t%schema_parse proc~parse_file parse_file proc~schema_parse->proc~parse_file proc~post_parse_validate post_parse_validate proc~schema_parse->proc~post_parse_validate proc~reset_state reset_state proc~schema_parse->proc~reset_state proc~add_err add_err proc~parse_file->proc~add_err proc~parse_from_lines parse_from_lines proc~parse_file->proc~parse_from_lines proc~read_lines read_lines proc~parse_file->proc~read_lines error error proc~post_parse_validate->error proc~post_parse_validate->proc~add_err proc~error_ring_push error_ring_push proc~post_parse_validate->proc~error_ring_push proc~parse_from_lines->proc~add_err proc~dispatch_group dispatch_group proc~parse_from_lines->proc~dispatch_group proc~make_prefix make_prefix proc~parse_from_lines->proc~make_prefix proc~next_amp next_amp proc~parse_from_lines->proc~next_amp proc~read_group_name read_group_name proc~parse_from_lines->proc~read_group_name proc~skip_to_slash skip_to_slash proc~parse_from_lines->proc~skip_to_slash proc~dispatch_group->proc~add_err proc~dispatch_group->proc~skip_to_slash names names proc~dispatch_group->names proc~group_name_list group_name_list proc~dispatch_group->proc~group_name_list proc~parse_group_body parse_group_body proc~dispatch_group->proc~parse_group_body proc~schema_find_group nml_schema_t%schema_find_group proc~dispatch_group->proc~schema_find_group proc~schema_is_external nml_schema_t%schema_is_external proc~dispatch_group->proc~schema_is_external proc~strip_nml strip_nml proc~dispatch_group->proc~strip_nml proc~suggest suggest proc~dispatch_group->proc~suggest proc~fmt_int fmt_int proc~make_prefix->proc~fmt_int proc~strip_comment strip_comment proc~next_amp->proc~strip_comment proc~is_ident_char is_ident_char proc~read_group_name->proc~is_ident_char proc~read_group_name->proc~strip_comment proc~skip_to_slash->proc~strip_comment proc~apply_one_pair apply_one_pair proc~parse_group_body->proc~apply_one_pair proc~collect_tokens collect_tokens proc~parse_group_body->proc~collect_tokens proc~schema_find_group->proc~strip_nml proc~lower lower proc~schema_find_group->proc~lower proc~schema_is_external->proc~strip_nml proc~schema_is_external->proc~lower proc~strip_nml->proc~lower proc~levenshtein levenshtein proc~suggest->proc~levenshtein proc~suggest->proc~lower

Called by

proc~~schema_parse~~CalledByGraph proc~schema_parse nml_schema_t%schema_parse proc~read_config_impl read_config_impl proc~read_config_impl->proc~schema_parse proc~read_config read_config proc~read_config->proc~read_config_impl

Variables

Type Visibility Attributes Name Initial
character(len=:), private, allocatable :: err_buf(:)
integer, private :: n_err

Source Code

   subroutine schema_parse(this, path, status, errors)
      !! Parse and validate the namelist file at `path`.
      !!
      !! Error-return convention: if BOTH `status` and `errors` are present,
      !! collected messages return in `errors` (unallocated when none) and
      !! `status` = error count (0 = clean), no stop. If either is absent and
      !! any error occurs, each is logged via `global_logger%error` and the
      !! routine `error stop`s.
      class(nml_schema_t), intent(inout) :: this
      character(len=*), intent(in) :: path
      integer, intent(out), optional :: status
      character(len=:), allocatable, intent(out), optional :: errors(:)

      character(len=:), allocatable :: err_buf(:)
      integer :: n_err

      n_err = 0
      call reset_state(this)
      call parse_file(this, path, err_buf, n_err)
      call post_parse_validate(this, path, err_buf, n_err, status, errors)
   end subroutine schema_parse