diff options
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -285,8 +285,8 @@ static const char* const lex_state_names[] = { } #define UNI(f) UNI2(f,XTERM) #define UNIDOR(f) UNI2(f,XTERMORDORDOR) -#define UNIPROTO(f) { \ - PL_last_uni = PL_oldbufptr; \ +#define UNIPROTO(f,optional) { \ + if (optional) PL_last_uni = PL_oldbufptr; \ OPERATOR(f); \ } @@ -6851,10 +6851,13 @@ Perl_yylex(pTHX) { STRLEN protolen = CvPROTOLEN(cv); const char *proto = CvPROTO(cv); + bool optional; if (!protolen) TERM(FUNC0SUB); - while (*proto == ';') + if ((optional = *proto == ';')) + do proto++; + while (*proto == ';'); if ( ( ( @@ -6867,12 +6870,13 @@ Perl_yylex(pTHX) *proto == '\\' && proto[1] && proto[2] == '\0' ) ) - UNIPROTO(UNIOPSUB); + UNIPROTO(UNIOPSUB,optional); if (*proto == '\\' && proto[1] == '[') { const char *p = proto + 2; while(*p && *p != ']') ++p; - if(*p == ']' && !p[1]) UNIPROTO(UNIOPSUB); + if(*p == ']' && !p[1]) + UNIPROTO(UNIOPSUB,optional); } if (*proto == '&' && *s == '{') { if (PL_curstash) |