When I develop I use VSC as the editor.
VSC allows for multiple panels with different files to be open.
In the left panel is the DCG for creating JSON files.
In the right panel is the JSON file that is invalid, missing double quotes around the element names. The JSON is also displayed with each error, so there is lots of red in that panel.
As each name is updated with the double quotes in the DCG, the data in the JSON file is automatically fixed and the red is removed. I did not run any Prolog to do the update. I even closed down all instances of SWI-Prolog.
The odd thing is I don’t know what I did to configure VSC and Prolog to do this. The only thing I can think of is it is due to the active extensions which at present are:
Code Spell Checker
Prettify JSON
VSC-Prolog
Also the code has a initialization/1 directive that will create the JSON file when the code is loaded.
Anyone else seen this behavior. It is most welcome but I would like to be able to reproduce it again as it saves me rerunning the modified code each time.
After adding \"
This also has another unexpected side effect.
If you edit the generated file by hand you may get a error warning you that the two files are out of sync.
I don’t know the exact details of how to reproduce this error.
The fix is to close down the file being edited by hand and delete it, then modify the DCG as necessary.