summaryrefslogtreecommitdiff
path: root/embed.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-01-28 15:14:57 +0000
committerDavid Mitchell <davem@iabyn.com>2016-08-03 20:54:40 +0100
commitd3d9da4a748f12980e8b04fe471398bf91237705 (patch)
tree0ad8bbe844a4d0c4de002a3481f2b1d6cb167ee6 /embed.h
parentd64e121b07bda895f7f3a5d0e449fc948986e2f1 (diff)
downloadperl-d3d9da4a748f12980e8b04fe471398bf91237705.tar.gz
sub signatures: use parser rather than lexer
Currently the signature of a sub (i.e. the '($a, $b = 1)' bit) is parsed in toke.c using a roll-your-own mini-parser. This commit makes the signature be part of the general grammar in perly.y instead. In theory it should still generate the same optree as before, except that an OP_STUB is no longer appended to each signature optree: it's unnecessary, and I assume that was a hangover from early development of the original signature code. Error messages have changed somewhat: the generic 'Parse error' has changed to the generic 'syntax error', with the addition of ', near "xyz"' now appended to each message. Also, some specific error messages have been added; for example (@a=1) now says that slurpy params can't have a default vale, rather than just giving 'Parse error'. It introduces a new lexer expect state, XSIGVAR, since otherwise when the lexer saw something like '($, ...)' it would see the identifier '$,' rather than the tokens '$' and ','. Since it no longer uses parse_termexpr(), it is no longer subject to the bug (#123010) associated with that; so sub f($x = print, $y) {} is no longer mis-interpreted as sub f($x = print($_, $y)) {}
Diffstat (limited to 'embed.h')
-rw-r--r--embed.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/embed.h b/embed.h
index efee6e978c..8cdb625bbf 100644
--- a/embed.h
+++ b/embed.h
@@ -1338,7 +1338,6 @@
#define pad_push(a,b) Perl_pad_push(aTHX_ a,b)
#define pad_swipe(a,b) Perl_pad_swipe(aTHX_ a,b)
#define padlist_store(a,b,c) Perl_padlist_store(aTHX_ a,b,c)
-#define parse_subsignature() Perl_parse_subsignature(aTHX)
#define parse_unicode_opts(a) Perl_parse_unicode_opts(aTHX_ a)
#define parser_free(a) Perl_parser_free(aTHX_ a)
#define peep(a) Perl_peep(aTHX_ a)