parse_value Subroutine

private elemental subroutine parse_value(self, sep, source, error)

Parse option value from a source string.

Arguments

TypeIntentOptionalAttributesName
class(option), intent(inout) :: self

Option data.

character, intent(in) :: sep

Separator of option name/value.

type(string), intent(in) :: source

String containing option data.

integer(kind=I4P), intent(out) :: error

Error code.


Contents

Source Code


Source Code

  elemental subroutine parse_value(self, sep, source, error)
  !< Parse option value from a source string.
  class(option), intent(inout) :: self   !< Option data.
  character(*),  intent(in)    :: sep    !< Separator of option name/value.
  type(string),  intent(in)    :: source !< String containing option data.
  integer(I4P),  intent(out)   :: error  !< Error code.
  integer(I4P)                 :: pos    !< Characters counter.

  error = ERR_OPTION_VALS
  pos = index(source, sep)
  if (pos > 0) then
    if (pos<source%len()) self%ovals = trim(adjustl(source%slice(pos+1, source%len())))
    error = 0
  endif
  endsubroutine parse_value