PATCH: [perl #113584] tr/// multiple transliterations

Commit 4de6d205aeab9ec737ca35ba4eb61f37cebefc55 failed to take into
consideration tr///.
perldelta for RT #113584
op/eval.t: Change test

A future commit will change the output for this test, so use another one
that generates a straight syntax error.
Require space between regex and following alnum operator

Not having such space has been deprecated since v5.14.0.
don't override a user supplied prefix on Haiku-OS
Use standard gcc names in config_H.gc64's CPPSTDIN/CPPRUN

These canned defaults are not used in making miniperl.exe, after which the
real config.h will be generated with the correct values depending on the
compiler toolchain. This is just for sanity's sake to make the diff
between the .gc and .gc64 files clearer.
Update List-Util to CPAN version 1.25

  [DELTA]

1.25 -- Sat Mar 24 13:10:13 UTC 2012

  * Restore back-compat. to perl 5.6 (thanks to Zefram)

1.24 -- Thu Mar 22 18:10:10 UTC 2012

  * Update to 1.24 release version (no other changes since 1.23_04).

1.23_04 -- Sat Mar 10 00:16:16 UTC 2012

  * RT#72700 Fix off-by-two on string literal length

1.23_03 -- Tue Sep 14 10:09:59 CDT 2010

  * Min perl version supported for build is not 5.008
  * Dropped the pure-Perl implementation of both Scalar::- and List::Util.
  * RT#61118 Fix assumption in sum() that once magic, always magic

1.23_02 -- Tue Mar 30 11:09:15 CDT 2010

  * Fix first() and reduce() to check the callback first; &first(1) is now illigal. [gfx]
  * Fix reduce() to allow XSUB callbacks [gfx]
  * Fix first() to allow XSUB callbacks [gfx]
  * Resolve RT #55763: tainted() doesn't do SvGETMAGIC(sv) [gfx]
  * define CvISXSUB so older perl versions will still compile

1.23_01 -- Mon Mar 22 08:24:11 CDT 2010

  * Add failing tests; SVt_RV is not directly SvROK [gfx]
  * Implement openhandle() in XS (with extra tests) [gfx]
  * Modernize *.pm [gfx]
  * Modernize ListUtil.xs [gfx]
  * Add ppport.h [gfx]
  * Fix an overloading issue on sum(), and add tests for overloading [gfx]
  * Small tweaks for minstr()/maxstr() [gfx]
  * Optimize dualvar() [gfx]
  * Use sv_copypv() instead of SvPV() and sv_setpv() [gfx]
  * avoid non-portable warnings
Temporarily remove overload.t changes

undo commits done to lib/overload.t on the blead branch
between 2012/03/31 and 2012/06/04 to make rebasing the re_eval
branch easier. These changes will be re-applied at the end of the rebase
Revert two commits to make rebasing easier

These two commits will be added back later after rebasing

    "[perl #108780] Make /foo$qr/ work under ‘no overloading’"

        37c07a4b201c9f799808d346817c4685e3e9002a.

    "regcomp.c: Silence valgrind warning"

        44bed85634c450533d59ae9e371037dde0101d51.
Temporarily revert some lib/overload.t tests

these accumulated from a few recent commits. Removing will make rebasing
easier.
revert a trailing whitespace removal

this is to make rebasing easier. On one of the rebased commits
also removes this whitespace
Revert two commits that fix a VOL declaration.
This has also been done on my davem/re_eval branch,
and its easiest to revert these at the start of my branch

Revert "regcomp.c: Silence compiler warning about longjump"

This reverts commit 24efd69ba77ba76cd714519dccee88f45820d8b4.

Revert "Fix volatile declaration"

This reverts commit 4d6b28934825c9c735195140271a6f93f9c07348.
Revert 4 regex commits to ease rebasing

Revert "Remove some repeated code in pp_regcomp"
This reverts commit 3e1022372a8200bc4c7354e0f588c7f71584a888.

Revert "regcomp.c: Use no_mg for 2nd fetch of pattern"
This reverts commit 3e0b93e82af0f1a033bcdb918b413113f1d61cf0.
`
Revert "PATCH: [perl #101940]: BBC Tk"
This reverts commit 11951bcbfcaf4c260b0da0421e72fc80b4654f17.

Revert "Fix =~ $str_overloaded (5.10 regression)"
This reverts commit 15d9c083b08647e489d279a1059b4f14a3df187b.

These four recent commits on the blead branch overlap with work on the
re_eval branch. To make rebasing re_eval easier, revert them at the
beginning of the re_eval branch. Any remaining value will be re-added
later in the re_eval branch.
correct comment about how strings are tokenised

The stuff about "foo\lbar" being tokenised as a list which you need to
apply join() to, was wrong; the tokeniser outputs the necessary concats
rather than commas.
make re_evals be seen by the toker/parser

This commit is a first step to making the handling of (/(?{...})/ more sane.
But see the big proviso at the end.

Currently a patten like /a(?{...})b/ is uninterpreted by the lexer and
parser, and is instead passed as-is to the regex compiler, which is
responsible for ensuring that the embedded perl code is extracted and
compiled. The only thing the quoted string code in the lexer currently
does is to skip nested matched {}'s, in order to get to end of the code
block and restart looking for interpolated variables, \Q etc.

This commit makes the lexer smarter.

Consider the following pattern:

    /FOO(?{BLOCK})BAR$var/

This is currently tokenised as

    op_match
    (
    op_const["FOO(?{BLOCK})BAR"]
    ,
    $
    "var"
    )

Instead, tokenise it as:

    op_match
    (
    op_const["FOO"]
    ,
    DO
    {
    BLOCK
    ;
    }
    ,
    op_const["(?{BLOCK})"]
    ,
    op_const["BAR"]
    ,
    $
    "var"
    )

This means that BLOCK is itself tokenised and parsed. We also insert
a const into the stream to include the original source text of BLOCK so
that it's available for stringifying qr's etc.

Note that by allowing the lexer/parser direct access to BLOCK, we can now
handle things like
    /(?{"{"})/

This mechanism is similar to the way something like

    "abc $a[foo(q(]))] def"

is currently parsed: the double-quoted string handler in the lexer stops
at $a[, the 'foo(q(]))' is treated as perl code, then at the end control is
passed back to the string handler to handle the ' def'.

This commit includes a new error message:

    Sequence (?{...}) not terminated with ')'

since when control is passed back to the quoted-string handler, it expects
to find the ')' as the next char. This new error mostly replaces the old

    Sequence (?{...}) not terminated or not {}-balanced in regex

Big proviso:

This commit updates toke.c to recognise the embedded code, but doesn't
then do anything with it. The parser will pass both a compiled do block
and a const for each embedded (?{..}), and Perl_pmruntime just throws
away the do block and keeps the constant text instead which is passed to
the regex compiler. So currently each code block gets compiled twice (!)
with two sets of warnings etc. The next stage will be to pass these do
blocks to the regex compiler.

This commit is based on a patch I had originally worked up about 6 years
ago and has been sitting bit-rotting ever since.
update diagnostics message

The description of the "Sequence (?{...}) not terminated with ')'" error
was cut and paste from another error without the text being updated!
disable lexing of (?{}) within \Q, \U etc

when (?{..}) or (??{..}) is enclosed in one of the modifiers like \Q,
don't parse it; treat it as plain characters that are modified by \Q etc.
This means that any code blocks will be interpreted by the regexp compiler
rather than the lexer. This restores behaviour similar to 5.14 and
earlier, except that the (?{}) is *completely* uninterpreted by the lexer,
whereas 5.14 would skip  till matching {}.
fix the descriptions for pregcomp/re_compile

Some while ago most of the body of Perl_pregcomp was extracted out into
a new sub, Perl_re_compile, but the comments describing the function stayed
with pregcomp. Move them down to re_compile, since they mostly apply to
that sub now.
re_eval and closures: add lots of TODO tests

re_evals currently almost always do the wrong thing as regards what
lexical variable they refer to. This commit adds lots of TODO tests that
show what behaviour I think there should be. Note that because hardly any
of these tests pass yet, I haven't been able to verify whether they have
any subtle typos etc.

The basic philosophy behind these tests is:

* literal code is compiled once at compile-time and shares the same
  lexical environment as its surroundings; i.e.

    /A(?{..$x..})B/

  is like

    /A/ && do {..$x..} && /B/

* qr is treated as a closure: compiling once, but capturing its
  environment anew each time it is instantiated; i.e.

    for my $x (...) { push @r, qr/A(?{..$x..}B)/ }

  is like

    for my $x (...) { push @r, sub { /A/ && do {..$x..} && /B/ } }

* run-time code is recompiled each time the regex is compiled; literal
  code in the same expression isn't recompiled; i.e.

    $code = '(?{ BEGIN{$y++} })';
    for (1..3) { /(?{ BEGIN{$x++}})$code/ }
    # x==1, y==3

* an embedded qr is not stringified, so the qr retains its original
  lexical environment; i.e.

  $x = 1;
  { my $x = 2: $r = qr/(??{$x})/ }
  /A$r/; # matches A2, not A1
add Perl_current_re_engine() function

Abstract out into a separate function the task of finding the current
in-scope regex engine ($^H{regex}). Currently this task is only done in
one place each for compile- and run-time, but shortly we'll need it in
other places too.