Re: [Jsonpath] I-Regexp railroad diagrams

Carsten Bormann <cabo@tzi.org> Fri, 29 April 2022 09:36 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 B3005C13A8EF for <jsonpath@ietfa.amsl.com>; Fri, 29 Apr 2022 02:36:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x4bqA9Cj2hGV for <jsonpath@ietfa.amsl.com>; Fri, 29 Apr 2022 02:36:24 -0700 (PDT)
Received: from gabriel-smtp.zfn.uni-bremen.de (gabriel-smtp.zfn.uni-bremen.de [IPv6:2001:638:708:32::15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B73B2C159491 for <jsonpath@ietf.org>; Fri, 29 Apr 2022 02:36:23 -0700 (PDT)
Received: from [192.168.217.118] (p5089ad4f.dip0.t-ipconnect.de [80.137.173.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4KqS6W4ZwmzDCbd; Fri, 29 Apr 2022 11:36:19 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <B8585648-1D0B-44CE-8F41-725FEA3380A5@tzi.org>
Date: Fri, 29 Apr 2022 11:36:19 +0200
Cc: Tim Bray <tbray@textuality.com>, jsonpath@ietf.org
X-Mao-Original-Outgoing-Id: 672917778.922367-f99cc74ed8187b8b0c5576c4b3eddf3e
Content-Transfer-Encoding: quoted-printable
Message-Id: <C4327687-29FD-4A8C-B818-DA4946A287B9@tzi.org>
References: <CAHBU6itK5ziu6+j2vtxmPmgbFfeJi6Cmh5HoX4_ewW=7nCu+QA@mail.gmail.com> <3F8374E6-C0A7-4768-800E-09457291CCC5@tzi.org> <CANH0GbJy69qy7q1yha8wUjJk1EvvTjXqkh2GNkzVQCx7uyCeRQ@mail.gmail.com> <B8585648-1D0B-44CE-8F41-725FEA3380A5@tzi.org>
To: Glyn Normington <glyn.normington.work@gmail.com>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/jsonpath/0qLXq9m97jVDkTm0jXwmbplQ6Xk>
Subject: Re: [Jsonpath] I-Regexp railroad diagrams
X-BeenThere: jsonpath@ietf.org
X-Mailman-Version: 2.1.34
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: Fri, 29 Apr 2022 09:36:28 -0000


> On 2022-04-29, at 09:40, Carsten Bormann <cabo@tzi.org> wrote:
> 
> On 2022-04-29, at 09:39, Glyn Normington <glyn.normington.work@gmail.com> wrote:
>> 
>> Very good. Can we add a railroad diagram to the JSONPath spec?
> 
> Of course.  Let’s see how useful that turns out…

(As Kate mentioned on twitter, her code doesn’t do Unicode ranges yet, so I had to do some manual massaging.)

These are a few examples from the plaintext version:


   index-selector:
       │├── "[" ── S ──╮── quoted-member-name ──╭── S ── "]" ──┤│
                       │                        │
                       ╰──── element-index ─────╯

   quoted-member-name:
       │├── string-literal ──┤│

   string-literal:
       │├──╮── "\"" ──╭───────────────────╮── "\"" ──╭──┤│
           │          │                   │          │
           │          ╰── double-quoted ──╯          │
           │                                         │
           ╰─── "'" ──╭───────────────────╮── "'" ───╯
                      │                   │
                      ╰── single-quoted ──╯

   double-quoted:
       │├──╮───── unescaped ──────╭──┤│
           │                      │
           ╰──────── "'" ─────────╯
           │                      │
           ╰──── ESC ── "\"" ─────╯
           │                      │
           ╰── ESC ── escapable ──╯

Unfortunately, some of the plaintext graphs are too wide for the current RFC style guide.

Please find a full PDF version at https://www.tzi.de/~cabo/jsonpath.pdf
(A few bugs in the PDF version show up here, too.)

Grüße, Carsten