www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3415] New: JSON output does not pass validation

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3415

           Summary: JSON output does not pass validation
           Product: D
           Version: 1.050
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: brian-schott cox.net



Items in arrays output by the -X option of dmd are not properly separated by
commas. The most common example of this is class member functions.

Example:

...
"members" : [
{
"name" : "drawLayer",
"kind" : "function",
"type" : "void(uint layer, int x, int y)",
"line" : 133}
{
"name" : "drawAllLayers",
"kind" : "function",
"type" : "void(int x, int y)",
"line" : 149}
...

Should read:

...
"members" : [
{
"name" : "drawLayer",
"kind" : "function",
"type" : "void(uint layer, int x, int y)",
"line" : 133},
{
"name" : "drawAllLayers",
"kind" : "function",
"type" : "void(int x, int y)",
"line" : 149},
...

The lack of commas causes the resulting files to fail validation and attempts
at parsing. See: http://www.jsonlint.com/

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 17 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3415


Ary Borenszweig <ary esperanto.org.ar> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |echochamber gmail.com



PDT ---
*** Issue 3440 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 26 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3415


Rainer Schuetze <r.sagitario gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario gmx.de



PDT ---
This happens for declarations in an AttribDeclaration, where the code for
adding commas is missing. Here's the patch:

Index: json.c
===================================================================
--- json.c    (revision 432)
+++ json.c    (working copy)
   -214,11 +214,17   

     if (d)
     {
+        size_t offset = buf->offset;
         for (unsigned i = 0; i < d->dim; i++)
         {   Dsymbol *s = (Dsymbol *)d->data[i];
+            if (offset != buf->offset)
+            {   buf->writestring(",\n");
+                offset = buf->offset;
+            }
             //printf("AttribDeclaration::toJsonBuffer %s\n", s->toChars());
             s->toJsonBuffer(buf);
         }
+        JsonRemoveComma(buf);
     }
 }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 14 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3415


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED



Fixed DMD2.044

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 05 2010