Re: [Json] ABNF nits

Stefan Drees <stefan@drees.name> Fri, 07 June 2013 06:32 UTC

Return-Path: <stefan@drees.name>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C244D21F85D1 for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 23:32:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.249
X-Spam-Level:
X-Spam-Status: No, score=-2.249 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HELO_EQ_DE=0.35]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id t0+kdUsK5u3v for <json@ietfa.amsl.com>; Thu, 6 Jun 2013 23:31:58 -0700 (PDT)
Received: from mout.web.de (mout.web.de [212.227.15.4]) by ietfa.amsl.com (Postfix) with ESMTP id 6CB1821F83EF for <json@ietf.org>; Thu, 6 Jun 2013 23:31:56 -0700 (PDT)
Received: from newyork.local.box ([93.129.186.5]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MWNHW-1UrrLg45Qw-00Xebe; Fri, 07 Jun 2013 08:31:51 +0200
Message-ID: <51B17E54.9030107@drees.name>
Date: Fri, 07 Jun 2013 08:31:48 +0200
From: Stefan Drees <stefan@drees.name>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
MIME-Version: 1.0
To: "Manger, James H" <James.H.Manger@team.telstra.com>
References: <255B9BB34FB7D647A506DC292726F6E1151B21F79E@WSMSG3153V.srv.dir.telstra.com> <A723FC6ECC552A4D8C8249D9E07425A70FC326C8@xmb-rcd-x10.cisco.com> <255B9BB34FB7D647A506DC292726F6E1151B21F8CA@WSMSG3153V.srv.dir.telstra.com>
In-Reply-To: <255B9BB34FB7D647A506DC292726F6E1151B21F8CA@WSMSG3153V.srv.dir.telstra.com>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K0:WLlURlnf/qgTZbMyoasIloLkZi2lw1x/mLgkD2W4uTl8wR2WhaL v7QT+K+dgWspz5cj9PC/jQy0OOYSxIjyI6p6Xc311J1w5LID2ZlzF05onfPO23Uu3AO4yV8 RvB6rMq85n0sHh4cYTOcON+zoBS6w/WNdse3TyLimOImnfnOLSoufftmfivshs6M/9ZLy1G v5eTSIxP5+Y9UY+Fi4cOQ==
Cc: "Joe Hildebrand (jhildebr)" <jhildebr@cisco.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] ABNF nits
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: stefan@drees.name
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Jun 2013 06:32:03 -0000

On 2013-06-07 05:15, James H. Manger wrote:
>>>> Some things I found futzing with the ABNF:
>>>>
>>>> - normalize the indentation (makes it easier to pull out)
>>>> - Hex literals need to be uppercase.  The false and null rules are
>>>> wrong.
>>>
>>> Lowercase is allowed in hex literals.
>>> It links back to HEXDIG in RFC5234 (or RFC 4234).
>>> You have to remember the sneaky ABNF rule that quoted strings (eg "A")
>>> are case insensitive. "A" is equivalent to %x41 / %x61.
>>
>> Crap.  I didn't see that because it's in a "Note:" in section 2.3.
>
> I didn't call it "sneaky" for nothing ;) ...

lucky JSON, it only needs short tokens (cowardly avoiding the word 
single character here ;-)

If defining a grammar with real case-sensitive "word"-ish tokens in it, 
ABNF is IMO barely usable, unless you extend it with say single quotes 
as case-sensitve string delimiters. But then dealing with two kinds of 
strings also has it's catches =(


>> Regardless, we should change  both of those rules for consistency with
>> the rest of the doc.
>>
>>>> - DIGIT and HEXDIG are neither defined nor imported, as far as I can
>>>> tell.
>>>>  I suggest:
>>>>
>>>> DIGIT = %x30-39                        ; 0-9
>>>> HEXDIG = %x30-39 / %x41-46 / %x61-66   ; 0-9, A-F, or a-f
>>
>> I still recommend being explicit about this, like the rule for e.
>
> I agree.
> Add DIGIT and HEXDIG to the doc so all the ABNF is present.
> Use your definition of HEXDIG above, not the RFC5234 one, to avoid the sneaky ABNF rule.
> Optionally add a note "; DIGIT and HEXDIG are equivalent to rules with the same names in [RFC5234]".

+1 on your proposal James (including the ABNF comment).

Stefan.