zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Oliver Kiddle <opk@zsh.org>
Cc: Zsh workers <zsh-workers@zsh.org>
Subject: Re: PATCH: pcre callouts
Date: Mon, 30 Oct 2023 20:26:38 -0700	[thread overview]
Message-ID: <CAH+w=7bNAmZP3x+4n1qYCQBQiTM+9TZgTumVXnAftoeFcHcToA@mail.gmail.com> (raw)
In-Reply-To: <72311-1698710659.978677@cDMN.pAu_.Ex7V>

On Mon, Oct 30, 2023 at 5:04 PM Oliver Kiddle <opk@zsh.org> 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.?


  reply	other threads:[~2023-10-31  3:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31  0:04 Oliver Kiddle
2023-10-31  3:26 ` Bart Schaefer [this message]
2023-10-31  3:40   ` Bart Schaefer
2023-10-31 13:31     ` Mikael Magnusson
2023-10-31 15:57       ` Bart Schaefer
2023-11-01  2:04   ` Oliver Kiddle
2023-11-03  3:47     ` Bart Schaefer
2023-11-03  9:50       ` Oliver Kiddle
2023-11-04 20:57         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7bNAmZP3x+4n1qYCQBQiTM+9TZgTumVXnAftoeFcHcToA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=opk@zsh.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).