Re: [Jsonpath] Remarks on the array slice operator described in https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2

Carsten Bormann <cabo@tzi.org> Wed, 09 December 2020 05:39 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: jsonpath@ietfa.amsl.com
Delivered-To: jsonpath@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 866133A0C3A for <jsonpath@ietfa.amsl.com>; Tue, 8 Dec 2020 21:39:29 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.919
X-Spam-Level:
X-Spam-Status: No, score=-1.919 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fIMTJ7wQWWfn for <jsonpath@ietfa.amsl.com>; Tue, 8 Dec 2020 21:39:27 -0800 (PST)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6BE223A0C38 for <jsonpath@ietf.org>; Tue, 8 Dec 2020 21:39:26 -0800 (PST)
Received: from [192.168.217.118] (p548dca87.dip0.t-ipconnect.de [84.141.202.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4CrQph600NzyRy; Wed, 9 Dec 2020 06:39:24 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <bfc4ce04af2a6faa8499fbec535e3aa6f69b2214.camel@gmail.com>
Date: Wed, 09 Dec 2020 06:39:24 +0100
Cc: Tim Bray <tbray@textuality.com>, jsonpath@ietf.org, Michael Kay <mike@saxonica.com>, Daniel P <danielaparker@gmail.com>
X-Mao-Original-Outgoing-Id: 629185164.1612951-22b47d19f790f50a9bd74694e53da341
Content-Transfer-Encoding: quoted-printable
Message-Id: <D797C49F-BCD7-48AF-8AA4-6C2E5C49CA7F@tzi.org>
References: <CA+mwktL4Lio1FKD+20K0rvqb8De9GQomaJy1F+cct=pj_Ft4VQ@mail.gmail.com> <89140FFF-6B25-4ABC-8A25-92327B1313F3@gmail.com> <E59DC723-B9A9-4A03-A3A9-0036DE6F7940@gmail.com> <CANH0GbJEk-RS_QNM_ZM78KCRv+QRUcFK8=oBxQgNtbW1zLLAvA@mail.gmail.com> <FAB83C6B-C878-4ECC-B392-2261A2B70477@saxonica.com> <CA+mwktKCyuga6LBWDFON8tiUiCdyfo6ica1=QdtQftwY+pwgbA@mail.gmail.com> <4E655650-9595-4280-9F1B-0440CA12E12F@tzi.org> <CAHBU6itpM6q3ZXtAi=X-tQz7m-6yyoBL0BKijDe9WqYDmnm80g@mail.gmail.com> <bfc4ce04af2a6faa8499fbec535e3aa6f69b2214.camel@gmail.com>
To: Glyn Normington <glyn.normington.work@gmail.com>
X-Mailer: Apple Mail (2.3608.120.23.2.4)
Archived-At: <https://mailarchive.ietf.org/arch/msg/jsonpath/h2AX9gb74ZLlPofF3DGP4YrEPL4>
Subject: Re: [Jsonpath] Remarks on the array slice operator described in https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2
X-BeenThere: jsonpath@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: A summary description of the list to be included in the table on this page <jsonpath.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jsonpath/>
List-Post: <mailto:jsonpath@ietf.org>
List-Help: <mailto:jsonpath-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 09 Dec 2020 05:39:30 -0000

On 2020-12-09, at 04:36, Glyn Normington <glyn.normington.work@gmail.com> wrote:
> 
> Parsing Expression Grammar that fairly closely matches the ABNF

Interesting.  Because I’m lazy (and I want to make sure the ABNF is right), I generally use a PEG parser that is generated right out of the ABNF.

E.g.,
https://github.com/cabo/cddlc/blob/master/lib/parser/cddl.abnftt

(The abnftt gem generates code from the augmented ABNF, but also generates a clean ABNF file that can be diffed against the ABNF from the RFC.  See https://github.com/cabo/cddlc/blob/master/Rakefile .)

Obviously, using ABNF with PEG semantics requires some care when setting up the ABNF (don’t let prioritized choice get in your way).

Grüße, Carsten