read_group_name Subroutine

private subroutine read_group_name(lines, n_lines, li, col, gname)

Read an identifier starting at (li,col); advance past it.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: lines(:)
integer, intent(in) :: n_lines
integer, intent(inout) :: li
integer, intent(inout) :: col
character(len=:), intent(out), allocatable :: gname

Calls

proc~~read_group_name~~CallsGraph proc~read_group_name read_group_name proc~is_ident_char is_ident_char proc~read_group_name->proc~is_ident_char proc~strip_comment strip_comment proc~read_group_name->proc~strip_comment

Called by

proc~~read_group_name~~CalledByGraph proc~read_group_name read_group_name proc~parse_from_lines parse_from_lines proc~parse_from_lines->proc~read_group_name proc~parse_file parse_file proc~parse_file->proc~parse_from_lines proc~schema_parse_lines nml_schema_t%schema_parse_lines proc~schema_parse_lines->proc~parse_from_lines proc~read_config_from_string_impl read_config_from_string_impl proc~read_config_from_string_impl->proc~schema_parse_lines proc~schema_parse nml_schema_t%schema_parse proc~schema_parse->proc~parse_file proc~read_config_from_string read_config_from_string proc~read_config_from_string->proc~read_config_from_string_impl proc~read_config_impl read_config_impl proc~read_config_impl->proc~schema_parse proc~build_pending_handle build_pending_handle proc~build_pending_handle->proc~read_config_from_string proc~read_config read_config proc~read_config->proc~read_config_impl

Variables

Type Visibility Attributes Name Initial
integer, private :: i
character(len=:), private, allocatable :: s
integer, private :: start

Source Code

   subroutine read_group_name(lines, n_lines, li, col, gname)
      !! Read an identifier starting at (li,col); advance past it.
      character(len=*), intent(in) :: lines(:)
      integer, intent(in) :: n_lines
      integer, intent(inout) :: li, col
      character(len=:), allocatable, intent(out) :: gname
      character(len=:), allocatable :: s
      integer :: i, start

      gname = ""
      if (li > n_lines) return
      s = strip_comment(lines(li))
      ! Skip leading blanks.
      do while (col <= len(s))
         if (s(col:col) /= " " .and. s(col:col) /= achar(9)) exit
         col = col + 1
      end do
      start = col
      do i = col, len(s)
         if (is_ident_char(s(i:i))) then
            col = i + 1
         else
            exit
         end if
      end do
      if (col > start) gname = s(start:col - 1)
   end subroutine read_group_name