diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-05-08 16:32:07 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-05-08 16:32:07 +0000 |
commit | b3b48e3eb8f85caa6afab3dc95ab58c02450700f (patch) | |
tree | d9f052f43368551c55cf1a1539f48ba368f3a5db | |
parent | 7fd134d9e547166a30ad904424bd09e784d058ce (diff) | |
download | perl-b3b48e3eb8f85caa6afab3dc95ab58c02450700f.tar.gz |
Don't forget to whine about \d__\d.
p4raw-id: //depot/perl@10038
-rw-r--r-- | t/pragma/warn/toke | 15 | ||||
-rw-r--r-- | toke.c | 14 |
2 files changed, 18 insertions, 11 deletions
diff --git a/t/pragma/warn/toke b/t/pragma/warn/toke index f60c9480b9..6adddfc800 100644 --- a/t/pragma/warn/toke +++ b/t/pragma/warn/toke @@ -405,6 +405,9 @@ $a = 123.456E_-12; print "$a\n"; # 36 $a = 123.456E-_12; print "$a\n"; # 37 $a = 123.456E-1_2; print "$a\n"; $a = 123.456E-12_; print "$a\n"; # 39 +$a = 1__23; print "$a\n"; # 40 +$a = 12.3__4; print "$a\n"; # 41 +$a = 12.34e1__2; print "$a\n"; # 42 no warnings 'syntax' ; $a = _123; print "$a\n"; $a = 1_23; print "$a\n"; @@ -443,6 +446,9 @@ $a = 123.456E_-12; print "$a\n"; $a = 123.456E-_12; print "$a\n"; $a = 123.456E-1_2; print "$a\n"; $a = 123.456E-12_; print "$a\n"; +$a = 1__23; print "$a\n"; +$a = 12.3__4; print "$a\n"; +$a = 12.34e1__2; print "$a\n"; EXPECT Misplaced _ in number at - line 6. Misplaced _ in number at - line 11. @@ -461,6 +467,9 @@ Misplaced _ in number at - line 35. Misplaced _ in number at - line 36. Misplaced _ in number at - line 37. Misplaced _ in number at - line 39. +Misplaced _ in number at - line 40. +Misplaced _ in number at - line 41. +Misplaced _ in number at - line 42. _123 123 123 @@ -498,6 +507,9 @@ _123 1.23456e-10 1.23456e-10 1.23456e-10 +123 +12.34 +12340000000000 _123 123 123 @@ -535,6 +547,9 @@ _123 1.23456e-10 1.23456e-10 1.23456e-10 +123 +12.34 +12340000000000 ######## # toke.c use warnings 'bareword' ; @@ -7189,29 +7189,21 @@ Perl_scan_num(pTHX_ char *start, YYSTYPE* lvalp) lastub = s++; } - /* read off the first digit */ - if (isDIGIT(*s)) { - if (d >= e) - Perl_croak(aTHX_ number_too_long); - *d++ = *s++; - } - /* read digits of exponent */ while (isDIGIT(*s) || *s == '_') { if (isDIGIT(*s)) { if (d >= e) Perl_croak(aTHX_ number_too_long); - *d++ = *s; + *d++ = *s++; } else { if (ckWARN(WARN_SYNTAX) && ((lastub && s == lastub + 1) || - !isDIGIT(s[1]))) + (!isDIGIT(s[1]) && s[1] != '_'))) Perl_warner(aTHX_ WARN_SYNTAX, "Misplaced _ in number"); - lastub = s; + lastub = s++; } - s++; } } |