@@ 117,6 117,7 @@ package body JSON.Parser is
Item : Holder;
Object : Data.JSON_Object_Type := Data.Create_Object;
+ Continuation : Boolean := False;
begin
if T.Token_Kind /= CURLY_PARENT_LEFT_TOKEN then
raise Parse_Error;
@@ 128,9 129,16 @@ package body JSON.Parser is
case T.Token_Kind is
when CURLY_PARENT_RIGHT_TOKEN =>
+
+ -- After comma, there must be some value
+ if Continuation then
+ raise Parse_Error;
+ end if;
+
exit Member_Loop;
when STRING_TOKEN =>
+ Continuation := False;
declare
Name : constant String := To_String (T.String_Value);
begin
@@ 143,7 151,8 @@ package body JSON.Parser is
when CURLY_PARENT_RIGHT_TOKEN =>
exit Member_Loop;
when COMMA_TOKEN =>
- null; -- Do nothing = continue loop
+ Continuation := True;
+ -- Continue looping and expect some data
when others =>
raise Parse_Error;
end case;