| 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_line(pTHX_ OP **out, XSParseKeywordPiece *args[], size_t nargs, void *hookdata) |
| 14 |
{ |
| 15 |
*out = newSVOP(OP_CONST, 0, newSViv(args[0]->line)); |
| 16 |
return KEYWORD_PLUGIN_EXPR; |
| 17 |
} |
| 18 |
|
| 19 |
static const struct XSParseKeywordHooks hooks_line = { |
| 20 |
.permit_hintkey = "t::line/permit", |
| 21 |
|
| 22 |
.pieces = (const struct XSParseKeywordPieceType []){ |
| 23 |
XPK_IDENT, |
| 24 |
{0} |
| 25 |
}, |
| 26 |
.build = &build_line, |
| 27 |
}; |
| 28 |
|
| 29 |
MODULE = t::line PACKAGE = t::line |
| 30 |
|
| 31 |
BOOT: |
| 32 |
boot_xs_parse_keyword(0); |
| 33 |
|
| 34 |
register_xs_parse_keyword("line", &hooks_line, NULL); |