emacs-devel
[Top][All Lists]
Advanced

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

Re: rx.el sexp regexp syntax


From: Stefan Monnier
Subject: Re: rx.el sexp regexp syntax
Date: Thu, 31 May 2018 10:19:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> Itʼs not clear to me how you'd do that. Looking at rx-constituents,
> quite a few of the verbose ways of specifying what to match already
> have a succinct version, eg
>
> sequence => and
> zero-or-more => *

The verbosity for me is not so much in the identifier as in the "( ID
SPC ) SPC" and the need for quotation marks to surround actual
characters.  So for example the string's single-char * turns into
a 5-char * in RX.

I really like the regularity, extensibility, and clear structure of RX,
but in practice it makes the regexps too long: short regexps are
simple enough that RX's advantages don't get a chance to shine, and more
complex regexps are made to spread too many lines for comfort.

That doesn't mean I don't like RX, by the way.  Just that I expected I'd
really love it, and in the end I never use it because I never find it to
be significantly better (I do think it's significantly better when you
need to manipulate it programmatically, of course, which is why lex.el
takes an RX syntax as input).


        Stefan


PS: By the way, we should deprecate the `and` shorthand for `sequence`,
    because `and` in regexps could also mean "conjunction" (that's what
    it means in lex.el).




reply via email to

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