end if;
end NL_And_Indent;
+ -----------------------------
+ -- Write_Boolean_Attribute --
+ -----------------------------
+
+ procedure Write_Boolean_Attribute (Name : String; Value : Boolean) is
+
+ begin
+ Write_Str ("""" & Name & """" & ": ");
+ Write_Str (if Value then "true" else "false");
+ end Write_Boolean_Attribute;
+
-------------------------
-- Write_Int_Attribute --
-------------------------
procedure NL_And_Indent;
-- Print a new line
+ procedure Write_Boolean_Attribute (Name : String; Value : Boolean);
+ -- Write a JSON attribute with a boolean value.
+ --
+ -- The value is either 'true' or 'false' without any quotes
+
procedure Write_Int_Attribute (Name : String; Value : Int);
procedure Write_JSON_Escaped_String (Str : String);
-- we choose to use the UTF-8 representation instead.
procedure Write_String_Attribute (Name : String; Value : String);
- -- Write a JSON attribute with a string value
+ -- Write a JSON attribute with a string value.
+ --
+ -- The Value is surrounded by double quotes ("") and the special characters
+ -- within the string are escaped.
end Diagnostics.JSON_Utils;
-- Print executionSuccessful
- Write_String_Attribute
- ("executionSuccessful",
- (if Compilation_Errors then "false" else "true"));
+ Write_Boolean_Attribute ("executionSuccessful", Compilation_Errors);
End_Block;
NL_And_Indent;