diff options
author | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2021-01-22 17:57:08 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> | 2021-02-04 14:20:53 +0000 |
commit | a1325b902d57aa7a99bed3d2ec0fa5ce42836207 (patch) | |
tree | 37ce967cbad3faa9d65d10d33aab6919ec353616 /regen | |
parent | 99dbf64538ee1c097b9f7e93df5a45dbf1fa3e22 (diff) | |
download | perl-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-x | regen/feature.pl | 11 | ||||
-rwxr-xr-x | regen/keywords.pl | 4 | ||||
-rw-r--r-- | regen/opcodes | 2 | ||||
-rw-r--r-- | regen/warnings.pl | 2 |
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], |