parse_file Subroutine

private subroutine parse_file(this, path, errors, n_err)

Read the namelist file at path, then drive the parse. The file is the only on-disk touch; the walk runs on the in-memory lines (shared with the from-buffer path, parse_from_lines).

Arguments

Type IntentOptional Attributes Name
type(nml_schema_t), intent(inout) :: this
character(len=*), intent(in) :: path
character(len=:), intent(inout), allocatable :: errors(:)
integer, intent(inout) :: n_err

Calls

proc~~parse_file~~CallsGraph proc~parse_file parse_file 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 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 proc~apply_one_pair->proc~add_err proc~apply_one_pair->proc~make_prefix proc~apply_one_pair->names proc~apply_one_pair->proc~suggest parse_tokens parse_tokens proc~apply_one_pair->parse_tokens proc~append_val append_val proc~apply_one_pair->proc~append_val proc~group_find_key nml_group_t%group_find_key proc~apply_one_pair->proc~group_find_key proc~group_key_list group_key_list proc~apply_one_pair->proc~group_key_list proc~collect_tokens->proc~add_err proc~collect_tokens->proc~make_prefix proc~collect_tokens->proc~strip_comment proc~check_unsupported check_unsupported proc~collect_tokens->proc~check_unsupported proc~push_tok push_tok proc~collect_tokens->proc~push_tok

Called by

proc~~parse_file~~CalledByGraph proc~parse_file parse_file proc~schema_parse nml_schema_t%schema_parse proc~schema_parse->proc~parse_file 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 :: lines(:)
integer, private :: n_lines
logical, private :: ok

Source Code

   subroutine parse_file(this, path, errors, n_err)
      !! Read the namelist file at `path`, then drive the parse.  The file
      !! is the only on-disk touch; the walk runs on the in-memory lines
      !! (shared with the from-buffer path, parse_from_lines).
      type(nml_schema_t), intent(inout) :: this
      character(len=*), intent(in) :: path
      character(len=:), allocatable, intent(inout) :: errors(:)
      integer, intent(inout) :: n_err

      character(len=:), allocatable :: lines(:)
      integer :: n_lines
      logical :: ok

      call read_lines(path, lines, n_lines, ok)
      if (.not. ok) then
         call add_err(errors, n_err, path//": cannot open file")
         return
      end if
      call parse_from_lines(this, lines, n_lines, path, errors, n_err)
   end subroutine parse_file