RyanMarcus / dirty-json

A parser for invalid JSON
GNU Affero General Public License v3.0
307 stars 30 forks source link

does not parse dash? #14

Closed rheilgm closed 6 years ago

rheilgm commented 6 years ago

image

for some reason it converts dashes to NaN when its inside the quotes

RyanMarcus commented 6 years ago

Oh, that's a fun one! I'm guessing the bug is in this line of lexer.js:

lexer.addRule(/[\-0-9]+/, lexeme => {

... because it will accept "-"... the correct regex is probably \-?[0-9]+.

Unfortunately, I'm working for Google right now, and their lawyers claim any code I write this summer becomes Google's property. I'll have to fix this when I return to school in August.

Thanks for reporting the issue! :)

RyanMarcus commented 6 years ago

I believe I've fixed the bug. Will do a release soon.

RyanMarcus commented 6 years ago

Fixed in 0.7.0. The online demo should be update to date soon.