lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Jonathan Goble once stated:
> On Thu, Jul 20, 2017 at 12:43 AM Sean Conner <sean@conman.org> wrote:
> 
> > It was thus said that the Great Sean Conner once stated:
> > >
> > >   I've just released version 1.0.6 of org.conman.parsers.jsons, which
> > > fixes a bug found by Dirk Laurie related to feeding data into the parser.
> > > This now works:
> > >
> > >         json = require "org.conman.parsers.jsons"
> > >         file = io.open("large-json-file.json","r")
> > >         data = json:match(function() return file:read(1024) end)
> >
> > No it doesn't.
> >
> 
> I notice that you have no tests in your repository. Instead of continually
> releasing new versions that allegedly fix the issue but actually don't, may
> I suggest stopping work on that, writing a test suite, and then work on the
> bug without releasing anything until the test suite passes?

  Point taken.  I grabbed the test files from

	https://github.com/nst/JSONTestSuite

and ran my code [1] over all the test cases there.  Flushed out a bunch of
errors with the 300+ test cases (that were used to probe corner cases in the
JSON spec [2].  I have not checked in the test cases as they exist
elsewhere, but the following are the only deviations [3]:

    c n n t t t n_structure_100000_opening_arrays.json
    c n n t t t n_structure_open_array_object.json
    n n n t t t y_string_space.json
    n n n t t t y_string_unescaped_char_delete.json
    n n n t t t y_string_with_del_character.json
    n n n t t t y_structure_lonely_false.json
    n n n t t t y_structure_lonely_int.json
    n n n t t t y_structure_lonely_negative_real.json
    n n n t t t y_structure_lonely_null.json
    n n n t t t y_structure_lonely_string.json
    n n n t t t y_structure_lonely_true.json
    n n n t t t y_structure_string_empty.json
    | | | | | | |
    | | | | | | +- filename of testcase
    | | | | | +--- r3 == r1
    | | | | +----- r2 == r3
    | | | +------- r1 == r2
    | | +--------- org.conman.parsers.jsons (r3) (byte-by-byte)
    | +----------- org.conman.parsers.jsons (r2) (string)
    +------------- org.conman.parsers.json  (r1) (string)
    
            y = data parsed
            n = data didn't parse
            c = program crashed
            t = comparison suceeeded
            f = comparison failed

  You can see two cases where org.conman.parsers.json can't handle the test
case and crashed (stack exceeded), but the new code did.  And the other
cases are applicable to RFC-7159, which my code does *NOT* support---it
supports the language described on the main page of <http://json.org/>.

  So yes!  Version 1.0.7 of org.conman.parsers.jsons released!  Should be
the last release for a long time.

  -spc

[1]	I tested my original JSON parser, my new JSONs (streaming) module as
	a drop-in replacement, and the JSONs module feeding it a byte at a
	time.

[2]	http://seriot.ch/parsing_json.php

[3]	Minus the "implementation defined" tests.