diff options
author | Branislav ZahradnĂk <barney@cpan.org> | 2020-12-11 17:19:14 +0100 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-12-27 09:46:09 -0700 |
commit | 9086c946d76e67c28eff104482c6bc204f32ff68 (patch) | |
tree | 432a02e1c006d9772979a42570262bbc36e472bd /toke.c | |
parent | 5776f3e52dc3d9bddaadfc7c058c4e18589018b3 (diff) | |
download | perl-9086c946d76e67c28eff104482c6bc204f32ff68.tar.gz |
Distinguish C- and perly- literals - PERLY_SNAIL
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -400,6 +400,7 @@ static struct debug_tokens { DEBUG_TOKEN (IVAL, PERLY_PLUS), DEBUG_TOKEN (IVAL, PERLY_QUESTION_MARK), DEBUG_TOKEN (IVAL, PERLY_SEMICOLON), + DEBUG_TOKEN (IVAL, PERLY_SNAIL), DEBUG_TOKEN (IVAL, PERLY_TILDE), { PLUGEXPR, TOKENTYPE_OPVAL, "PLUGEXPR" }, { PLUGSTMT, TOKENTYPE_OPVAL, "PLUGSTMT" }, @@ -2047,20 +2048,24 @@ S_force_next(pTHX_ I32 type) static int S_postderef(pTHX_ int const funny, char const next) { - assert(funny == DOLSHARP || memCHRs("$@%&*", funny) || funny == PERLY_AMPERSAND); + assert(funny == DOLSHARP + || memCHRs("$@%&*", funny) + || funny == PERLY_SNAIL + || funny == PERLY_AMPERSAND + ); if (next == '*') { PL_expect = XOPERATOR; if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets) { - assert('@' == funny || '$' == funny || DOLSHARP == funny); + assert(PERLY_SNAIL == funny || '$' == funny || DOLSHARP == funny); PL_lex_state = LEX_INTERPEND; - if ('@' == funny) + if (PERLY_SNAIL == funny) force_next(POSTJOIN); } force_next(next); PL_bufptr+=2; } else { - if ('@' == funny && PL_lex_state == LEX_INTERPNORMAL + if (PERLY_SNAIL == funny && PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets) PL_lex_dojoin = 2; PL_expect = XOPERATOR; @@ -2188,7 +2193,7 @@ S_force_ident(pTHX_ const char *s, int kind) (PL_in_eval ? GV_ADDMULTI : GV_ADD) | ( UTF ? SVf_UTF8 : 0 ), kind == '$' ? SVt_PV : - kind == '@' ? SVt_PVAV : + kind == PERLY_SNAIL ? SVt_PVAV : kind == '%' ? SVt_PVHV : SVt_PVGV ); @@ -5000,6 +5005,7 @@ yyl_sigvar(pTHX_ char *s) switch (sigil) { case ',': TOKEN (PERLY_COMMA); + case '@': TOKEN (PERLY_SNAIL); default: TOKEN (sigil); } } @@ -6375,7 +6381,7 @@ static int yyl_snail(pTHX_ char *s) { if (PL_expect == XPOSTDEREF) - POSTDEREF('@'); + POSTDEREF(PERLY_SNAIL); PL_tokenbuf[0] = '@'; s = scan_ident(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE); if (PL_expect == XOPERATOR) { @@ -6388,7 +6394,7 @@ yyl_snail(pTHX_ char *s) } pl_yylval.ival = 0; if (!PL_tokenbuf[1]) { - PREREF('@'); + PREREF(PERLY_SNAIL); } if (PL_lex_state == LEX_NORMAL || PL_lex_brackets) s = skipspace(s); @@ -6407,7 +6413,7 @@ yyl_snail(pTHX_ char *s) } PL_expect = XOPERATOR; force_ident_maybe_lex('@'); - TERM('@'); + TERM(PERLY_SNAIL); } static int |