GNU bug report logs -
#50136
28.0.50; A problem with rx-let expansion
Previous Next
Full log
View this message in rfc822 format
Mattias Engdegård <mattiase <at> 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.
This bug report was last modified 3 years and 273 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.