Re: [Qemu-devel] [PATCH v2 41/60] json: Nicer recovery from invalid leading zero

2018-08-20 Thread Markus Armbruster
Eric Blake writes: > On 08/20/2018 06:39 AM, Markus Armbruster wrote: > >> In review of v1, we discussed whether to try matching non-integer >> numbers with redundant leading zero. Doing that tightly in the lexer >> requires duplicating six states. A simpler alternative is to have the >> lexer

Re: [Qemu-devel] [PATCH v2 41/60] json: Nicer recovery from invalid leading zero

2018-08-20 Thread Eric Blake
On 08/20/2018 06:39 AM, Markus Armbruster wrote: In review of v1, we discussed whether to try matching non-integer numbers with redundant leading zero. Doing that tightly in the lexer requires duplicating six states. A simpler alternative is to have the lexer eat "digit salad" after redundant

Re: [Qemu-devel] [PATCH v2 41/60] json: Nicer recovery from invalid leading zero

2018-08-20 Thread Markus Armbruster
Eric Blake writes: > On 08/17/2018 10:05 AM, Markus Armbruster wrote: >> For input 0123, the lexer produces the tokens >> >> JSON_ERROR01 >> JSON_INTEGER 23 >> >> Reporting an error is correct; 0123 is invalid according to RFC 7159. >> But the error recovery isn't nice. >> >> Make

Re: [Qemu-devel] [PATCH v2 41/60] json: Nicer recovery from invalid leading zero

2018-08-17 Thread Eric Blake
On 08/17/2018 10:05 AM, Markus Armbruster wrote: For input 0123, the lexer produces the tokens JSON_ERROR01 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 go

[Qemu-devel] [PATCH v2 41/60] json: Nicer recovery from invalid leading zero

2018-08-17 Thread Markus Armbruster
For input 0123, the lexer produces the tokens JSON_ERROR01 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