Skip to content
Open
28 changes: 14 additions & 14 deletions toke.c
Original file line number Diff line number Diff line change
Expand Up @@ -4732,7 +4732,6 @@ S_intuit_more(pTHX_ char *s, char *e,
* looks for.
*
*/
if (isWORDCHAR_lazy_if_safe(s+1, PL_bufend, UTF)) {

/* khw: where did the magic number 4 come from?. This buffer
* was 4 times as large as tokenbuf in 1997, and had not
Expand Down Expand Up @@ -4772,6 +4771,20 @@ S_intuit_more(pTHX_ char *s, char *e,
* like $subscripts{$which}. We should advance past the
* braces and key */
}
else if (len == 1) {
if ( s[0] == '$'
&& s[1]
&& memCHRs("[#!%*<>()-=", tmpbuf[1]))
{
/* Here we have what could be a punctuation variable. If the
* next character after it is a closing bracket, it makes it
* quite likely to be that, and hence a subscript. If it is
* something else, more mildly a subscript */
if (/*{*/ memCHRs("])} =", tmpbuf[2]))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accidentally deleted previous comment :(

little bit confused: this happens in branch when strlen of tmpbuf is already checked to be 1, so tmpbuf[2] should \0

weight -= 10;
else
weight -= 1;
}
else {
/* Not a multi-char identifier already known in the
* program; is somewhat likely to be a subscript.
Expand All @@ -4787,19 +4800,6 @@ S_intuit_more(pTHX_ char *s, char *e,
weight -= 10;
}
}
else if ( s[0] == '$'
&& s[1]
&& memCHRs("[#!%*<>()-=", s[1]))
{
/* Here we have what could be a punctuation variable. If the
* next character after it is a closing bracket, it makes it
* quite likely to be that, and hence a subscript. If it is
* something else, more mildly a subscript */
if (/*{*/ memCHRs("])} =", s[2]))
weight -= 10;
else
weight -= 1;
}
break;

/* khw: [:blank:] strongly indicates a charclass */
Expand Down