zserge / jsmn

Jsmn is a world fastest JSON parser/tokenizer. This is the official repo replacing the old one at Bitbucket
MIT License
3.65k stars 778 forks source link

primitive token first character could be '.'? #170

Closed michael-g closed 5 years ago

michael-g commented 5 years ago

Just reading your docs -- haven't read the source or used the library -- but presumably since a valid number may be e.g. {"myfloat":.5}, the first character of that primitive token could be a full-stop, not just the ones you note: [-0-9]?

pt300 commented 5 years ago

According to RFC-8259 numbers consists of an integer that might be followed by a fraction part. This means that {"myfloat":.5} is not a valid JSON string in the eyes of that standard.

michael-g commented 5 years ago

Ah, right. Apologies, I had misremembered the state transition table of http://www.json.org/JSON_checker/JSON_checker.c; at line 158 it does not transition from value (VA) to fraction (FR) [edit: on seeing a . input]. I'll update my Ragel recogniser appropriately ;)