| 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 -- leonerd@leonerd.org.uk |
| 5 |
|
| */ |
| 6 |
|
| |
| 7 |
|
| #include "EXTERN.h" |
| 8 |
|
| #include "perl.h" |
| 9 |
|
| #include "XSUB.h" |
| 10 |
|
| |
| 11 |
|
| #include "XSParseSublike.h" |
| 12 |
|
| |
| 13 |
3 |
| static void action_pre_subparse(pTHX_ struct XSParseSublikeContext *ctx, void *_) |
| 14 |
|
| { |
| 15 |
3 |
| const char *namestr = SvPVX(ctx->name); |
| 16 |
|
| |
| 17 |
3 |
▶ | if(strchr(namestr, 'i')) |
Branch: 1 branch
| Branch | True | False | Total |
| if(strchr(namestr, 'i')) |
1 |
2 |
3 |
|
| 18 |
1 |
| ctx->actions &= ~XS_PARSE_SUBLIKE_ACTION_INSTALL_SYMBOL; |
| 19 |
3 |
▶ | if(strchr(namestr, 'R')) |
Branch: 1 branch
| Branch | True | False | Total |
| if(strchr(namestr, 'R')) |
2 |
1 |
3 |
|
| 20 |
2 |
| ctx->actions |= XS_PARSE_SUBLIKE_ACTION_REFGEN_ANONCODE; |
| 21 |
3 |
▶ | if(strchr(namestr, 'E')) |
Branch: 1 branch
| Branch | True | False | Total |
| if(strchr(namestr, 'E')) |
2 |
1 |
3 |
|
| 22 |
2 |
| ctx->actions |= XS_PARSE_SUBLIKE_ACTION_RET_EXPR; |
| 23 |
3 |
| } |
| 24 |
|
| |
| 25 |
|
| static const struct XSParseSublikeHooks parse_action_hooks = { |
| 26 |
|
| .ver = XSPARSESUBLIKE_ABI_VERSION, |
| 27 |
|
| .permit_hintkey = "t::actions/action", |
| 28 |
|
| .flags = XS_PARSE_SUBLIKE_COMPAT_FLAG_DYNAMIC_ACTIONS, |
| 29 |
|
| .require_parts = XS_PARSE_SUBLIKE_PART_NAME, |
| 30 |
|
| |
| 31 |
|
| .pre_subparse = action_pre_subparse, |
| 32 |
|
| }; |
| 33 |
|
| |
| 34 |
|
| MODULE = t::actions PACKAGE = t::actions |
| 35 |
|
| |
| 36 |
|
| BOOT: |
| 37 |
1 |
| boot_xs_parse_sublike(0); |
| 38 |
|
| |
| 39 |
1 |
| register_xs_parse_sublike("action", &parse_action_hooks, NULL); |