all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: Forbid reverse ranges in rx
Date: Tue, 12 Mar 2019 10:27:45 -0400	[thread overview]
Message-ID: <cedbf6d2-dbbc-70cd-88dd-04a8e0eafcc8@gmail.com> (raw)
In-Reply-To: <50fb83052c1de4da59f0a857deed2e5d9e533c13.camel@acm.org>

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?



  reply	other threads:[~2019-03-12 14:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 14:02 Forbid reverse ranges in rx Mattias Engdegård
2019-03-12 14:27 ` Clément Pit-Claudel [this message]
2019-03-12 15:26   ` Mattias Engdegård
2019-03-12 16:56     ` Stefan Monnier
2019-03-12 21:01       ` Mattias Engdegård
2019-03-19 15:02         ` Mattias Engdegård
2019-03-19 16:17           ` Stefan Monnier
2019-03-12 16:12 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cedbf6d2-dbbc-70cd-88dd-04a8e0eafcc8@gmail.com \
    --to=cpitclaudel@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.