GNU bug report logs - #36444
[PATCH] Improved regexp-opt KEEP-ORDER check

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Sun, 30 Jun 2019 12:30:02 UTC

Severity: normal

Tags: patch

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#36444: closed ([PATCH] Improved regexp-opt KEEP-ORDER check)
Date: Thu, 04 Jul 2019 15:19:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 4 Jul 2019 17:18:40 +0200
with message-id <9C8D8AE9-8B8B-4428-BC79-BEB82BC3E3A3 <at> acm.org>
and subject line Re: bug#36444: [PATCH] Improved regexp-opt KEEP-ORDER check
has caused the debbugs.gnu.org bug report #36444,
regarding [PATCH] Improved regexp-opt KEEP-ORDER check
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
36444: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=36444
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Improved regexp-opt KEEP-ORDER check
Date: Sun, 30 Jun 2019 14:28:57 +0200
[Message part 3 (text/plain, inline)]
Currently, regexp-opt does not attempt optimisation with KEEP-ORDER set if the input list contains a proper prefix of another element, like

 ("ab" "abcd")

on the grounds that the optimised string would be

 "ab\\(?:cd\\)?"

which would not preserve the match order. However, this also prevents

 ("abcd" "ab")

from being optimised, even though doing so would be harmless.

The attached patch strengthens the check, allowing more inputs to be optimised.

[0001-Optimise-more-inputs-to-regexp-opt.patch (application/octet-stream, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 36444-done <at> debbugs.gnu.org
Subject: Re: bug#36444: [PATCH] Improved regexp-opt KEEP-ORDER check
Date: Thu, 4 Jul 2019 17:18:40 +0200
4 juli 2019 kl. 16.18 skrev Noam Postavsky <npostavs <at> gmail.com>:
> 
>> Not too fond of that either, really; catch/throw somehow seems more
>> heavyweight than warranted by the situation.
> 
> I've wondered if it's worth making a lexical variant of catch/throw that
> could be compiled as goto for these kind of situations.

Yes, although in this case I'd settle for built-in some/every constructs without bootstrap trouble, or list comprehensions that aren't a mysterious corner of cl-loop.

>> (1) Same as before, but with a comment about what tripped you up:
> 
>> (2) Using cl-loop:
> 
> Assuming (eval-when-compile (require 'cl-lib)) avoids bootstapping
> problems, I think the cl-loop variant is a bit neater; but either way is
> fine with me.

Thank you; I went with the while-loop, on the grounds that it can be readily understood by the layman from first principles. I have yet to be entirely friends with cl-loop.
Pushed to master.



This bug report was last modified 5 years and 358 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.