summaryrefslogtreecommitdiff
path: root/cop.h
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 /cop.h
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 'cop.h')
-rw-r--r--cop.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/cop.h b/cop.h
index 7a7e831c6a..7b8a14f0c8 100644
--- a/cop.h
+++ b/cop.h
@@ -940,7 +940,7 @@ struct context {
or plain block { ...; } */
#define CXt_SUB 9
#define CXt_FORMAT 10
-#define CXt_EVAL 11
+#define CXt_EVAL 11 /* eval'', eval{}, try{} */
#define CXt_SUBST 12
/* SUBST doesn't feature in all switch statements. */
@@ -954,6 +954,7 @@ struct context {
/* private flags for CXt_EVAL */
#define CXp_REAL 0x20 /* truly eval'', not a lookalike */
#define CXp_EVALBLOCK 0x40 /* eval{}, not eval'' or similar */
+#define CXp_TRY 0x80 /* try {} block */
/* private flags for CXt_LOOP */
@@ -977,6 +978,8 @@ struct context {
== (CXt_EVAL|CXp_REAL))
#define CxEVALBLOCK(c) (((c)->cx_type & (CXTYPEMASK|CXp_EVALBLOCK)) \
== (CXt_EVAL|CXp_EVALBLOCK))
+#define CxTRY(c) (((c)->cx_type & (CXTYPEMASK|CXp_TRY)) \
+ == (CXt_EVAL|CXp_TRY))
#define CxFOREACH(c) ( CxTYPE(cx) >= CXt_LOOP_ARY \
&& CxTYPE(cx) <= CXt_LOOP_LIST)