Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: pcre callouts
- X-seq: zsh-workers 52255
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Oliver Kiddle <opk@xxxxxxx>
- Cc: Zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: PATCH: pcre callouts
- Date: Mon, 30 Oct 2023 20:26:38 -0700
- Archived-at: <https://zsh.org/workers/52255>
- In-reply-to: <72311-1698710659.978677@cDMN.pAu_.Ex7V>
- List-id: <zsh-workers.zsh.org>
- References: <72311-1698710659.978677@cDMN.pAu_.Ex7V>
On Mon, Oct 30, 2023 at 5:04 PM Oliver Kiddle <opk@xxxxxxx> wrote:
>
> So, e.g. (?C{foo}) or (?C'foo') will call the foo function. In Perl,
> $_ is set to the string being examined. I've used .pcre.subject. Would
> something else be better
You could actually use ${.pcre._} I suppose. I'm undecided on whether
that's better.
> and should it perhaps start and end a new scope
> to make that local?
We do have a precedent for that now with ${|...} creating a scope.
> This won't do anything for numeric callouts. They look mostly useful for
> debugging. They could perhaps call a standard function passing the
> number and string as parameters.
What's an example of using a number callout outside of zsh?
I see you're calling parse_string() here:
> + if (!block->callout_number &&
> + ((prog = parse_string((char *) block->callout_string, 0))))
How are you solving the problem of finding the end of the callout?
That is, (?C{code}) looks like it would have the same parsing problems
I wrestled with for ${|code}. Is it just that you can skip everything
from "(?" to the matching ")" without having to worry about
(un)balanced braces inside, etc.?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author