summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-09-23 05:26:26 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-09-23 05:26:26 +0000
commit51882d45c6d36f86de12444364ecbbfe87b21ab4 (patch)
tree216f862b95c6ff6615fa86cee5e8e731bb9227be /toke.c
parent4968c1e4fb50e28f5f275a60b70129c61fe3ca9e (diff)
downloadperl-51882d45c6d36f86de12444364ecbbfe87b21ab4.tar.gz
better CR-handling on shebang line and in formats (fixed variant of
patch suggested by Igor Sysoev <igor@nitek.ru>) p4raw-id: //depot/perl@1812
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/toke.c b/toke.c
index 90fc7b8223..719867b9e4 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;
}