Debian Codegraph @

t/build.xs

raw
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 -- [email protected]
5 */
6
7 #include "EXTERN.h"
8 #include "perl.h"
9 #include "XSUB.h"
10
11 #include "XSParseKeyword.h"
12
13 static int build(pTHX_ OP **out, XSParseKeywordPiece *args[], size_t nargs, void *hookdata)
14 {
15 /* concat the exprs together */
16 *out = newBINOP(OP_CONCAT, 0,
17 newBINOP(OP_CONCAT, 0, args[0]->op, newSVOP(OP_CONST, 0, newSVpvs("|"))),
18 args[1]->op);
19
20 return KEYWORD_PLUGIN_EXPR;
21 }
22
23 static const struct XSParseKeywordHooks hooks_build = {
24 .permit_hintkey = "t::build/permit",
25
26 .pieces = (const struct XSParseKeywordPieceType []){
27 XPK_BLOCK,
28 XPK_TERMEXPR,
29 {0}
30 },
31 .build = &build,
32 };
33
34 MODULE = t::build PACKAGE = t::build
35
36 BOOT:
37 boot_xs_parse_keyword(0);
38
39 register_xs_parse_keyword("build", &hooks_build, NULL);