This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Restructure grok_bslash_[ox]
authorKarl Williamson <khw@cpan.org>
Thu, 16 Jan 2020 20:17:32 +0000 (13:17 -0700)
committerKarl Williamson <khw@cpan.org>
Thu, 23 Jan 2020 22:46:56 +0000 (15:46 -0700)
commit8d1e72f0f234299a86ddd5ce728d7cff6b44a547
tree477d458f1df8f1dd50551ced45ac7de81fd7368b
parent73351a7160e044aa54e64f7da1c78c3401a64c7b
Restructure grok_bslash_[ox]

This commit causes these functions to allow a caller to request any
messages generated to be returned to the caller, instead of always being
handled within these functions.  The messages are somewhat changed from
previously to be clearer.  I did not find any code in CPAN that relied
on the previous message text.

Like the previous commit for grok_bslash_c, here are two reasons to do
this, repeated here.

1) In pattern compilation this brings these messages into conformity
   with the other ones that get generated in pattern compilation, where
   there is a particular syntax, including marking the exact position in
   the parse  where the problem occurred.

2) These could generate truncated messages due to the (mostly)
   single-pass nature of pattern compilation that is now in effect.  It
   keeps track of where during a parse a message has been output, and
   won't output it again if a second parsing pass turns out to be
   necessary.  Prior to this commit, it had to assume that a message
   from one of these functions did get output, and this caused some
   out-of-bounds reads when a subparse (using a constructed pattern) was
   executed.  The possibility of those went away in commit 5d894ca5213,
   which guarantees it won't try to read outside bounds, but that may
   still mean it is outputting text from the wrong parse, giving
   meaningless results.  This commit should stop that possibility.
12 files changed:
dquote.c
embed.fnc
embed.h
pod/perldelta.pod
pod/perldiag.pod
proto.h
regcomp.c
t/lib/warnings/regcomp
t/lib/warnings/toke
t/re/anyof.t
t/re/reg_mesg.t
toke.c