[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#58727: 29.0.50; rx doc: Semantics of RX...
From: |
Michael Heerdegen |
Subject: |
bug#58727: 29.0.50; rx doc: Semantics of RX... |
Date: |
Mon, 24 Oct 2022 04:34:09 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Mattias Engdegård <mattias.engdegard@gmail.com> writes:
> > The resulting regexps are concatenating like with an implicit `seq'.
> > This is not trivial, though: in stringish regexps the repetition
> > operators are only unary, and different interpretations would make sense
> > for `rx' (implicit `seq', implicit `or').
>
> The rule is implicit concatenation unless specified otherwise; maybe
> we could say that in the leading paragraph. (`or` is the only place
> where concatenation isn't done.)
Yes, that would be good.
> > Oh, and maybe let's also make more clear that `rx' always cares
> > about implicit grouping when necessary.
>
> No, there is no such thing in rx.
I think you misunderstood what I meant, I meant the implicit shy
grouping added in the return value, as in
(rx (or "ab" "cd")) ==> "\\(?:ab\\|cd\\)"
^^^^^ ^^^
> The manual provides corresponding string-notation constructs for
> orientation only. This is important -- rx forms are defined by their
> semantics, not by what strings they translate to.
Is this trivial however? Is it clear that, even for people that see rx
more as a translator to stringish regexps, `rx' is that smart?
A sentence like "rx forms are defined by their semantics" would help to
make that clear I think.
Dunno, I'm just guessing that here is a potential for misunderstanding.
Telling about the implicit concatenation of RX... is the more important
point for me.
Thanks so far,
Michael.