Build script can't handle line or block comments in Inspector.json. /bin/sh -c \"./WebKitBuild/WebCore.build/Debug/Derived\ Sources.build/Script-DD041FBD09D9DDBE0010AF2A.sh\" python WebCore/inspector/CodeGeneratorInspector.py WebCore/inspector/Inspector.json --output_h_dir . --output_cpp_dir . --output_js_dir . Traceback (most recent call last): File "WebCore/inspector/CodeGeneratorInspector.py", line 1700, in <module> json_api = json.loads(json_string) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads return _default_decoder.decode(s) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded make: *** [InspectorFrontend.h] Error 1 Command /bin/sh failed with exit code 2
<rdar://problem/15456678>
I don't think comments are actually allowed in JSON.
I assume this is because you had added some comments to Inspector.json? JSON is solely about data, and comments aren't allowed: <http://www.ietf.org/rfc/rfc4627.txt> The error you're seeing actually comes from the Python json library failing to parse the input file. Python's json parser probably adheres to the JSON spec and comments would be invalid.
However, after all of that. We could strip comments before parsing, or just add a "comment" key/value pair. Already almost everything has a "description" property for adding comments / documentation.
The code generator could easily read in the file and drop lines starting with #, //, or /* before handing off to the JSON parser. This would be useful in the replay code generator too, so I'll tackle it.
Changing from P2 to P3. It would have been nice when I was learning how the Inspector interface worked, but it wasn’t for explanatory comments. It was so I could comment code blocks to achieve partial builds without deleting my whole JSON object definition. Now that I know how things are generated, this is less important for me, but it might help others who are learning how to contribute to the Web Inspector or any other use of JSON-in-files in WebKit.
I don't think it's worth making our JSON not proper JSON just to make it easy to comment out sections of it. You can easily just delete and selectively revert with git/svn. If you really just want to selectively disable certain commands/events/domains locally without deleting them, it would be trivial to add a fake Platform to the generator then set the 'platform' property to it. This would cause it to not match the generator's platform (mac or ios) and boilerplate for the command wouldn't be generated. If that is sufficient, I can retitle this and fix it quite quickly. If this is really about comment syntax, I think we should close this bug as NTBF.