strip_comment Function

public pure function strip_comment(line) result(stripped)

Remove comments (! or #) from a line and trim result

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line

Return Value character(len=:), allocatable


Called by

proc~~strip_comment~~CalledByGraph proc~strip_comment strip_comment proc~parse_aimd_section parse_aimd_section proc~parse_aimd_section->proc~strip_comment proc~parse_connectivity_generic parse_connectivity_generic proc~parse_connectivity_generic->proc~strip_comment proc~skip_to_end skip_to_end proc~parse_connectivity_generic->proc~skip_to_end proc~parse_driver_section parse_driver_section proc~parse_driver_section->proc~strip_comment proc~parse_fragment parse_fragment proc~parse_fragment->proc~strip_comment proc~parse_fragmentation_section parse_fragmentation_section proc~parse_fragmentation_section->proc~strip_comment proc~parse_fragments_generic parse_fragments_generic proc~parse_fragments_generic->proc~strip_comment proc~parse_fragments_generic->proc~parse_fragment proc~parse_fragments_generic->proc~skip_to_end proc~parse_geometry_generic parse_geometry_generic proc~parse_geometry_generic->proc~strip_comment proc~parse_hessian_section parse_hessian_section proc~parse_hessian_section->proc~strip_comment proc~parse_model_section parse_model_section proc~parse_model_section->proc~strip_comment proc~parse_molecules_section parse_molecules_section proc~parse_molecules_section->proc~strip_comment proc~parse_single_molecule parse_single_molecule proc~parse_molecules_section->proc~parse_single_molecule proc~parse_molecules_section->proc~skip_to_end proc~parse_scf_section parse_scf_section proc~parse_scf_section->proc~strip_comment proc~parse_schema_section parse_schema_section proc~parse_schema_section->proc~strip_comment proc~parse_single_molecule->proc~strip_comment proc~parse_single_molecule->proc~skip_to_end proc~parse_molecule_connectivity parse_molecule_connectivity proc~parse_single_molecule->proc~parse_molecule_connectivity proc~parse_molecule_fragments parse_molecule_fragments proc~parse_single_molecule->proc~parse_molecule_fragments proc~parse_molecule_geometry parse_molecule_geometry proc~parse_single_molecule->proc~parse_molecule_geometry proc~parse_molecule_structure parse_molecule_structure proc~parse_single_molecule->proc~parse_molecule_structure proc~parse_structure_generic parse_structure_generic proc~parse_structure_generic->proc~strip_comment proc~parse_system_section parse_system_section proc~parse_system_section->proc~strip_comment proc~parse_xtb_section parse_xtb_section proc~parse_xtb_section->proc~strip_comment proc~skip_to_end->proc~strip_comment interface~parse_aimd_section parse_aimd_section interface~parse_aimd_section->proc~parse_aimd_section interface~parse_connectivity_generic parse_connectivity_generic interface~parse_connectivity_generic->proc~parse_connectivity_generic interface~parse_driver_section parse_driver_section interface~parse_driver_section->proc~parse_driver_section interface~parse_fragmentation_section parse_fragmentation_section interface~parse_fragmentation_section->proc~parse_fragmentation_section interface~parse_fragments_generic parse_fragments_generic interface~parse_fragments_generic->proc~parse_fragments_generic interface~parse_geometry_generic parse_geometry_generic interface~parse_geometry_generic->proc~parse_geometry_generic interface~parse_hessian_section parse_hessian_section interface~parse_hessian_section->proc~parse_hessian_section interface~parse_model_section parse_model_section interface~parse_model_section->proc~parse_model_section interface~parse_molecules_section parse_molecules_section interface~parse_molecules_section->proc~parse_molecules_section interface~parse_scf_section parse_scf_section interface~parse_scf_section->proc~parse_scf_section interface~parse_schema_section parse_schema_section interface~parse_schema_section->proc~parse_schema_section interface~parse_structure_generic parse_structure_generic interface~parse_structure_generic->proc~parse_structure_generic interface~parse_system_section parse_system_section interface~parse_system_section->proc~parse_system_section interface~parse_xtb_section parse_xtb_section interface~parse_xtb_section->proc~parse_xtb_section proc~read_mqc_file read_mqc_file proc~read_mqc_file->proc~skip_to_end proc~read_mqc_file->interface~parse_aimd_section proc~read_mqc_file->interface~parse_driver_section proc~read_mqc_file->interface~parse_fragmentation_section proc~read_mqc_file->interface~parse_hessian_section proc~read_mqc_file->interface~parse_model_section proc~read_mqc_file->interface~parse_molecules_section proc~read_mqc_file->interface~parse_scf_section proc~read_mqc_file->interface~parse_schema_section proc~read_mqc_file->interface~parse_system_section proc~read_mqc_file->interface~parse_xtb_section interface~parse_connectivity_section parse_connectivity_section proc~read_mqc_file->interface~parse_connectivity_section interface~parse_fragments_section parse_fragments_section proc~read_mqc_file->interface~parse_fragments_section interface~parse_geometry_section parse_geometry_section proc~read_mqc_file->interface~parse_geometry_section interface~parse_structure_section parse_structure_section proc~read_mqc_file->interface~parse_structure_section proc~parse_connectivity_section parse_connectivity_section proc~parse_connectivity_section->interface~parse_connectivity_generic proc~parse_fragments_section parse_fragments_section proc~parse_fragments_section->interface~parse_fragments_generic proc~parse_geometry_section parse_geometry_section proc~parse_geometry_section->interface~parse_geometry_generic proc~parse_molecule_connectivity->interface~parse_connectivity_generic proc~parse_molecule_fragments->interface~parse_fragments_generic proc~parse_molecule_geometry->interface~parse_geometry_generic proc~parse_molecule_structure->interface~parse_structure_generic proc~parse_structure_section parse_structure_section proc~parse_structure_section->interface~parse_structure_generic program~main main program~main->proc~read_mqc_file interface~parse_connectivity_section->proc~parse_connectivity_section interface~parse_fragments_section->proc~parse_fragments_section interface~parse_geometry_section->proc~parse_geometry_section interface~parse_structure_section->proc~parse_structure_section

Variables

Type Visibility Attributes Name Initial
integer, private :: comment_pos

Source Code

   pure function strip_comment(line) result(stripped)
      !! Remove comments (! or #) from a line and trim result
      character(len=*), intent(in) :: line
      character(len=:), allocatable :: stripped
      integer :: comment_pos

      ! Find first occurrence of ! or #
      comment_pos = index(line, '!')
      if (comment_pos == 0) comment_pos = index(line, '#')

      if (comment_pos > 0) then
         ! Comment found - take everything before it
         stripped = trim(adjustl(line(1:comment_pos - 1)))
      else
         ! No comment - use full line
         stripped = trim(adjustl(line))
      end if
   end function strip_comment