@@ -10985,60 +10985,53 @@ subroutine parse_number(json, unit, str, value)
10985
10985
! get the next character:
10986
10986
call json% pop_char(unit, str= str, eof= eof, skip_ws= .true. , popped= c)
10987
10987
10988
- if (eof) then
10989
- call json% throw_exception(' Error in parse_number:' // &
10990
- ' Unexpected end of file while parsing number.' )
10991
- return
10992
- else
10993
-
10994
- select case (c)
10995
- case (CK_' -' ,CK_' +' ) ! note: allowing a '+' as the first character here.
10988
+ select case (c)
10989
+ case (CK_' -' ,CK_' +' ) ! note: allowing a '+' as the first character here.
10996
10990
10997
- if (is_integer .and. (.not. first)) is_integer = .false.
10991
+ if (is_integer .and. (.not. first)) is_integer = .false.
10998
10992
10999
- ! add it to the string:
11000
- ! tmp = tmp // c !...original
11001
- if (ip> len (tmp)) tmp = tmp // blank_chunk
11002
- tmp(ip:ip) = c
11003
- ip = ip + 1
10993
+ ! add it to the string:
10994
+ ! tmp = tmp // c !...original
10995
+ if (ip> len (tmp)) tmp = tmp // blank_chunk
10996
+ tmp(ip:ip) = c
10997
+ ip = ip + 1
11004
10998
11005
- case (CK_' .' ,CK_' E' ,CK_' e' ) ! can be present in real numbers
10999
+ case (CK_' .' ,CK_' E' ,CK_' e' ) ! can be present in real numbers
11006
11000
11007
- if (is_integer) is_integer = .false.
11001
+ if (is_integer) is_integer = .false.
11008
11002
11009
- ! add it to the string:
11010
- ! tmp = tmp // c !...original
11011
- if (ip> len (tmp)) tmp = tmp // blank_chunk
11012
- tmp(ip:ip) = c
11013
- ip = ip + 1
11003
+ ! add it to the string:
11004
+ ! tmp = tmp // c !...original
11005
+ if (ip> len (tmp)) tmp = tmp // blank_chunk
11006
+ tmp(ip:ip) = c
11007
+ ip = ip + 1
11014
11008
11015
- case (CK_' 0' :CK_' 9' ) ! valid characters for numbers
11009
+ case (CK_' 0' :CK_' 9' ) ! valid characters for numbers
11016
11010
11017
- ! add it to the string:
11018
- ! tmp = tmp // c !...original
11019
- if (ip> len (tmp)) tmp = tmp // blank_chunk
11020
- tmp(ip:ip) = c
11021
- ip = ip + 1
11011
+ ! add it to the string:
11012
+ ! tmp = tmp // c !...original
11013
+ if (ip> len (tmp)) tmp = tmp // blank_chunk
11014
+ tmp(ip:ip) = c
11015
+ ip = ip + 1
11022
11016
11023
- case default
11017
+ case default
11024
11018
11025
- ! push back the last character read:
11026
- call json% push_char(c)
11019
+ ! push back the last character read:
11020
+ call json% push_char(c)
11027
11021
11028
- ! string to value:
11029
- if (is_integer) then
11030
- ival = json% string_to_int(tmp)
11031
- call json% to_integer(value,ival)
11032
- else
11033
- rval = json% string_to_dble(tmp)
11034
- call json% to_real(value,rval)
11035
- end if
11022
+ ! string to value:
11023
+ if (is_integer) then
11024
+ ival = json% string_to_int(tmp)
11025
+ call json% to_integer(value,ival)
11026
+ else
11027
+ rval = json% string_to_dble(tmp)
11028
+ call json% to_real(value,rval)
11029
+ end if
11036
11030
11037
- exit ! finished
11031
+ exit ! finished
11038
11032
11039
- end select
11033
+ end select
11040
11034
11041
- end if
11042
11035
if (first) first = .false.
11043
11036
11044
11037
end do
0 commit comments