Parses a line by finding the label-value pair and storing it as a new entry.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(parser_obj), | intent(inout) | :: | this |
Parser object |
||
| character(len=MAX_LINE_SIZE), | intent(inout) | :: | line |
A line from the input file |
pure subroutine parser_obj_ParseLine(this,line) !> Parses a line by finding the label-value pair and storing it as a new ! entry. implicit none class(parser_obj), intent(inout) :: this !! Parser object character(MAX_LINE_SIZE), intent(inout) :: line !! A line from the input file ! Work variables character(MAX_LABEL_SIZE) :: label !! A label character(MAX_LINE_SIZE) :: value !! A value integer :: separator_index !! Left most position of the separator integer :: entry_id type(entry_obj) :: new_entry ! Remove tabs and comments call parser_obj_ReformatLine(line) ! Get position of separator (normally ":") separator_index = index(line,SEPARATOR) ! If found a separator, create a new entry if (separator_index.ne.0) then read(line(1:separator_index-1),'(a)') label read(line(separator_index+1:), '(a)') value if (len_trim(value).ne.0) then entry_id=this%FetchLabelID(label) if (entry_id.ne.0) then this%entries(entry_id)%value=trim(adjustl(value)) else ! Add a new entry new_entry%label=trim(adjustl(label)) new_entry%value=trim(adjustl(value)) call this%AddEntry(new_entry) end if end if end if return end subroutine parser_obj_ParseLine