bjouhier / i-json

Fast incremental JSON parser
38 stars 5 forks source link

Two different files, two different parse errors. #3

Closed dignifiedquire closed 10 years ago

dignifiedquire commented 10 years ago

I was trying out this module and got two json files that can not be parsed.

The first npm.json, taken from https://github.com/dscape/clarinet/blob/master/samples/npm.json fails with

/Users/dignifiedquire/work/codio/experiments/json/node_modules/i-json/index.js:6
        if (typeof arg == "string") return this._update(new Buffer(arg, 'utf8'));
                                                ^
Error: line 1: syntax error near b\b@gmail.com"
    at Parser.nat.Parser.update (/Users/dignifiedquire/work/codio/experiments/json/node_modules/i-json/index.js:6:43)
    at /Users/dignifiedquire/work/codio/experiments/json/async.js:20:39
    at Array.map (native)
    at Object.exports.parse (/Users/dignifiedquire/work/codio/experiments/json/async.js:19:30)
    at /Users/dignifiedquire/work/codio/experiments/json/naive.js:34:10
    at time (/Users/dignifiedquire/work/codio/experiments/json/naive.js:21:5)
    at Object.<anonymous> (/Users/dignifiedquire/work/codio/experiments/json/naive.js:33:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

The second one clang.ops.json (120mb) which you can find here (https://dl.dropboxusercontent.com/u/6672418/clang.ops.json) fails with

[1]    67130 segmentation fault  node naive.js
bjouhier commented 10 years ago

Two escape sequences were not handled: \b and \f.

But now I'm getting a seg fault on both files. Investigating...

bjouhier commented 10 years ago

I did not test very thoroughly but this should fix it. Please reopen if you still get problems.

bjouhier commented 10 years ago

I published to npm as 0.1.3