| 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 |
▶ | if(!lhs || lhs->op_type != OP_HELEM) |
Branch: 2 branches
| Branch | True | False | Total |
| if(!lhs || lhs->op_type != OP_HELEM) |
0 |
0 |
0 |
| if(!lhs || lhs->op_type != OP_HELEM) |
0 |
0 |
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 |
|
| .new_op = &new_op_existsor, |
| 27 |
|
| }; |
| 28 |
|
| |
| 29 |
|
| static const struct XSParseInfixHooks hooks_existsor = { |
| 30 |
|
| .cls = XPI_CLS_LOGICAL_OR_MISC, |
| 31 |
|
| .new_op = &new_op_existsor, |
| 32 |
|
| }; |
| 33 |
|
| |
| 34 |
|
| MODULE = Syntax::Operator::ExistsOr PACKAGE = Syntax::Operator::ExistsOr |
| 35 |
|
| |
| 36 |
|
| BOOT: |
| 37 |
1 |
| boot_xs_parse_infix(0.44); |
| 38 |
|
| |
| 39 |
1 |
| register_xs_parse_infix("Syntax::Operator::ExistsOr::existsor", &hooks_existsor_low, NULL); |
| 40 |
1 |
| register_xs_parse_infix("Syntax::Operator::ExistsOr::\\\\", &hooks_existsor, NULL); |