@@ -8776,9 +8776,14 @@ subroutine annotate_invalid_json(json,iunit,str)
87768776 integer (IK),intent (in ) :: iunit ! ! file unit number
87778777 character (kind= CK,len=* ),intent (in ) :: str ! ! string with JSON data
87788778
8779- character (kind= CK,len= :),allocatable :: line, arrow_str
8780- character (kind= CK,len= 10 ) :: line_str, char_str
8781- integer (IK) :: i, i_nl_prev, i_nl
8779+ character (kind= CK,len= :),allocatable :: line ! ! line containing the error
8780+ character (kind= CK,len= :),allocatable :: arrow_str ! ! arrow string that points
8781+ ! ! to the current character
8782+ character (kind= CK,len= max_integer_str_len) :: line_str ! ! current line number string
8783+ character (kind= CK,len= max_integer_str_len) :: char_str ! ! current character count string
8784+ integer (IK) :: i ! ! line number counter
8785+ integer (IK) :: i_nl_prev ! ! index of previous newline character
8786+ integer (IK) :: i_nl ! ! index of current newline character
87828787
87838788 ! If there was an error reading the file, then
87848789 ! print the line where the error occurred:
@@ -8896,8 +8901,10 @@ subroutine get_current_line_from_file_stream(json,iunit,line)
88968901 integer (IK),intent (in ) :: iunit ! ! file unit number
88978902 character (kind= CK,len= :),allocatable ,intent (out ) :: line ! ! current line
88988903
8899- integer (IK) :: istart,iend,ios
8900- character (kind= CK,len= 1 ) :: c
8904+ integer (IK) :: istart ! ! start position of current line
8905+ integer (IK) :: iend ! ! end position of current line
8906+ integer (IK) :: ios ! ! file read `iostat` code
8907+ character (kind= CK,len= 1 ) :: c ! ! a character read from the file
89018908
89028909 istart = json% ipos
89038910 do
@@ -8934,11 +8941,13 @@ recursive subroutine parse_value(json, unit, str, value)
89348941
89358942 class(json_core),intent (inout ) :: json
89368943 integer (IK),intent (in ) :: unit ! ! file unit number
8937- character (kind= CK,len=* ),intent (in ) :: str ! ! string containing JSON data (only used if unit=0)
8944+ character (kind= CK,len=* ),intent (in ) :: str ! ! string containing JSON
8945+ ! ! data (only used if `unit=0`)
89388946 type (json_value),pointer :: value ! ! JSON data that is extracted
89398947
89408948 logical (LK) :: eof ! ! end-of-file flag
8941- character (kind= CK,len= 1 ) :: c ! ! character read from file (or string) by [[pop_char]]
8949+ character (kind= CK,len= 1 ) :: c ! ! character read from file
8950+ ! ! (or string) by [[pop_char]]
89428951#if defined __GFORTRAN__
89438952 character (kind= CK,len= :),allocatable :: tmp ! ! this is a work-around for a bug
89448953 ! ! in the gfortran 4.9 compiler.
@@ -10051,7 +10060,7 @@ end subroutine parse_number
1005110060! * [[push_char]]
1005210061!
1005310062! @note This routine ignores non-printing ASCII characters
10054- ! (iachar<=31) that are in strings.
10063+ ! (` iachar<=31` ) that are in strings.
1005510064
1005610065 recursive subroutine pop_char (json ,unit ,str ,skip_ws ,skip_comments ,eof ,popped )
1005710066
@@ -10061,7 +10070,7 @@ recursive subroutine pop_char(json,unit,str,skip_ws,skip_comments,eof,popped)
1006110070 integer (IK),intent (in ) :: unit ! ! file unit number (if parsing
1006210071 ! ! from a file)
1006310072 character (kind= CK,len=* ),intent (in ) :: str ! ! JSON string (if parsing from a
10064- ! ! string) -- only used if unit=0
10073+ ! ! string) -- only used if ` unit=0`
1006510074 logical (LK),intent (in ),optional :: skip_ws ! ! to ignore whitespace [default False]
1006610075 logical (LK),intent (in ),optional :: skip_comments ! ! to ignore comment lines [default False]
1006710076 logical (LK),intent (out ) :: eof ! ! true if the end of the file has
0 commit comments