[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#50136: 28.0.50; A problem with rx-let expansion
From: |
Michael Heerdegen |
Subject: |
bug#50136: 28.0.50; A problem with rx-let expansion |
Date: |
Mon, 23 Aug 2021 18:59:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Mattias Engdegård <mattiase@acm.org> writes:
> Here is my proposed change to the manual. I didn't change the doc
> strings since they already refer to that Info node.
Maybe at least one sentence about that this mechanism just performs
trivial substitution?
> +User-defined forms themselves only perform simple template
> +substitution.
I find the term "user-defined" distracting, because anybody (including
library and package developers) is "affected". Apart from that, ok for
me.
> For arbitrary computations, use them together with with
> +the @code{rx} forms @code{eval}, @code{regexp} or @code{literal}.
> +Example:
> +
> +@example
> +@group
> +(defun n-tuple-rx (n element)
> + `(seq "<"
> + (group-n 1 ,element)
> + ,@@(mapcar (lambda (i) `(seq ?, (group-n ,i ,element)))
> + (number-sequence 2 n))
> + ">"))
> +(rx-define n-tuple (n element) (eval (n-tuple-rx n 'element)))
> +(rx (n-tuple 3 (+ (in "0-9"))))
> + @result{} "<\\(?1:[0-9]+\\),\\(?2:[0-9]+\\),\\(?3:[0-9]+\\)>"
> +@end group
> +@end example
> @end defmac
Didn't try the example, but it looks good.
I have one more thing, however, once we are here: In the docstring of
`rx', near the end:
| (eval EXPR) Match the rx sexp from evaluating EXPR at compile time.
can we say "expansion time" instead of "compile time"?
Regards,
Michael.
- bug#50136: 28.0.50; A problem with rx-let expansion, Michael Heerdegen, 2021/08/20
- bug#50136: 28.0.50; A problem with rx-let expansion, Michael Heerdegen, 2021/08/20
- bug#50136: 28.0.50; A problem with rx-let expansion, Mattias Engdegård, 2021/08/20
- bug#50136: 28.0.50; A problem with rx-let expansion, Michael Heerdegen, 2021/08/20
- bug#50136: 28.0.50; A problem with rx-let expansion, Mattias Engdegård, 2021/08/20
- bug#50136: 28.0.50; A problem with rx-let expansion, Michael Heerdegen, 2021/08/21
- bug#50136: 28.0.50; A problem with rx-let expansion, Mattias Engdegård, 2021/08/21
- bug#50136: 28.0.50; A problem with rx-let expansion, Michael Heerdegen, 2021/08/23
- bug#50136: 28.0.50; A problem with rx-let expansion, Mattias Engdegård, 2021/08/23
- bug#50136: 28.0.50; A problem with rx-let expansion, Mattias Engdegård, 2021/08/23
- bug#50136: 28.0.50; A problem with rx-let expansion,
Michael Heerdegen <=
- bug#50136: 28.0.50; A problem with rx-let expansion, Mattias Engdegård, 2021/08/23
- bug#50136: 28.0.50; A problem with rx-let expansion, Richard Stallman, 2021/08/20