unshift @INC, "../lib";
}
-print "1..14\n";
+print "1..18\n";
my $test = 1;
require v5.5.640;
print "ok $test\n"; ++$test;
+# printing characters should work
+print v111;
+print v107.32;
+print "$test\n"; ++$test;
+
+# hash keys too
+$h{v111.107} = "ok";
+print "$h{ok} $test\n"; ++$test;
+
+# poetry optimization should also
+sub v77 { "ok" }
+$x = v77;
+print "$x $test\n"; ++$test;
+
+# but not when dots are involved
+$x = v77.78.79;
+print "not " unless $x eq "MNO";
+print "ok $test\n"; ++$test;
+
print "not " unless v1.20.300.4000 eq "\x{1}\x{14}\x{12c}\x{fa0}";
print "ok $test\n"; ++$test;
OPERATOR(REFGEN);
case 'v':
- if (isDIGIT(s[1]) && PL_expect == XTERM) {
+ if (isDIGIT(s[1]) && PL_expect != XOPERATOR) {
char *start = s;
start++;
start++;
s = scan_num(s);
TERM(THING);
}
+ /* avoid v123abc() or $h{v1}, allow C<print v10;> */
+ else if (!isALPHA(*start) && (PL_expect == XTERM || PL_expect == XREF)) {
+ char c = *start;
+ GV *gv;
+ *start = '\0';
+ gv = gv_fetchpv(s, FALSE, SVt_PVCV);
+ *start = c;
+ if (!gv) {
+ s = scan_num(s);
+ TERM(THING);
+ }
+ }
}
goto keylookup;
case 'x':
pos++;
while (isDIGIT(*pos))
pos++;
- if (*pos == '.' && isDIGIT(pos[1])) {
+ if (!isALPHA(*pos)) {
UV rev;
U8 tmpbuf[UTF8_MAXLEN];
U8 *tmpend;
sv = NEWSV(92,5);
sv_setpvn(sv, "", 0);
- do {
+ for (;;) {
if (*s == '0' && isDIGIT(s[1]))
yyerror("Octal number in vector unsupported");
rev = atoi(s);
- s = ++pos;
- while (isDIGIT(*pos))
- pos++;
-
- if (rev > 127) {
- tmpend = uv_to_utf8(tmpbuf, rev);
- utf8 = TRUE;
- }
+ tmpend = uv_to_utf8(tmpbuf, rev);
+ utf8 = utf8 || rev > 127;
+ sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf);
+ if (*pos == '.' && isDIGIT(pos[1]))
+ s = ++pos;
else {
- tmpbuf[0] = (U8)rev;
- tmpend = &tmpbuf[1];
+ s = pos;
+ break;
}
- sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf);
- } while (*pos == '.' && isDIGIT(pos[1]));
-
- if (*s == '0' && isDIGIT(s[1]))
- yyerror("Octal number in vector unsupported");
- rev = atoi(s);
- s = pos;
- tmpend = uv_to_utf8(tmpbuf, rev);
- utf8 = utf8 || rev > 127;
- sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf);
+ while (isDIGIT(*pos))
+ pos++;
+ }
SvPOK_on(sv);
SvREADONLY_on(sv);