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:
berend
2008-08-05 03:26:08 +00:00
parent 0bf10c633f
commit fa35ab07a0

View File

@@ -1,15 +1,20 @@
indexing indexing
description: "Objects that ..." description: "Objects that ..."
author: "" author: ""
date: "$Date$" date: "$Date$"
revision: "$Revision$" revision: "$Revision$"
class class
JSON_READER JSON_READER
create create
make make
feature -- Access
feature -- Initialization
make (a_json: STRING) is make (a_json: STRING) is
-- --
do do
@@ -17,20 +22,15 @@ feature -- Access
index := 1 index := 1
end end
feature -- Commands
read: CHARACTER is read: CHARACTER is
-- --
do do
if not representation.is_empty then if not representation.is_empty then
Result := representation.item (index) Result := representation.item (index)
end end
end
actual:CHARACTER is
--
do
Result:=representation.item (index)
end end
has_next: BOOLEAN is has_next: BOOLEAN is
@@ -48,6 +48,7 @@ feature -- Access
Result := True Result := True
end end
end end
next is next is
-- --
require require
@@ -86,12 +87,30 @@ feature -- Access
end end
feature -- Access
feature -- Implementation
representation: STRING 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 index: INTEGER
--actual index -- Actual index
invariant
representation_not_void: representation /= Void
end end