@@ -721,30 +721,31 @@ module json_value_module
721
721
! ! children for duplicate keys
722
722
723
723
! other private routines:
724
- procedure :: name_equal
725
- procedure :: name_strings_equal
726
- procedure :: json_value_print
727
- procedure :: string_to_int
728
- procedure :: string_to_dble
729
- procedure :: parse_value
730
- procedure :: parse_number
731
- procedure :: parse_string
732
- procedure :: parse_for_chars
733
- procedure :: parse_object
734
- procedure :: parse_array
735
- procedure :: annotate_invalid_json
736
- procedure :: pop_char
737
- procedure :: push_char
738
- procedure :: get_current_line_from_file_stream
739
- procedure :: get_current_line_from_file_sequential
740
- procedure :: convert
741
- procedure :: to_string
742
- procedure :: to_logical
743
- procedure :: to_integer
744
- procedure :: to_double
745
- procedure :: to_null
746
- procedure :: to_object
747
- procedure :: to_array
724
+ procedure :: name_equal
725
+ procedure :: name_strings_equal
726
+ procedure :: json_value_print
727
+ procedure :: string_to_int
728
+ procedure :: string_to_dble
729
+ procedure :: parse_value
730
+ procedure :: parse_number
731
+ procedure :: parse_string
732
+ procedure :: parse_for_chars
733
+ procedure :: parse_object
734
+ procedure :: parse_array
735
+ procedure :: annotate_invalid_json
736
+ procedure :: pop_char
737
+ procedure :: push_char
738
+ procedure :: get_current_line_from_file_stream
739
+ procedure ,nopass :: get_current_line_from_file_sequential
740
+ procedure :: convert
741
+ procedure :: to_string
742
+ procedure :: to_logical
743
+ procedure :: to_integer
744
+ procedure :: to_double
745
+ procedure :: to_null
746
+ procedure :: to_object
747
+ procedure :: to_array
748
+ procedure ,nopass :: json_value_clone_func
748
749
749
750
end type json_core
750
751
! *********************************************************
@@ -1143,8 +1144,7 @@ subroutine json_clone(json,from,to)
1143
1144
! ! (it must not already be associated)
1144
1145
1145
1146
! call the main function:
1146
- ! [note: this is not part of json_core class]
1147
- call json_value_clone_func(from,to )
1147
+ call json% json_value_clone_func(from,to )
1148
1148
1149
1149
end subroutine json_clone
1150
1150
! *****************************************************************************************
@@ -2052,9 +2052,10 @@ recursive subroutine json_value_destroy(json,p,destroy_next)
2052
2052
logical (LK),intent (in ),optional :: destroy_next ! ! if true, then `p%next`
2053
2053
! ! is also destroyed (default is true)
2054
2054
2055
- logical (LK) :: des_next ! ! local copy of `destroy_next` optional argument
2056
- type (json_value), pointer :: child ! ! for getting child elements
2057
- logical :: circular ! ! to check to malformed linked lists
2055
+ logical (LK) :: des_next ! ! local copy of `destroy_next`
2056
+ ! ! optional argument
2057
+ type (json_value),pointer :: child ! ! for getting child elements
2058
+ logical :: circular ! ! to check to malformed linked lists
2058
2059
2059
2060
if (associated (p)) then
2060
2061
@@ -2097,9 +2098,9 @@ recursive subroutine json_value_destroy(json,p,destroy_next)
2097
2098
2098
2099
if (associated (p% next) .and. des_next) call json% destroy(p% next)
2099
2100
2100
- if ( associated (p % previous)) nullify(p% previous)
2101
- if ( associated (p % parent)) nullify(p% parent)
2102
- if ( associated (p % tail)) nullify(p% tail)
2101
+ nullify(p% previous)
2102
+ nullify(p% parent)
2103
+ nullify(p% tail)
2103
2104
2104
2105
if (associated (p)) deallocate (p)
2105
2106
nullify(p)
@@ -2154,8 +2155,10 @@ subroutine json_value_remove(json,p,destroy)
2154
2155
! ! * If `destroy` is present and true, it is destroyed.
2155
2156
! ! * If `destroy` is present and false, it is not destroyed.
2156
2157
2157
- type (json_value),pointer :: parent,previous,next
2158
- logical (LK) :: destroy_it
2158
+ type (json_value),pointer :: parent ! ! pointer to parent
2159
+ type (json_value),pointer :: previous ! ! pointer to previous
2160
+ type (json_value),pointer :: next ! ! pointer to next
2161
+ logical (LK) :: destroy_it ! ! if `p` should be destroyed
2159
2162
2160
2163
if (associated (p)) then
2161
2164
@@ -2324,11 +2327,16 @@ subroutine json_value_swap(json,p1,p2)
2324
2327
implicit none
2325
2328
2326
2329
class(json_core),intent (inout ) :: json
2327
- type (json_value),pointer :: p1
2328
- type (json_value),pointer :: p2
2330
+ type (json_value),pointer :: p1 ! ! swap with `p2`
2331
+ type (json_value),pointer :: p2 ! ! swap with `p1`
2329
2332
2330
- logical :: same_parent,first_last,adjacent
2331
- type (json_value),pointer :: a,b
2333
+ logical :: same_parent ! ! if `p1` and `p2` have the same parent
2334
+ logical :: first_last ! ! if `p1` and `p2` are the first,last or
2335
+ ! ! last,first children of a common parent
2336
+ logical :: adjacent ! ! if `p1` and `p2` are adjacent
2337
+ ! ! elements in an array
2338
+ type (json_value),pointer :: a ! ! temporary variable
2339
+ type (json_value),pointer :: b ! ! temporary variable
2332
2340
2333
2341
if (json% exception_thrown) return
2334
2342
@@ -2349,8 +2357,6 @@ subroutine json_value_swap(json,p1,p2)
2349
2357
associated (p2% parent) .and. &
2350
2358
associated (p1% parent,p2% parent) )
2351
2359
if (same_parent) then
2352
- ! if p1,p2 are the first,last or last,first
2353
- ! children of a common parent
2354
2360
first_last = (associated (p1% parent% children,p1) .and. &
2355
2361
associated (p2% parent% tail,p2)) .or. &
2356
2362
(associated (p1% parent% tail,p1) .and. &
@@ -8931,11 +8937,10 @@ end subroutine annotate_invalid_json
8931
8937
! The file is assumed to be opened.
8932
8938
! This is the SEQUENTIAL version (see also [[get_current_line_from_file_stream]]).
8933
8939
8934
- subroutine get_current_line_from_file_sequential (json , iunit ,line )
8940
+ subroutine get_current_line_from_file_sequential (iunit ,line )
8935
8941
8936
8942
implicit none
8937
8943
8938
- class(json_core),intent (inout ) :: json
8939
8944
integer (IK),intent (in ) :: iunit ! ! file unit number
8940
8945
character (kind= CK,len= :),allocatable ,intent (out ) :: line ! ! current line
8941
8946
0 commit comments