Fixed bug where a JSON string had to end with CRLF. But that's optional.
Reformatted code to Gobo standard.
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
indexing
|
||||
|
||||
description: "Objects that ..."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
|
||||
JSON_READER
|
||||
|
||||
create
|
||||
|
||||
make
|
||||
feature -- Access
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make (a_json: STRING) is
|
||||
--
|
||||
do
|
||||
@@ -17,20 +22,15 @@ feature -- Access
|
||||
index := 1
|
||||
end
|
||||
|
||||
|
||||
feature -- Commands
|
||||
|
||||
read: CHARACTER is
|
||||
--
|
||||
do
|
||||
if not representation.is_empty then
|
||||
Result := representation.item (index)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
actual:CHARACTER is
|
||||
--
|
||||
do
|
||||
Result:=representation.item (index)
|
||||
end
|
||||
|
||||
has_next: BOOLEAN is
|
||||
@@ -48,6 +48,7 @@ feature -- Access
|
||||
Result := True
|
||||
end
|
||||
end
|
||||
|
||||
next is
|
||||
--
|
||||
require
|
||||
@@ -86,12 +87,30 @@ feature -- Access
|
||||
end
|
||||
|
||||
|
||||
feature -- Access
|
||||
|
||||
|
||||
feature -- Implementation
|
||||
representation: STRING
|
||||
--linear representation of the original json string
|
||||
-- Serialized representation of the original JSON string
|
||||
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
actual: CHARACTER is
|
||||
-- Current character or '%U' if none
|
||||
do
|
||||
if index > representation.count then
|
||||
Result := '%U'
|
||||
else
|
||||
Result := representation.item (index)
|
||||
end
|
||||
end
|
||||
|
||||
index: INTEGER
|
||||
--actual index
|
||||
-- Actual index
|
||||
|
||||
|
||||
invariant
|
||||
|
||||
representation_not_void: representation /= Void
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user