summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-01-22 17:57:08 +0000
committerPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2021-02-04 14:20:53 +0000
commita1325b902d57aa7a99bed3d2ec0fa5ce42836207 (patch)
tree37ce967cbad3faa9d65d10d33aab6919ec353616 /regen
parent99dbf64538ee1c097b9f7e93df5a45dbf1fa3e22 (diff)
downloadperl-a1325b902d57aa7a99bed3d2ec0fa5ce42836207.tar.gz
Initial attempt at feature 'try'
* Add feature, experimental warning, keyword * Basic parsing * Basic implementation as optree fragment See also https://github.com/Perl/perl5/issues/18504
Diffstat (limited to 'regen')
-rwxr-xr-xregen/feature.pl11
-rwxr-xr-xregen/keywords.pl4
-rw-r--r--regen/opcodes2
-rw-r--r--regen/warnings.pl2
4 files changed, 18 insertions, 1 deletions
diff --git a/regen/feature.pl b/regen/feature.pl
index e626ca9fee..ffe3fee994 100755
--- a/regen/feature.pl
+++ b/regen/feature.pl
@@ -40,6 +40,7 @@ my %feature = (
indirect => 'indirect',
multidimensional => 'multidimensional',
bareword_filehandles => 'bareword_filehandles',
+ try => 'try',
);
# NOTE: If a feature is ever enabled in a non-contiguous range of Perl
@@ -477,7 +478,7 @@ read_only_bottom_close_and_rename($h);
__END__
package feature;
-our $VERSION = '1.62';
+our $VERSION = '1.63';
FEATURES
@@ -815,6 +816,14 @@ previous versions it was simply on all the time.
You can use the L<bareword::filehandles> module on CPAN to disable
bareword filehandles for older versions of perl.
+=head2 The 'try' feature.
+
+This feature enables the C<try> and C<catch> syntax, which allows exception
+handling, where exceptions throwin from the body of the block introduced with
+C<try> are caught by executing the body of the C<catch> block.
+
+For more information, see L<perlsyn/"Try Catch Exception Handling">.
+
=head1 FEATURE BUNDLES
It's possible to load multiple features together, using
diff --git a/regen/keywords.pl b/regen/keywords.pl
index b9ae8cf0f2..77f8aa9d93 100755
--- a/regen/keywords.pl
+++ b/regen/keywords.pl
@@ -47,6 +47,8 @@ my %feature_kw = (
__SUB__ => '__SUB__',
fc => 'fc',
isa => 'isa',
+ try => 'try',
+ catch => 'try',
);
my %pos = map { ($_ => 1) } @{$by_strength{'+'}};
@@ -132,6 +134,7 @@ __END__
-bless
-break
-caller
++catch
-chdir
-chmod
-chomp
@@ -339,6 +342,7 @@ __END__
-time
-times
+tr
++try
-truncate
-uc
-ucfirst
diff --git a/regen/opcodes b/regen/opcodes
index 4d5ba36d78..2a2da77c5c 100644
--- a/regen/opcodes
+++ b/regen/opcodes
@@ -577,3 +577,5 @@ isa derived class test ck_isa s2
cmpchain_and comparison chaining ck_null |
cmpchain_dup comparand shuffling ck_null 1
+
+catch catch {} block ck_null |
diff --git a/regen/warnings.pl b/regen/warnings.pl
index f08d2d6379..c4d6b4e7b9 100644
--- a/regen/warnings.pl
+++ b/regen/warnings.pl
@@ -119,6 +119,8 @@ my $tree = {
[ 5.029, DEFAULT_ON ],
'experimental::isa' =>
[ 5.031, DEFAULT_ON ],
+ 'experimental::try' =>
+ [ 5.033, DEFAULT_ON ],
}],
'missing' => [ 5.021, DEFAULT_OFF],