DDT-IDE / DDT

DDT is an Eclipse-based IDE for the D programming language:
http://ddt-ide.github.io/
101 stars 16 forks source link

DDT json parser exception on dub.json with trailing commas #134

Closed vadim-goryunov closed 8 years ago

vadim-goryunov commented 8 years ago

vibe.d dub.json file uses comma at the end of arrays (which is legal JSON): example:

"configurations": [
                {
                    "name": "libevent",
                    "dependencies": {"libevent": "~>2.0.1+2.0.16"},
                    "versions": ["VibeLibeventDriver"],
                    "sourceFiles-windows-x86": ["lib/win-i386/event2.lib"],
                    "copyFiles-windows-x86": ["lib/win-i386/libevent.dll"],
                    "sourceFiles-windows-x86_64": ["lib/win-amd64/event2.lib"],
                    "copyFiles-windows-x86_64": ["lib/win-amd64/libevent.dll"],
                    "libs-windows": ["wsock32", "ws2_32", "advapi32"] >>>,<<<
                },

but DDT json parser does not like it:

image

When I remove all trailing commas in arrays (or associative arrays), DDT accepts the dub.json and completes the parsing.

bruno-medeiros commented 8 years ago

Actually a comma at the end of array or object entries is not valid JSON. That's why DDT has that error. DUB's JSON parser is more lenient and accepts that syntax, but it's still not valid JSON. Unfortunately the parser used in DDT doesn't support this, but I think I can find a way to workaround this. (it is indeed handy to have the comma at the end)