summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-07-11 20:37:23 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-07-11 20:37:23 +0000
commitc2e66d9e68806a7000ee1a4760c35703a0e0ae89 (patch)
tree32508ca896b6e213afc07430f7aa223c0e9dde28 /toke.c
parent4755096ec61711c5104ba0b6b9314f32ca0351fe (diff)
downloadperl-c2e66d9e68806a7000ee1a4760c35703a0e0ae89.tar.gz
integrate cfgperl changes#6325..6373 into mainline
(NOTE: today's batch of integrations still untested) p4raw-link: @6373 (not found) p4raw-link: @6325 on //depot/cfgperl: d6ac44cc5a00fa38a56717785146bc16b716472c p4raw-id: //depot/perl@6373
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/toke.c b/toke.c
index fc9d6818f5..8f42dcfb5e 100644
--- a/toke.c
+++ b/toke.c
@@ -1208,6 +1208,7 @@ S_scan_const(pTHX_ char *start)
register char *s = start; /* start of the constant */
register char *d = SvPVX(sv); /* destination for copies */
bool dorange = FALSE; /* are we in a translit range? */
+ bool didrange = FALSE; /* did we just finish a range? */
bool has_utf = FALSE; /* embedded \x{} */
I32 len; /* ? */
UV uv;
@@ -1241,6 +1242,13 @@ S_scan_const(pTHX_ char *start)
min = (U8)*d; /* first char in range */
max = (U8)d[1]; /* last char in range */
+
+ if (min > max) {
+ Perl_croak(aTHX_
+ "Invalid [] range \"%c-%c\" in transliteration operator",
+ min, max);
+ }
+
#ifndef ASCIIish
if ((isLOWER(min) && isLOWER(max)) ||
(isUPPER(min) && isUPPER(max))) {
@@ -1261,11 +1269,15 @@ S_scan_const(pTHX_ char *start)
/* mark the range as done, and continue */
dorange = FALSE;
+ didrange = TRUE;
continue;
- }
+ }
/* range begins (ignore - as first or last char) */
else if (*s == '-' && s+1 < send && s != start) {
+ if (didrange) {
+ croak("Ambiguous range in transliteration operator");
+ }
if (utf) {
*d++ = (char)0xff; /* use illegal utf8 byte--see pmtrans */
s++;
@@ -1273,7 +1285,9 @@ S_scan_const(pTHX_ char *start)
}
dorange = TRUE;
s++;
- }
+ } else {
+ didrange = FALSE;
+ }
}
/* if we get here, we're not doing a transliteration */
@@ -3158,7 +3172,7 @@ Perl_yylex(pTHX)
yyerror("Unmatched right curly bracket");
else
PL_expect = (expectation)PL_lex_brackstack[--PL_lex_brackets];
- if (PL_lex_brackets < PL_lex_formbrack)
+ if (PL_lex_brackets < PL_lex_formbrack && PL_lex_state != LEX_INTERPNORMAL)
PL_lex_formbrack = 0;
if (PL_lex_state == LEX_INTERPNORMAL) {
if (PL_lex_brackets == 0) {
@@ -7162,7 +7176,7 @@ S_scan_formline(pTHX_ register char *s)
bool needargs = FALSE;
while (!needargs) {
- if (*s == '.' || *s == '}') {
+ if (*s == '.' || *s == /*{*/'}') {
/*SUPPRESS 530*/
#ifdef PERL_STRICT_CR
for (t = s+1;SPACE_OR_TAB(*t); t++) ;