From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: Forbid reverse ranges in rx Date: Tue, 12 Mar 2019 10:27:45 -0400 Message-ID: References: <50fb83052c1de4da59f0a857deed2e5d9e533c13.camel@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="117747"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 12 15:33:40 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3iTK-000UTe-JZ for ged-emacs-devel@m.gmane.org; Tue, 12 Mar 2019 15:33:38 +0100 Original-Received: from localhost ([127.0.0.1]:53577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3iTJ-00079k-GG for ged-emacs-devel@m.gmane.org; Tue, 12 Mar 2019 10:33:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3iNn-0003HJ-Bn for emacs-devel@gnu.org; Tue, 12 Mar 2019 10:27:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3iNl-0003t7-Eo for emacs-devel@gnu.org; Tue, 12 Mar 2019 10:27:54 -0400 Original-Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]:43969) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h3iNj-0003ok-NW for emacs-devel@gnu.org; Tue, 12 Mar 2019 10:27:53 -0400 Original-Received: by mail-oi1-x236.google.com with SMTP id i8so2196858oib.10 for ; Tue, 12 Mar 2019 07:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=IXaUJ/IfxF4ZmxAlVFTNeXYqZ7c/UJwfNcXAgAohwBc=; b=Qf4oPm40FnAEgrHlYYth7AXLmFUKUVPROQDdFNp1xROQKiQuOV+cr1rfF/ooKzt7sc 13V72sPm8gGOlrl4tsq+e+5lBQG74thzt9az55MtxCTSI9fcRdeoGuh5R/MXXxYXCqwv ZvH5xs95w2VLG8XC3+jzrkH2yq0f6B1GvyTsMx7DHseI2iNmTOek6gAmGdIBDI09fM8I q/vwprXonIfPu+TJLqMD3B9iqebw9ReshOuJTVqSMyDg57VYv8wewNrpmkTrIF5GS8v1 XZCnAMb4o2XlU2zbiHUDy4iJ9dzcHbPeoxwdPoMbQrECHaRRmXY5ntXEipVkwiJWhVU7 7AMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=IXaUJ/IfxF4ZmxAlVFTNeXYqZ7c/UJwfNcXAgAohwBc=; b=mVNYBHCqAMW7byb3VFF3U3sTsvxGn4nHPlJoaxNpQnYlOsLb8y941os7kV42uSWYAG LW1uxD+1SkLCdSs5M3QgmdXfdFFri8iXLACKncrfSql/Gp49ap6jvDgtKNkOkAKwawbx 3KzWf0/x7ReNI6iEAprdbI2gq/cNmGsE6gcOs6rJwjZZb3KgnJ0iYyOjGxnFibrFsJ8N c4BRvmMI3uF72Di8zE5+uNIr6Gzly4h733/GYYGG3RCocS6CrdzlH7CFmRHV68e2nYza h+iOtyMJZaSmIw5lMXTwTIXrOOcztwbDo8od7TWRe2fUQydB7TVw/ew/SyoqXb+1QlYO Oqfw== X-Gm-Message-State: APjAAAUhu+uVqQKsUjSb79AfvMbQGEFAFiOrMV5zLH79YEbohyA8SyPU TqoBkAxc6/FCuvpg5C6ljjRzmGtM X-Google-Smtp-Source: APXvYqyxskDhGZrO61Dh8rFPE2naC2l+Zaeasmhff5Q2m+ZKxMZu863pE27TZQTmqB3FzB01jrhxOQ== X-Received: by 2002:aca:c682:: with SMTP id w124mr1942949oif.117.1552400868697; Tue, 12 Mar 2019 07:27:48 -0700 (PDT) Original-Received: from [0.0.0.0] (c-73-126-99-55.hsd1.ma.comcast.net. [73.126.99.55]) by smtp.googlemail.com with ESMTPSA id o11sm638929otj.41.2019.03.12.07.27.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 07:27:48 -0700 (PDT) In-Reply-To: <50fb83052c1de4da59f0a857deed2e5d9e533c13.camel@acm.org> Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234099 Archived-At: This is a neat patch. Thanks for all your efforts. I worry that maybe we should make this a warning, rather than an error, since there are lots of poorly supported but decently working Emacs modes out there. This change will make some of these (subtly broken) modes unusable (we've seen that e.g. the change to comint caused some breakage, so I think we should be especially careful). I'd love to see all these errors detected by xr as warnings in the byte-compiler. Also, if we make this an error in rx, should we also make it an error in regular regexps? Clément. On 12/03/2019 10.02, Mattias Engdegård wrote: > + (t > + (error "Reverse range `%c-%c' in Rx `any' not permitted" > + start end))) Consider rephrasing this to explain why it's not permitted (maybe "… no permitted, as it does not match anything"). > (setq i (+ i 3)))) > (t > ;; Single character. > @@ -503,7 +506,10 @@ rx-check-any > (null (string-match "\\`\\[\\[:[-a-z]+:\\]\\]\\'" translation))) > (error "Invalid char class `%s' in Rx `any'" arg)) > (list (substring translation 1 -1)))) ; strip outer brackets > - ((and (integerp (car-safe arg)) (integerp (cdr-safe arg))) > + ((and (characterp (car-safe arg)) (characterp (cdr-safe arg))) > + (unless (<= (car arg) (cdr arg)) > + (error "Reverse range `%c-%c' in Rx `any' not permitted" > + (car arg) (cdr arg))) Same here?