[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60196: 29.0.60; re-builder should read all forms for the rx syntax
From: |
Kai Ma |
Subject: |
bug#60196: 29.0.60; re-builder should read all forms for the rx syntax |
Date: |
Fri, 30 Dec 2022 21:45:21 +0800 |
> On Dec 30, 2022, at 20:28, Mattias EngdegÄrd <mattiase@acm.org> wrote:
>
> The handling of rx input in re-builder is indeed unsatisfactory. We could
> adopt your proposed solution:
>
>> Ideally, re-builder should allow users to simply write
>>
>> "<i>" (group (*? anychar)) "</i>"
>
> which would be a definite improvement. We could also accept a Lisp expression
> that is evaluated, so that you'd write
>
> (rx "<i>" (group (*? anychar)) "</i>")
>
> On the surface this looks more verbose, but since re-builder itself would
> provide the `(rx )` boilerplate, there wouldn't actually be any more typing.
Good point! And it is much easier to copy a whole Sexpr.
> The main advantage would be that regexps could be built up from smaller
> pieces:
>
> (rx-let ((spaces (* " "))
> (identifier (: alpha (* alnum))))
> (rx identifier spaces "->" spaces identifier))
>
> Either would be a definite improvement to the current rather strange
> re-builder behaviour with respect to rx input. Any preference?
I like your proposal better! :-)