summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorGerard Goossen <gerard@tty.nl>2008-01-17 19:36:52 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-01-28 13:32:40 +0000
commit704d42154dde262d860a2d38dee033b3ee03f906 (patch)
tree0cffb35af727292e646a75c615bbe327a9a84242 /toke.c
parent0a0ffbced76eaafcaebd51ddc09366bc6ba04e9e (diff)
downloadperl-704d42154dde262d860a2d38dee033b3ee03f906.tar.gz
also report forced tokens when using -DT
Message-ID: <20080117173652.GB4969@ostwald> p4raw-id: //depot/perl@33089
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/toke.c b/toke.c
index 32ef3e5f5e..afcc1ddcca 100644
--- a/toke.c
+++ b/toke.c
@@ -227,7 +227,7 @@ static const char* const lex_state_names[] = {
*/
#ifdef DEBUGGING /* Serve -DT. */
-# define REPORT(retval) tokereport((I32)retval)
+# define REPORT(retval) tokereport((I32)retval, &pl_yylval)
#else
# define REPORT(retval) (retval)
#endif
@@ -374,7 +374,7 @@ static struct debug_tokens {
/* dump the returned token in rv, plus any optional arg in pl_yylval */
STATIC int
-S_tokereport(pTHX_ I32 rv)
+S_tokereport(pTHX_ I32 rv, const YYSTYPE* lvalp)
{
dVAR;
if (DEBUG_T_TEST) {
@@ -403,22 +403,22 @@ S_tokereport(pTHX_ I32 rv)
case TOKENTYPE_GVVAL: /* doesn't appear to be used */
break;
case TOKENTYPE_IVAL:
- Perl_sv_catpvf(aTHX_ report, "(ival=%"IVdf")", (IV)pl_yylval.ival);
+ Perl_sv_catpvf(aTHX_ report, "(ival=%"IVdf")", (IV)lvalp->ival);
break;
case TOKENTYPE_OPNUM:
Perl_sv_catpvf(aTHX_ report, "(ival=op_%s)",
- PL_op_name[pl_yylval.ival]);
+ PL_op_name[lvalp->ival]);
break;
case TOKENTYPE_PVAL:
- Perl_sv_catpvf(aTHX_ report, "(pval=\"%s\")", pl_yylval.pval);
+ Perl_sv_catpvf(aTHX_ report, "(pval=\"%s\")", lvalp->pval);
break;
case TOKENTYPE_OPVAL:
- if (pl_yylval.opval) {
+ if (lvalp->opval) {
Perl_sv_catpvf(aTHX_ report, "(opval=op_%s)",
- PL_op_name[pl_yylval.opval->op_type]);
- if (pl_yylval.opval->op_type == OP_CONST) {
+ PL_op_name[lvalp->opval->op_type]);
+ if (lvalp->opval->op_type == OP_CONST) {
Perl_sv_catpvf(aTHX_ report, " %s",
- SvPEEK(cSVOPx_sv(pl_yylval.opval)));
+ SvPEEK(cSVOPx_sv(lvalp->opval)));
}
}
@@ -1321,6 +1321,12 @@ STATIC void
S_force_next(pTHX_ I32 type)
{
dVAR;
+#ifdef DEBUGGING
+ if (DEBUG_T_TEST) {
+ PerlIO_printf(Perl_debug_log, "### forced token:\n");
+ tokereport(THING, &NEXTVAL_NEXTTOKE);
+ }
+#endif
#ifdef PERL_MAD
if (PL_curforce < 0)
start_force(PL_lasttoke);