Update parse_number
This commit is contained in:
@@ -47,8 +47,7 @@ feature -- Access
|
|||||||
Result:=parse_string
|
Result:=parse_string
|
||||||
elseif c.is_equal (j_array_open) then
|
elseif c.is_equal (j_array_open) then
|
||||||
Result:=parse_array
|
Result:=parse_array
|
||||||
elseif c.is_digit or c.is_equal (j_minus) or
|
elseif c.is_digit or c.is_equal (j_minus) then
|
||||||
c.is_equal (j_plus) or c.is_equal (j_dot) then
|
|
||||||
Result:=parse_number
|
Result:=parse_number
|
||||||
elseif is_null then
|
elseif is_null then
|
||||||
--
|
--
|
||||||
@@ -213,10 +212,17 @@ feature -- Access
|
|||||||
local
|
local
|
||||||
sb:STRING
|
sb:STRING
|
||||||
flag:BOOLEAN
|
flag:BOOLEAN
|
||||||
|
zero_flag:BOOLEAN
|
||||||
|
minus_flag:BOOLEAN
|
||||||
|
dot_flag:BOOLEAN
|
||||||
do
|
do
|
||||||
create sb.make_empty
|
create sb.make_empty
|
||||||
if not actual.is_equal (j_plus) then
|
|
||||||
sb.append (actual.out)
|
sb.append (actual.out)
|
||||||
|
|
||||||
|
if actual.is_equal ('0') then
|
||||||
|
zero_flag:=true
|
||||||
|
elseif actual.is_equal (j_minus) then
|
||||||
|
minus_flag:=True
|
||||||
end
|
end
|
||||||
|
|
||||||
from
|
from
|
||||||
@@ -224,7 +230,21 @@ feature -- Access
|
|||||||
until not flag
|
until not flag
|
||||||
loop
|
loop
|
||||||
next
|
next
|
||||||
if not has_next or close_tokens.has (actual) or actual.is_equal (',')
|
if zero_flag then
|
||||||
|
inspect
|
||||||
|
actual
|
||||||
|
when '1'..'9' then
|
||||||
|
sb.append (actual.out)
|
||||||
|
when '.' then
|
||||||
|
zero_flag:=false
|
||||||
|
dot_flag:=true
|
||||||
|
sb.append (actual.out)
|
||||||
|
else
|
||||||
|
flag:=false
|
||||||
|
is_parsed:=false
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif not has_next or close_tokens.has (actual) or actual.is_equal (',')
|
||||||
or actual.is_equal ('%N') or actual.is_equal ('%R') then
|
or actual.is_equal ('%N') or actual.is_equal ('%R') then
|
||||||
flag:=false
|
flag:=false
|
||||||
previous
|
previous
|
||||||
|
|||||||
Reference in New Issue
Block a user