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, 2016-2021 -- leonerd@leonerd.org.uk
5             */
6             #include "EXTERN.h"
7             #include "perl.h"
8             #include "XSUB.h"
9              
10             #include "XSParseInfix.h"
11              
12             #define HAVE_PERL_VERSION(R, V, S) \
13             (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
14              
15             #include "newOP_CUSTOM.c.inc"
16             #include "OP_HELEMEXISTSOR.c.inc"
17              
18 0           static OP *new_op_existsor(pTHX_ U32 flags, OP *lhs, OP *rhs, SV **parsedata, void *hookdata)
19             {
20 0 0         if(!lhs || lhs->op_type != OP_HELEM)
    0          
21 0           croak("Left operand of existsor must be a hash element access");
22              
23 0           op_contextualize(newHELEMEXISTSOROP(0, lhs, rhs), G_SCALAR);
24 0           }
25              
26             static const struct XSParseInfixHooks hooks_existsor_low = {
27             .cls = XPI_CLS_LOGICAL_OR_LOW_MISC,
28             .permit_hintkey = "Syntax::Operator::ExistsOr/existsor",
29             .new_op = &new_op_existsor,
30             };
31              
32             static const struct XSParseInfixHooks hooks_existsor = {
33             .cls = XPI_CLS_LOGICAL_OR_MISC,
34             .permit_hintkey = "Syntax::Operator::ExistsOr/existsor",
35             .new_op = &new_op_existsor,
36             };
37              
38             MODULE = Syntax::Operator::ExistsOr PACKAGE = Syntax::Operator::ExistsOr
39              
40             BOOT:
41 3           boot_xs_parse_infix(0.26);
42              
43             register_xs_parse_infix("existsor", &hooks_existsor_low, NULL);
44             register_xs_parse_infix("\\\\", &hooks_existsor, NULL);