From: Gurusamy Sarathy Date: Wed, 23 Sep 1998 05:26:26 +0000 (+0000) Subject: better CR-handling on shebang line and in formats (fixed variant of X-Git-Tag: accepted/trunk/20130322.191538~37136 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=51882d45c6d36f86de12444364ecbbfe87b21ab4;p=platform%2Fupstream%2Fperl.git better CR-handling on shebang line and in formats (fixed variant of patch suggested by Igor Sysoev ) p4raw-id: //depot/perl@1812 --- diff --git a/perl.c b/perl.c index 698abfb..6e59ee9 100644 --- a/perl.c +++ b/perl.c @@ -1774,7 +1774,7 @@ Internet, point your browser at http://www.perl.com/, the Perl Home Page.\n\n"); break; case '-': case 0: -#ifdef WIN32 +#if defined(WIN32) || !defined(PERL_STRICT_CR) case '\r': #endif case '\n': diff --git a/toke.c b/toke.c index 90fc7b8..719867b 100644 --- a/toke.c +++ b/toke.c @@ -2567,7 +2567,11 @@ yylex(void) } if (PL_lex_brackets < PL_lex_formbrack) { char *t; +#ifdef PERL_STRICT_CR for (t = s; *t == ' ' || *t == '\t'; t++) ; +#else + for (t = s; *t == ' ' || *t == '\t' || *t == '\r'; t++) ; +#endif if (*t == '\n' || *t == '#') { s--; PL_expect = XBLOCK; @@ -2799,8 +2803,14 @@ yylex(void) OPERATOR(tmp); case '.': - if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack && s[1] == '\n' && - (s == PL_linestart || s[-1] == '\n') ) { + if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack +#ifdef PERL_STRICT_CR + && s[1] == '\n' +#else + && (s[1] == '\n' || (s[1] == '\r' && s[2] == '\n')) +#endif + && (s == PL_linestart || s[-1] == '\n') ) + { PL_lex_formbrack = 0; PL_expect = XSTATE; goto rightbracket; @@ -6095,7 +6105,11 @@ scan_formline(register char *s) while (!needargs) { if (*s == '.' || *s == '}') { /*SUPPRESS 530*/ - for (t = s+1; *t == ' ' || *t == '\t'; t++) ; +#ifdef PERL_STRICT_CR + for (t = s+1;*t == ' ' || *t == '\t'; t++) ; +#else + for (t = s+1;*t == ' ' || *t == '\t' || *t == '\r'; t++) ; +#endif if (*t == '\n') break; }