@@ -5381,150 +5381,150 @@ yyl_dollar(pTHX_ char *s)
53815381 PREREF (PERLY_DOLLAR );
53825382 }
53835383
5384- {
5385- const char tmp = * s ;
5386- if (PL_lex_state == LEX_NORMAL || PL_lex_brackets )
5387- s = skipspace (s );
5384+ const char tmp = * s ;
5385+ if (PL_lex_state == LEX_NORMAL || PL_lex_brackets )
5386+ s = skipspace (s );
53885387
5389- if ( (PL_expect != XREF || PL_oldoldbufptr == PL_last_lop )
5390- && intuit_more (s , PL_bufend )) {
5391- if (* s == '[' ) {
5392- PL_tokenbuf [0 ] = '@' ;
5393- if (ckWARN (WARN_SYNTAX )) {
5394- char * t = s + 1 ;
5395-
5396- while ( t < PL_bufend ) {
5397- if (isSPACE (* t )) {
5398- do { t ++ ; } while (t < PL_bufend && isSPACE (* t ));
5399- /* consumed one or more space chars */
5400- } else if (* t == '$' || * t == '@' ) {
5401- /* could be more than one '$' like $$ref or @$ref */
5402- do { t ++ ; } while (t < PL_bufend && * t == '$' );
5403-
5404- /* could be an abigail style identifier like $ foo */
5405- while (t < PL_bufend && * t == ' ' ) t ++ ;
5406-
5407- /* strip off the name of the var */
5408- Size_t advance ;
5409- while ((advance = (isWORDCHAR_lazy_if_safe (t ,
5410- PL_bufend ,
5411- UTF ))))
5412- t += advance ;
5413- /* consumed a varname */
5414- } else if (isDIGIT (* t )) {
5415- /* deal with hex constants like 0x11 */
5416- if (t [0 ] == '0' && t [1 ] == 'x' ) {
5417- t += 2 ;
5418- while (t < PL_bufend && isXDIGIT (* t )) t ++ ;
5419- } else {
5420- /* deal with decimal/octal constants like 1 and 0123 */
5388+ if ( (PL_expect != XREF || PL_oldoldbufptr == PL_last_lop )
5389+ && intuit_more (s , PL_bufend )) {
5390+ if (* s == '[' ) {
5391+ PL_tokenbuf [0 ] = '@' ;
5392+ if (ckWARN (WARN_SYNTAX )) {
5393+ char * t = s + 1 ;
5394+
5395+ while ( t < PL_bufend ) {
5396+ if (isSPACE (* t )) {
5397+ do { t ++ ; } while (t < PL_bufend && isSPACE (* t ));
5398+ /* consumed one or more space chars */
5399+ } else if (* t == '$' || * t == '@' ) {
5400+ /* could be more than one '$' like $$ref or @$ref */
5401+ do { t ++ ; } while (t < PL_bufend && * t == '$' );
5402+
5403+ /* could be an abigail style identifier like $ foo */
5404+ while (t < PL_bufend && * t == ' ' ) t ++ ;
5405+
5406+ /* strip off the name of the var */
5407+ Size_t advance ;
5408+ while ((advance = (isWORDCHAR_lazy_if_safe (t ,
5409+ PL_bufend ,
5410+ UTF ))))
5411+ t += advance ;
5412+ /* consumed a varname */
5413+ } else if (isDIGIT (* t )) {
5414+ /* deal with hex constants like 0x11 */
5415+ if (t [0 ] == '0' && t [1 ] == 'x' ) {
5416+ t += 2 ;
5417+ while (t < PL_bufend && isXDIGIT (* t )) t ++ ;
5418+ } else {
5419+ /* deal with decimal/octal constants like 1 and
5420+ * 0123 */
5421+ do { t ++ ; } while (isDIGIT (* t ));
5422+ if (t < PL_bufend && * t == '.' ) {
54215423 do { t ++ ; } while (isDIGIT (* t ));
5422- if (t < PL_bufend && * t == '.' ) {
5423- do { t ++ ; } while (isDIGIT (* t ));
5424- }
54255424 }
5426- /* consumed a number */
5427- } else {
5428- /* not a var nor a space nor a number */
5429- break ;
54305425 }
5431- }
5432- if (t < PL_bufend && * t ++ == ',' ) {
5433- PL_bufptr = skipspace (PL_bufptr ); /* XXX can realloc */
5434- while (t < PL_bufend && * t != ']' )
5435- t ++ ;
5436- warner (packWARN (WARN_SYNTAX ),
5437- "Multidimensional syntax %" UTF8f " not supported" ,
5438- UTF8fARG (UTF ,(int )((t - PL_bufptr ) + 1 ), PL_bufptr ));
5426+ /* consumed a number */
5427+ } else {
5428+ /* not a var nor a space nor a number */
5429+ break ;
54395430 }
54405431 }
5441- }
5442- else if (* s == '{' ) {
5443- char * t ;
5444- PL_tokenbuf [0 ] = '%' ;
5445- if ( strEQ (PL_tokenbuf + 1 , "SIG" )
5446- && ckWARN (WARN_SYNTAX )
5447- && (t = (char * ) memchr (s , '}' , PL_bufend - s ))
5448- && (t = (char * ) memchr (t , '=' , PL_bufend - t )))
5449- {
5450- char tmpbuf [sizeof PL_tokenbuf ];
5451- do {
5432+ if (t < PL_bufend && * t ++ == ',' ) {
5433+ PL_bufptr = skipspace (PL_bufptr ); /* XXX can realloc */
5434+ while (t < PL_bufend && * t != ']' )
54525435 t ++ ;
5453- } while (isSPACE (* t ));
5454- if (isIDFIRST_lazy_if_safe (t , PL_bufend , UTF )) {
5455- STRLEN len ;
5456- t = scan_word (t , tmpbuf , sizeof tmpbuf , TRUE, & len );
5457- while (isSPACE (* t ))
5458- t ++ ;
5459- if ( * t == ';'
5460- && get_cvn_flags (tmpbuf , len , UTF
5461- ? SVf_UTF8
5462- : 0 ))
5463- {
5464- warner (packWARN (WARN_SYNTAX ),
5465- "You need to quote \"%" UTF8f "\"" ,
5466- UTF8fARG (UTF , len , tmpbuf ));
5467- }
5468- }
5436+ warner (packWARN (WARN_SYNTAX ),
5437+ "Multidimensional syntax %" UTF8f " not supported" ,
5438+ UTF8fARG (UTF ,(int )((t - PL_bufptr ) + 1 ), PL_bufptr ));
54695439 }
54705440 }
54715441 }
5472-
5473- PL_expect = XOPERATOR ;
5474- if ((PL_lex_state == LEX_NORMAL || PL_lex_brackets ) && isSPACE ((char )tmp )) {
5475- const bool islop = (PL_last_lop == PL_oldoldbufptr );
5476- if (!islop || PL_last_lop_op == OP_GREPSTART )
5477- PL_expect = XOPERATOR ;
5478- else if (memCHRs ("$@\"'`q" , * s ))
5479- PL_expect = XTERM ; /* e.g. print $fh "foo" */
5480- else if ( memCHRs ("&*<%" , * s )
5481- && isIDFIRST_lazy_if_safe (s + 1 , PL_bufend , UTF ))
5442+ else if (* s == '{' ) {
5443+ char * t ;
5444+ PL_tokenbuf [0 ] = '%' ;
5445+ if ( strEQ (PL_tokenbuf + 1 , "SIG" )
5446+ && ckWARN (WARN_SYNTAX )
5447+ && (t = (char * ) memchr (s , '}' , PL_bufend - s ))
5448+ && (t = (char * ) memchr (t , '=' , PL_bufend - t )))
54825449 {
5483- PL_expect = XTERM ; /* e.g. print $fh &sub */
5484- }
5485- else if (isIDFIRST_lazy_if_safe (s , PL_bufend , UTF )) {
54865450 char tmpbuf [sizeof PL_tokenbuf ];
5487- int t2 ;
5488- STRLEN len ;
5489- scan_word (s , tmpbuf , sizeof tmpbuf , TRUE, & len );
5490- if ((t2 = keyword (tmpbuf , len , 0 ))) {
5491- /* binary operators exclude handle interpretations */
5492- switch (t2 ) {
5493- case - KEY_x :
5494- case - KEY_eq :
5495- case - KEY_ne :
5496- case - KEY_gt :
5497- case - KEY_lt :
5498- case - KEY_ge :
5499- case - KEY_le :
5500- case - KEY_cmp :
5501- break ;
5502- default :
5503- PL_expect = XTERM ; /* e.g. print $fh length() */
5504- break ;
5451+ do {
5452+ t ++ ;
5453+ } while (isSPACE (* t ));
5454+ if (isIDFIRST_lazy_if_safe (t , PL_bufend , UTF )) {
5455+ STRLEN len ;
5456+ t = scan_word (t , tmpbuf , sizeof tmpbuf , TRUE, & len );
5457+ while (isSPACE (* t ))
5458+ t ++ ;
5459+ if ( * t == ';'
5460+ && get_cvn_flags (tmpbuf , len , UTF
5461+ ? SVf_UTF8
5462+ : 0 ))
5463+ {
5464+ warner (packWARN (WARN_SYNTAX ),
5465+ "You need to quote \"%" UTF8f "\"" ,
5466+ UTF8fARG (UTF , len , tmpbuf ));
55055467 }
55065468 }
5507- else {
5508- PL_expect = XTERM ; /* e.g. print $fh subr() */
5509- }
55105469 }
5511- else if (isDIGIT (* s ))
5512- PL_expect = XTERM ; /* e.g. print $fh 3 */
5513- else if (* s == '.' && isDIGIT (s [1 ]))
5514- PL_expect = XTERM ; /* e.g. print $fh .3 */
5515- else if ((* s == '?' || * s == '-' || * s == '+' )
5516- && !isSPACE (s [1 ]) && s [1 ] != '=' )
5517- PL_expect = XTERM ; /* e.g. print $fh -1 */
5518- else if (* s == '/' && !isSPACE (s [1 ]) && s [1 ] != '='
5519- && s [1 ] != '/' )
5520- PL_expect = XTERM ; /* e.g. print $fh /.../
5521- XXX except DORDOR operator
5522- */
5523- else if (* s == '<' && s [1 ] == '<' && !isSPACE (s [2 ])
5524- && s [2 ] != '=' )
5525- PL_expect = XTERM ; /* print $fh <<"EOF" */
55265470 }
55275471 }
5472+
5473+ PL_expect = XOPERATOR ;
5474+ if ((PL_lex_state == LEX_NORMAL || PL_lex_brackets ) && isSPACE ((char )tmp )) {
5475+ const bool islop = (PL_last_lop == PL_oldoldbufptr );
5476+ if (!islop || PL_last_lop_op == OP_GREPSTART )
5477+ PL_expect = XOPERATOR ;
5478+ else if (memCHRs ("$@\"'`q" , * s ))
5479+ PL_expect = XTERM ; /* e.g. print $fh "foo" */
5480+ else if ( memCHRs ("&*<%" , * s )
5481+ && isIDFIRST_lazy_if_safe (s + 1 , PL_bufend , UTF ))
5482+ {
5483+ PL_expect = XTERM ; /* e.g. print $fh &sub */
5484+ }
5485+ else if (isIDFIRST_lazy_if_safe (s , PL_bufend , UTF )) {
5486+ char tmpbuf [sizeof PL_tokenbuf ];
5487+ int t2 ;
5488+ STRLEN len ;
5489+ scan_word (s , tmpbuf , sizeof tmpbuf , TRUE, & len );
5490+ if ((t2 = keyword (tmpbuf , len , 0 ))) {
5491+ /* binary operators exclude handle interpretations */
5492+ switch (t2 ) {
5493+ case - KEY_x :
5494+ case - KEY_eq :
5495+ case - KEY_ne :
5496+ case - KEY_gt :
5497+ case - KEY_lt :
5498+ case - KEY_ge :
5499+ case - KEY_le :
5500+ case - KEY_cmp :
5501+ break ;
5502+ default :
5503+ PL_expect = XTERM ; /* e.g. print $fh length() */
5504+ break ;
5505+ }
5506+ }
5507+ else {
5508+ PL_expect = XTERM ; /* e.g. print $fh subr() */
5509+ }
5510+ }
5511+ else if (isDIGIT (* s ))
5512+ PL_expect = XTERM ; /* e.g. print $fh 3 */
5513+ else if (* s == '.' && isDIGIT (s [1 ]))
5514+ PL_expect = XTERM ; /* e.g. print $fh .3 */
5515+ else if ((* s == '?' || * s == '-' || * s == '+' )
5516+ && !isSPACE (s [1 ]) && s [1 ] != '=' )
5517+ PL_expect = XTERM ; /* e.g. print $fh -1 */
5518+ else if (* s == '/' && !isSPACE (s [1 ]) && s [1 ] != '='
5519+ && s [1 ] != '/' )
5520+ PL_expect = XTERM ; /* e.g. print $fh /.../
5521+ XXX except DORDOR operator
5522+ */
5523+ else if (* s == '<' && s [1 ] == '<' && !isSPACE (s [2 ])
5524+ && s [2 ] != '=' )
5525+ PL_expect = XTERM ; /* print $fh <<"EOF" */
5526+ }
5527+
55285528 force_ident_maybe_lex ('$' );
55295529 TOKEN (PERLY_DOLLAR );
55305530}
0 commit comments