Skip to content

Commit

Permalink
patch to fix parser bug in C<${h{${a[0]}}} = 13>
Browse files Browse the repository at this point in the history
	Message-Id: <199912072039.MAA13257@kiev.wall.org>
	Subject: Re: [ID 19991204.002] Inconsistency of ${hash{key}}

p4raw-id: //depot/perl@4668
  • Loading branch information
TimToady authored and Gurusamy Sarathy committed Dec 8, 1999
1 parent 6c79d5f commit 9059aa1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
4 changes: 0 additions & 4 deletions embedvar.h
Expand Up @@ -282,7 +282,6 @@
#define PL_lex_defer (PERL_GET_INTERP->Ilex_defer)
#define PL_lex_dojoin (PERL_GET_INTERP->Ilex_dojoin)
#define PL_lex_expect (PERL_GET_INTERP->Ilex_expect)
#define PL_lex_fakebrack (PERL_GET_INTERP->Ilex_fakebrack)
#define PL_lex_formbrack (PERL_GET_INTERP->Ilex_formbrack)
#define PL_lex_inpat (PERL_GET_INTERP->Ilex_inpat)
#define PL_lex_inwhat (PERL_GET_INTERP->Ilex_inwhat)
Expand Down Expand Up @@ -548,7 +547,6 @@
#define PL_lex_defer (vTHX->Ilex_defer)
#define PL_lex_dojoin (vTHX->Ilex_dojoin)
#define PL_lex_expect (vTHX->Ilex_expect)
#define PL_lex_fakebrack (vTHX->Ilex_fakebrack)
#define PL_lex_formbrack (vTHX->Ilex_formbrack)
#define PL_lex_inpat (vTHX->Ilex_inpat)
#define PL_lex_inwhat (vTHX->Ilex_inwhat)
Expand Down Expand Up @@ -951,7 +949,6 @@
#define PL_lex_defer (aTHXo->interp.Ilex_defer)
#define PL_lex_dojoin (aTHXo->interp.Ilex_dojoin)
#define PL_lex_expect (aTHXo->interp.Ilex_expect)
#define PL_lex_fakebrack (aTHXo->interp.Ilex_fakebrack)
#define PL_lex_formbrack (aTHXo->interp.Ilex_formbrack)
#define PL_lex_inpat (aTHXo->interp.Ilex_inpat)
#define PL_lex_inwhat (aTHXo->interp.Ilex_inwhat)
Expand Down Expand Up @@ -1218,7 +1215,6 @@
#define PL_Ilex_defer PL_lex_defer
#define PL_Ilex_dojoin PL_lex_dojoin
#define PL_Ilex_expect PL_lex_expect
#define PL_Ilex_fakebrack PL_lex_fakebrack
#define PL_Ilex_formbrack PL_lex_formbrack
#define PL_Ilex_inpat PL_lex_inpat
#define PL_Ilex_inwhat PL_lex_inwhat
Expand Down
1 change: 0 additions & 1 deletion intrpvar.h
Expand Up @@ -237,7 +237,6 @@ PERLVAR(Ilex_defer, U32) /* state after determined token */
PERLVAR(Ilex_expect, expectation) /* expect after determined token */
PERLVAR(Ilex_brackets, I32) /* bracket count */
PERLVAR(Ilex_formbrack, I32) /* bracket count at outer format level */
PERLVAR(Ilex_fakebrack, I32) /* outer bracket is mere delimiter */
PERLVAR(Ilex_casemods, I32) /* casemod count */
PERLVAR(Ilex_dojoin, I32) /* doing an array interpolation */
PERLVAR(Ilex_starts, I32) /* how many interps done on level */
Expand Down
2 changes: 0 additions & 2 deletions objXSUB.h
Expand Up @@ -230,8 +230,6 @@
#define PL_lex_dojoin (*Perl_Ilex_dojoin_ptr(aTHXo))
#undef PL_lex_expect
#define PL_lex_expect (*Perl_Ilex_expect_ptr(aTHXo))
#undef PL_lex_fakebrack
#define PL_lex_fakebrack (*Perl_Ilex_fakebrack_ptr(aTHXo))
#undef PL_lex_formbrack
#define PL_lex_formbrack (*Perl_Ilex_formbrack_ptr(aTHXo))
#undef PL_lex_inpat
Expand Down
1 change: 0 additions & 1 deletion sv.c
Expand Up @@ -6871,7 +6871,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_lex_defer = proto_perl->Ilex_defer;
PL_lex_expect = proto_perl->Ilex_expect;
PL_lex_formbrack = proto_perl->Ilex_formbrack;
PL_lex_fakebrack = proto_perl->Ilex_fakebrack;
PL_lex_dojoin = proto_perl->Ilex_dojoin;
PL_lex_starts = proto_perl->Ilex_starts;
PL_lex_stuff = sv_dup_inc(proto_perl->Ilex_stuff);
Expand Down
20 changes: 8 additions & 12 deletions toke.c
Expand Up @@ -29,6 +29,9 @@ static char ident_too_long[] = "Identifier too long";

