File Coverage

lib/Syntax/Operator/ExistsOr.xs
Criterion Covered Total %
statement 1 6 16.6
branch 0 4 0.0
condition n/a
subroutine n/a
pod n/a
total 1 10 10.0


line stmt bran cond sub pod time code
1             /* You may distribute under the terms of either the GNU General Public License
2             * or the Artistic License (the same terms as Perl itself)
3             *
4             * (C) Paul Evans, 2021-2023 -- leonerd@leonerd.org.uk
5             */
6             #include "EXTERN.h"
7             #include "perl.h"
8             #include "XSUB.h"
9              
10             #include "XSParseInfix.h"
11              
12             #include "perl-backcompat.c.inc"
13             #include "newOP_CUSTOM.c.inc"
14             #include "OP_HELEMEXISTSOR.c.inc"
15              
16 0           static OP *new_op_existsor(pTHX_ U32 flags, OP *lhs, OP *rhs, SV **parsedata, void *hookdata)
17             {
18 0 0         if(!lhs || lhs->op_type != OP_HELEM)
    0          
19 0           croak("Left operand of existsor must be a hash element access");
20              
21 0           op_contextualize(newHELEMEXISTSOROP(0, lhs, rhs), G_SCALAR);
22 0           }
23              
24             static const struct XSParseInfixHooks hooks_existsor_low = {
25             .cls = XPI_CLS_LOGICAL_OR_LOW_MISC,
26             .permit_hintkey = "Syntax::Operator::ExistsOr/existsor",
27             .new_op = &new_op_existsor,
28             };
29              
30             static const struct XSParseInfixHooks hooks_existsor = {
31             .cls = XPI_CLS_LOGICAL_OR_MISC,
32             .permit_hintkey = "Syntax::Operator::ExistsOr/existsor",
33             .new_op = &new_op_existsor,
34             };
35              
36             MODULE = Syntax::Operator::ExistsOr PACKAGE = Syntax::Operator::ExistsOr
37              
38             BOOT:
39 3           boot_xs_parse_infix(0.26);
40              
41             register_xs_parse_infix("existsor", &hooks_existsor_low, NULL);
42             register_xs_parse_infix("\\\\", &hooks_existsor, NULL);