On 08/17/2018 10:05 AM, Markus Armbruster wrote:
For input 0123, the lexer produces the tokens
JSON_ERROR 01
JSON_INTEGER 23
Reporting an error is correct; 0123 is invalid according to RFC 7159.
But the error recovery isn't nice.
Make the finite state machine eat digits before going into the error
state. The lexer now produces
JSON_ERROR 0123
Signed-off-by: Markus Armbruster <arm...@redhat.com>
Reviewed-by: Eric Blake <ebl...@redhat.com>
Did you also want to reject invalid attempts at hex numbers, by adding
[xXa-fA-F] to the set of characters eaten by IN_BAD_ZERO?
+ [IN_BAD_ZERO] = {
+ ['0' ... '9'] = IN_BAD_ZERO,
+ },
+
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org