Skip to content

Commit 609dc0c

Browse files
committed
Clarify array indexing usage in the comments. See #267.
Other minor commenting formatting changes.
1 parent da79a8f commit 609dc0c

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

src/json_value_module.F90

+20-15
Original file line numberDiff line numberDiff line change
@@ -4354,8 +4354,8 @@ end subroutine json_value_add_string_vec_val_ascii
43544354
!
43554355
!# History
43564356
! * JW : 1/4/2014 : Original routine removed.
4357-
! Now using n_children variable.
4358-
! Renamed from json_value_count.
4357+
! Now using `n_children` variable.
4358+
! Renamed from `json_value_count`.
43594359

43604360
function json_count(json,p) result(count)
43614361

@@ -4380,15 +4380,15 @@ end function json_count
43804380
! date: 10/16/2015
43814381
!
43824382
! Returns a pointer to the parent of a [[json_value]].
4383-
! If there is no parent, then a null() pointer is returned.
4383+
! If there is no parent, then a `null()` pointer is returned.
43844384

43854385
subroutine json_get_parent(json,p,parent)
43864386

43874387
implicit none
43884388

43894389
class(json_core),intent(inout) :: json
43904390
type(json_value),pointer,intent(in) :: p !! JSON object
4391-
type(json_value),pointer,intent(out) :: parent !! pointer to parent
4391+
type(json_value),pointer,intent(out) :: parent !! pointer to `parent`
43924392

43934393
if (associated(p)) then
43944394
parent => p%parent
@@ -4406,15 +4406,15 @@ end subroutine json_get_parent
44064406
! date: 10/31/2015
44074407
!
44084408
! Returns a pointer to the next of a [[json_value]].
4409-
! If there is no next, then a null() pointer is returned.
4409+
! If there is no next, then a `null()` pointer is returned.
44104410

44114411
subroutine json_get_next(json,p,next)
44124412

44134413
implicit none
44144414

44154415
class(json_core),intent(inout) :: json
44164416
type(json_value),pointer,intent(in) :: p !! JSON object
4417-
type(json_value),pointer,intent(out) :: next !! pointer to next
4417+
type(json_value),pointer,intent(out) :: next !! pointer to `next`
44184418

44194419
if (associated(p)) then
44204420
next => p%next
@@ -4432,15 +4432,15 @@ end subroutine json_get_next
44324432
! date: 10/31/2015
44334433
!
44344434
! Returns a pointer to the previous of a [[json_value]].
4435-
! If there is no previous, then a null() pointer is returned.
4435+
! If there is no previous, then a `null()` pointer is returned.
44364436

44374437
subroutine json_get_previous(json,p,previous)
44384438

44394439
implicit none
44404440

44414441
class(json_core),intent(inout) :: json
44424442
type(json_value),pointer,intent(in) :: p !! JSON object
4443-
type(json_value),pointer,intent(out) :: previous !! pointer to previous
4443+
type(json_value),pointer,intent(out) :: previous !! pointer to `previous`
44444444

44454445
if (associated(p)) then
44464446
previous => p%previous
@@ -4459,15 +4459,15 @@ end subroutine json_get_previous
44594459
!
44604460
! Returns a pointer to the tail of a [[json_value]]
44614461
! (the last child of an array of object).
4462-
! If there is no tail, then a null() pointer is returned.
4462+
! If there is no tail, then a `null()` pointer is returned.
44634463

44644464
subroutine json_get_tail(json,p,tail)
44654465

44664466
implicit none
44674467

44684468
class(json_core),intent(inout) :: json
44694469
type(json_value),pointer,intent(in) :: p !! JSON object
4470-
type(json_value),pointer,intent(out) :: tail !! pointer to tail
4470+
type(json_value),pointer,intent(out) :: tail !! pointer to `tail`
44714471

44724472
if (associated(p)) then
44734473
tail => p%tail
@@ -4491,6 +4491,8 @@ subroutine json_value_get_child_by_index(json, p, idx, child, found)
44914491
class(json_core),intent(inout) :: json
44924492
type(json_value),pointer,intent(in) :: p !! object or array JSON data
44934493
integer(IK),intent(in) :: idx !! index of the child
4494+
!! (this is a 1-based Fortran
4495+
!! style array index).
44944496
type(json_value),pointer :: child !! pointer to the child
44954497
logical(LK),intent(out),optional :: found !! true if the value was found
44964498
!! (if not present, an exception
@@ -4753,7 +4755,7 @@ end subroutine json_print_2
47534755
!
47544756
!# Notes
47554757
! * This is an internal routine called by the various wrapper routines.
4756-
! * The reason the str argument is non-optional is because of a
4758+
! * The reason the `str` argument is non-optional is because of a
47574759
! bug in v4.9 of the gfortran compiler.
47584760

47594761
recursive subroutine json_value_print(json,p,iunit,str,indent,&
@@ -5042,7 +5044,7 @@ end subroutine json_value_print
50425044
! It uses either of two methods:
50435045
!
50445046
! * The original JSON-Fortran defaults
5045-
! * RFC 6901
5047+
! * [RFC 6901](https://tools.ietf.org/html/rfc6901)
50465048

50475049
subroutine json_get_by_path(json, me, path, p, found)
50485050

@@ -5498,10 +5500,10 @@ end subroutine json_get_by_path_default
54985500
!
54995501
! Note that trailing whitespace significance and case sensitivity
55005502
! are user-specified. To fully conform to the RFC 6901 standard,
5501-
! should probably set:
5503+
! should probably set (via `initialize`):
55025504
!
5503-
! * trailing_spaces_significant = .true. [this is not the default setting]
5504-
! * case_sensitive_keys = .true. [this is the default setting]
5505+
! * `trailing_spaces_significant` = .true. [this is not the default setting]
5506+
! * `case_sensitive_keys` = .true. [this is the default setting]
55055507
!
55065508
!### Example
55075509
!
@@ -5521,6 +5523,9 @@ end subroutine json_get_by_path_default
55215523
!@note Not doing anything special about the `-` character to index an array.
55225524
! This is considered a normal error.
55235525
!
5526+
!@note Unlike in the default path mode, the array indices here are 0-based
5527+
! (in accordance with the RFC 6901 standard)
5528+
!
55245529
!@warning Not checking if the member that is referenced is unique.
55255530
! (according to the standard, evaluation of non-unique references
55265531
! should fail). Like [[json_get_by_path_default]], this one will just return

0 commit comments

Comments
 (0)