static void restore_rsfp(pTHXo_ void *f);

#define XFAKEBRACK 128
#define XENUMMASK 127

#define UTF (PL_hints & HINT_UTF8)
/*
* Note: we try to be careful never to call the isXXX_utf8() functions
Expand Down Expand Up @@ -358,7 +361,6 @@ Perl_lex_start(pTHX_ SV *line)

SAVEI32(PL_lex_dojoin);
SAVEI32(PL_lex_brackets);
SAVEI32(PL_lex_fakebrack);
SAVEI32(PL_lex_casemods);
SAVEI32(PL_lex_starts);
SAVEI32(PL_lex_state);
Expand All @@ -385,7 +387,6 @@ Perl_lex_start(pTHX_ SV *line)
PL_lex_defer = 0;
PL_expect = XSTATE;
PL_lex_brackets = 0;
PL_lex_fakebrack = 0;
New(899, PL_lex_brackstack, 120, char);
New(899, PL_lex_casestack, 12, char);
SAVEFREEPV(PL_lex_brackstack);
Expand Down Expand Up @@ -961,7 +962,6 @@ S_sublex_push(pTHX)
PL_lex_state = PL_sublex_info.super_state;
SAVEI32(PL_lex_dojoin);
SAVEI32(PL_lex_brackets);
SAVEI32(PL_lex_fakebrack);
SAVEI32(PL_lex_casemods);
SAVEI32(PL_lex_starts);
SAVEI32(PL_lex_state);
Expand All @@ -986,7 +986,6 @@ S_sublex_push(pTHX)

PL_lex_dojoin = FALSE;
PL_lex_brackets = 0;
PL_lex_fakebrack = 0;
New(899, PL_lex_brackstack, 120, char);
New(899, PL_lex_casestack, 12, char);
SAVEFREEPV(PL_lex_brackstack);
Expand Down Expand Up @@ -1034,7 +1033,6 @@ S_sublex_done(pTHX)
SAVEFREESV(PL_linestr);
PL_lex_dojoin = FALSE;
PL_lex_brackets = 0;
PL_lex_fakebrack = 0;
PL_lex_casemods = 0;
*PL_lex_casestack = '\0';
PL_lex_starts = 0;
Expand Down Expand Up @@ -2976,7 +2974,8 @@ Perl_yylex(pTHX)
PL_lex_formbrack = 0;
if (PL_lex_state == LEX_INTERPNORMAL) {
if (PL_lex_brackets == 0) {
if (PL_lex_fakebrack) {
if (PL_expect & XFAKEBRACK) {
PL_expect &= XENUMMASK;
PL_lex_state = LEX_INTERPEND;
PL_bufptr = s;
return yylex(); /* ignore fake brackets */
Expand All @@ -2987,9 +2986,9 @@ Perl_yylex(pTHX)
PL_lex_state = LEX_INTERPEND;
}
}
if (PL_lex_brackets < PL_lex_fakebrack) {
if (PL_expect & XFAKEBRACK) {
PL_expect &= XENUMMASK;
PL_bufptr = s;
PL_lex_fakebrack = 0;
return yylex(); /* ignore fake brackets */
}
force_next('}');
Expand Down Expand Up @@ -5603,8 +5602,6 @@ S_scan_ident(pTHX_ register char *s, register char *send, char *dest, STRLEN des
char *bracket = 0;
char funny = *s++;

if (PL_lex_brackets == 0)
PL_lex_fakebrack = 0;
if (isSPACE(*s))
s = skipspace(s);
d = dest;
Expand Down Expand Up @@ -5709,9 +5706,8 @@ S_scan_ident(pTHX_ register char *s, register char *send, char *dest, STRLEN des
"Ambiguous use of %c{%s%s} resolved to %c%s%s",
funny, dest, brack, funny, dest, brack);
}
PL_lex_fakebrack = PL_lex_brackets+1;
bracket++;
PL_lex_brackstack[PL_lex_brackets++] = XOPERATOR;
PL_lex_brackstack[PL_lex_brackets++] = XOPERATOR | XFAKEBRACK;
return s;
}
}
Expand Down

0 comments on commit 9059aa1

Please sign in to comment.