develooper Front page | perl.perl5.porters | Postings from November 2017

Re: Implementing script runs

Thread Previous | Thread Next
From:
Zefram
Date:
November 5, 2017 19:19
Subject:
Re: Implementing script runs
Message ID:
20171105191903.GA4913@fysh.org
Father Chrysostomos wrote:
>    (?+extended_modiifer_1,extended_modifier_2:)
>    (?mix+script_run:...)

I like this syntax.  I wonder how it would work with the "-" for turning
modifiers off.

However, as we discussed last year, this is semantically wrong
for script runs.  The modifiers that we have so far affect the
interpretation of each part of the affected subpattern individually,
such that /(?foo:bar)(?foo:baz)/ is always equivalent to /(?foo:barbaz)/.
This holds even in the /i cases that mess with character boundaries,
such as "\xdf" =~ /(?i:s)(?i:s)/.  The script run feature is completely
unlike these: it's about the string matching the subpattern *as a whole*,
and the concatenation of two script-run subpatterns does not behave like
a single script-run subpattern.

So I think a different syntax is required for script runs.  We already
have the "(*WORD)" syntax to identify extended regexp features by keyword,
so I think "(*script_run:...)" is a good way to go.

-zefram

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About