Return-Path: <cabo@tzi.org>
X-Original-To: jsonpath@mail2.ietf.org
Delivered-To: jsonpath@mail2.ietf.org
Received: from localhost (localhost [127.0.0.1])
	by mail2.ietf.org (Postfix) with ESMTP id CFD1512A0B0F
	for <jsonpath@mail2.ietf.org>; Wed, 26 Mar 2025 07:56:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at ietf.org
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level: 
X-Spam-Status: No, score=-1.897 tagged_above=-999 required=5
	tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_BLOCKED=0.001,
	RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
	RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail2.ietf.org ([166.84.6.31])
	by localhost (mail2.ietf.org [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 4sSIGqsQ8eTa for <jsonpath@mail2.ietf.org>;
	Wed, 26 Mar 2025 07:56:46 -0700 (PDT)
Received: from smtp.zfn.uni-bremen.de (smtp.zfn.uni-bremen.de [134.102.50.21])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256)
	(No client certificate requested)
	by mail2.ietf.org (Postfix) with ESMTPS id 8BEC812A0AC3
	for <jsonpath@ietf.org>; Wed, 26 Mar 2025 07:56:46 -0700 (PDT)
Received: from [192.168.217.145] (p548dc3ec.dip0.t-ipconnect.de
 [84.141.195.236])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4ZN8y44994zDCnZ;
	Wed, 26 Mar 2025 15:56:44 +0100 (CET)
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: 
 <CAKspqcV5dXjv5ZwdFMAQKV7ktRe21QiyteAkaWgM=2-SpDj=cA@mail.gmail.com>
Date: Wed, 26 Mar 2025 15:56:44 +0100
X-Mao-Original-Outgoing-Id: 764693804.037104-f112b7fb4cc062747699efa50237b305
Content-Transfer-Encoding: quoted-printable
Message-Id: <FA32CC46-C83F-4A28-AF7D-58F7F4082E7D@tzi.org>
References: <20250324144730.970D2210673@rfcpa.rfc-editor.org>
 <F5AABC54-3B2A-4621-A77E-07CC24B87642@tzi.org>
 <f87965d1-c1db-4c5a-a0c6-f5f9d61de921@hxr.us>
 <EBFD5D95-629B-4151-AEFF-A8651A0937A1@tzi.org>
 <CAKspqcVxWoWBZ2rB2MVRhhPYgXJGp285cMtL1TUCJCUtn4qvDw@mail.gmail.com>
 <52840452-8f98-4da2-8bea-d62e70638616@hxr.us>
 <CAKspqcWrHVaUPH2FGvi7+47HkmVWrNB-cTGkR8-d03J8-7aYoQ@mail.gmail.com>
 <3FAB5B50-2CEB-4E62-BF0A-9108EE4AE51F@tzi.org>
 <397a85f4-b7db-4def-a811-3d61c280ad5f@hxr.us>
 <CAKspqcV5dXjv5ZwdFMAQKV7ktRe21QiyteAkaWgM=2-SpDj=cA@mail.gmail.com>
To: Vladimir Gorej <vladimir.gorej@gmail.com>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Message-ID-Hash: 555EJXZGPMYPMQM754RR5FRDO7WPTAOP
X-Message-ID-Hash: 555EJXZGPMYPMQM754RR5FRDO7WPTAOP
X-MailFrom: cabo@tzi.org
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency;
 loop; banned-address; member-moderation; nonmember-moderation; administrivia;
 implicit-dest; max-recipients; max-size; news-moderation; no-subject;
 digests; suspicious-header
CC: "Andrew Newton (andy)" <andy@hxr.us>,
 RFC Errata System <rfc-editor@rfc-editor.org>,
 stefan.goessner@fh-dortmund.de, glyn.normington@gmail.com,
 Orie Steele <orie@transmute.industries>, james.ietf@gmail.com,
 Tim Bray <tbray@textuality.com>, jsonpath@ietf.org
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: =?utf-8?q?=5BJsonpath=5D_Re=3A_=5BTechnical_Errata_Reported=5D_RFC9535_=2883?=
	=?utf-8?q?43=29?=
List-Id: Discussion of JSONPath syntax <jsonpath.ietf.org>
Archived-At: 
 <https://mailarchive.ietf.org/arch/msg/jsonpath/DwLTymyyqD9wmLH5j7YIDs8lKq0>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jsonpath>
List-Help: <mailto:jsonpath-request@ietf.org?subject=help>
List-Owner: <mailto:jsonpath-owner@ietf.org>
List-Post: <mailto:jsonpath@ietf.org>
List-Subscribe: <mailto:jsonpath-join@ietf.org>
List-Unsubscribe: <mailto:jsonpath-leave@ietf.org>

On 2025-03-26, at 15:19, Vladimir Gorej <vladimir.gorej@gmail.com> =
wrote:
>=20
> Would something like that work for the GLOBAL errata report?

I would probably simplify this to the below.
(And Apple Mail will then destroy the alignment, sorry about that.)

Gr=C3=BC=C3=9Fe, Carsten



Original Text
-------------

;; Section 2.3.5.1
comparable          =3D literal /
                      singular-query / ; singular query value
                      function-expr    ; ValueType

;; Section 2.4
function-argument   =3D literal /
                      filter-query / ; (includes singular-query)
                      logical-expr /
                      function-expr

;; Appendix A copies these two rules into the collected ABNF.

Corrected Text
--------------

;; Section 2.3.5.1
comparable          =3D singular-query / ; singular query value
                      function-expr /  ; ValueType
                      literal

;; Section 2.4
function-argument   =3D logical-expr /
                      filter-query / ; (includes singular-query)
                      function-expr /
                      literal

;; Appendix A needs to copy these two updates in the collected ABNF.

Notes
-----

The ABNF grammars in RFC 9535 were designed to be directly usable with =
PEG (Parsing Expression Grammar) parsers.

However, PEG parsers will fail to parse $[?blt(1=3D=3D1)] or =
$[?true(1)=3D=3D0] with the grammar as given, as they employ prioritized =
choice, where the order matters.

In the order given, they will try to match the `literal` rule in =
`function-argument` with the input `1=3D=3D1`, and find that the `1` =
indeed matches a `number`, completing the match for `function-argument` =
and preempting the other choices.  The intended rest of the =
`function-argument`, `=3D=3D1` does not match anything, and the rule =
fails.
By putting the more complex `logical-expr` first, the whole `1=3D=3D1` =
matches, and the rule succeeds as intended.

Similary, the function name `true` matches as the literal `true` =
instead, and preempts parsing `true(1)` as the more complex =
`function-expr`.  Putting the `literal` choice last prevents the =
preemptive match.

