emacs-devel
[Top][All Lists]
Advanced

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

Re: More re odditie [Was: regular expressions that match nothing]


From: Stefan Monnier
Subject: Re: More re odditie [Was: regular expressions that match nothing]
Date: Thu, 16 May 2019 08:31:20 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> I'd rather read `*' as meaning "repeat the empty string",

`*` repeats the immediately preceding regular expression, but here there
is no preceding regular expression:
- there are various ways to resolve this problem.
- all "reasonable" semantics are pretty useless in the sense that it's
  trivial to write another regexp with the same semantics.
- the combination of the previous two points implies that signaling an
  error is probably the better option.

> BTW, can your scans of regexps tell if this compatibility is relied on a
> lot?

His scan does catch those (and many other of its friends).

> It would be safe to replace `*' and `+' with `\*' and `\+' where
> this happens.

We've done that, indeed.

> I've just grep'ed quickly through the code and only noticed a risky
> use of "+" (and "[..]") in the definition of `term-word' in term.el

That's because we already fixed the occurrences that his tool finds ;-)

>> Thanks for reporting it, and you are right, that's a (known) bug in rx.
> When rx is fixed, I suggest we add the following extra tests (see patch)

Good idea.


        Stefan




reply via email to

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