emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Forbid reverse ranges in rx


From: Clément Pit-Claudel
Subject: Re: Forbid reverse ranges in rx
Date: Tue, 12 Mar 2019 10:27:45 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

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 via email to

[Prev in Thread] Current Thread [Next in Thread]