qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/4] qobject: Correct JSON lexer grammar comment


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 1/4] qobject: Correct JSON lexer grammar comments
Date: Fri, 17 Jun 2016 09:54:38 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 06/16/2016 10:19 AM, Markus Armbruster wrote:
>> Eric Blake <address@hidden> writes:
>> 
>>> Fix the regex comments describing what we parse as JSON.  No change
>>> to the lexer itself, just to the comments:
>>> - The "" and '' string construction was missing alternation between
>>> different escape sequences
>>> - The construction for numbers forgot to handle optional leading '-'
>>> - The construction for numbers was grouped incorrectly so that it
>>> didn't permit '0.1'
>>> - The construction for numbers forgot to mark the exponent as optional
>>> - No mention that our '' string and "\'" are JSON extensions
>>> - No mention of our %d and related extensions when constructing JSON
>>>
>>> Signed-off-by: Eric Blake <address@hidden>
>> 
>> Reviewed-by: Markus Armbruster <address@hidden>
>> 
>> I'll take this one through qapi-next.  Thanks!
>> 
>
> You may want to squash this in for shorter lines:
>
>
> diff --git a/qobject/json-lexer.c b/qobject/json-lexer.c
> index de16219..b030576 100644
> --- a/qobject/json-lexer.c
> +++ b/qobject/json-lexer.c
> @@ -21,16 +21,14 @@
>   * Required by JSON (RFC 7159), plus \' extension in "", and extension
>   * of parsing case-insensitive non-finite numbers like "NaN" and "-Inf":
>   *
> - * \"([^\\\"]|(\\\"|\\'|\\\\|\\/|\\b|\\f|\\n|\\r|\\t|
> - *    \\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))*\"
> + * \"([^\\\"]|\\[\"'\\/bfnrt]|\\u[0-9a-fA-F]{4})*\"
>   * -?(0|[1-9][0-9]*)(.[0-9]+)?([eE][-+]?[0-9]+)?
>   * [{}\[\],:]
>   * -?[a-zA-Z]+   # covers null, true, false, nan, inf[inity]
>   *
>   * Extension of '' strings:
>   *
> - * '([^\\']|(\\\"|\\'|\\\\|\\/|\\b|\\f|\\n|\\r|\\t|
> - *    \\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]))*'
> + * '([^\\']|\\[\"'\\/bfnrt]|\\u[0-9a-fA-F]{4})*'
>   *
>   * Extension for vararg handling in JSON construction:
>   *

Doesn't apply as is, but I get what you mean.  Applied to qapi-next,
please double-check the result there.  Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]