summaryrefslogtreecommitdiffstats
path: root/Keyword.xs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-07-22 19:43:51 -0400
committerJesse Luehrs <doy@tozt.net>2013-07-22 19:48:11 -0400
commit40ecb271cd82f320753f4593b8e902b1a6a4b2ed (patch)
tree63f93194d54bd08b47fbffec5adfb988d0a35d31 /Keyword.xs
parent2888936658f395416cb183aa8a5f24e6e3ea585c (diff)
downloadparse-keyword-40ecb271cd82f320753f4593b8e902b1a6a4b2ed.tar.gz
parse-keyword-40ecb271cd82f320753f4593b8e902b1a6a4b2ed.zip
allow creating non-anonymous subs too
this makes a difference in some obscure cases dealing with closures. see t/unavailable.t for more information.
Diffstat (limited to 'Keyword.xs')
-rw-r--r--Keyword.xs44
1 files changed, 26 insertions, 18 deletions
diff --git a/Keyword.xs b/Keyword.xs
index eaaa9dd..9a6d28d 100644
--- a/Keyword.xs
+++ b/Keyword.xs
@@ -15,14 +15,14 @@
#define LEAVE_PARSER LEAVE
-static SV *parser_fn(OP *(fn)(U32))
+static SV *parser_fn(OP *(fn)(U32), bool named)
{
I32 floor;
CV *code;
REENTER_PARSER;
- floor = start_subparse(0, CVf_ANON);
+ floor = start_subparse(0, named ? 0 : CVf_ANON);
code = newATTRSUB(floor, NULL, NULL, NULL, fn(0));
LEAVE_PARSER;
@@ -143,58 +143,66 @@ lex_stuff(str)
lex_stuff_sv(str, 0);
SV *
-parse_block()
+parse_block(named = false)
+ bool named
CODE:
- RETVAL = parser_fn(Perl_parse_block);
+ RETVAL = parser_fn(Perl_parse_block, named);
OUTPUT:
RETVAL
SV *
-parse_stmtseq()
+parse_stmtseq(named = false)
+ bool named
CODE:
- RETVAL = parser_fn(Perl_parse_stmtseq);
+ RETVAL = parser_fn(Perl_parse_stmtseq, named);
OUTPUT:
RETVAL
SV *
-parse_fullstmt()
+parse_fullstmt(named = false)
+ bool named
CODE:
- RETVAL = parser_fn(Perl_parse_fullstmt);
+ RETVAL = parser_fn(Perl_parse_fullstmt, named);
OUTPUT:
RETVAL
SV *
-parse_barestmt()
+parse_barestmt(named = false)
+ bool named
CODE:
- RETVAL = parser_fn(Perl_parse_barestmt);
+ RETVAL = parser_fn(Perl_parse_barestmt, named);
OUTPUT:
RETVAL
SV *
-parse_fullexpr()
+parse_fullexpr(named = false)
+ bool named
CODE:
- RETVAL = parser_fn(Perl_parse_fullexpr);
+ RETVAL = parser_fn(Perl_parse_fullexpr, named);
OUTPUT:
RETVAL
SV *
-parse_listexpr()
+parse_listexpr(named = false)
+ bool named
CODE:
- RETVAL = parser_fn(Perl_parse_listexpr);
+ RETVAL = parser_fn(Perl_parse_listexpr, named);
OUTPUT:
RETVAL
SV *
-parse_termexpr()
+parse_termexpr(named = false)
+ bool named
CODE:
- RETVAL = parser_fn(Perl_parse_termexpr);
+ RETVAL = parser_fn(Perl_parse_termexpr, named);
OUTPUT:
RETVAL
SV *
-parse_arithexpr()
+parse_arithexpr(named = false)
+ bool named
CODE:
- RETVAL = parser_fn(Perl_parse_arithexpr);
+ RETVAL = parser_fn(Perl_parse_arithexpr, named);
OUTPUT:
RETVAL