/* toke.c
*
- * Copyright (c) 1991-1999, Larry Wall
+ * Copyright (c) 1991-2000, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
SAVEI32(PL_lex_state);
SAVEVPTR(PL_lex_inpat);
SAVEI32(PL_lex_inwhat);
+ if (PL_lex_state == LEX_KNOWNEXT) {
+ I32 toke = PL_nexttoke;
+ while (--toke >= 0) {
+ SAVEI32(PL_nexttype[toke]);
+ SAVEVPTR(PL_nextval[toke]);
+ }
+ SAVEI32(PL_nexttoke);
+ PL_nexttoke = 0;
+ }
SAVECOPLINE(PL_curcop);
SAVEPPTR(PL_bufptr);
SAVEPPTR(PL_bufend);
yyerror("Missing right brace on \\x{}");
e = s;
}
- if (!utf) {
- dTHR;
- if (ckWARN(WARN_UTF8))
- Perl_warner(aTHX_ WARN_UTF8,
- "Use of \\x{} without utf8 declaration");
- }
/* note: utf always shorter than hex */
d = (char*)uv_to_utf8((U8*)d,
(UV)scan_hex(s + 1, e - s - 1, &len));
U8 tmpbuf[10];
U8 *tmpend;
NV nshift = 1.0;
+ bool utf8 = FALSE;
s++; /* get past 'v' */
sv = NEWSV(92,5);
while (isDIGIT(*pos))
pos++;
- tmpend = uv_to_utf8(tmpbuf, rev);
+ if (rev > 127) {
+ tmpend = uv_to_utf8(tmpbuf, rev);
+ utf8 = TRUE;
+ }
+ else {
+ tmpbuf[0] = (U8)rev;
+ tmpend = &tmpbuf[1];
+ }
*tmpend = '\0';
sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf);
if (rev > 0)
rev = atoi(s);
s = pos;
tmpend = uv_to_utf8(tmpbuf, rev);
+ utf8 = utf8 || rev > 127;
*tmpend = '\0';
sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf);
if (rev > 0)
SvPOK_on(sv);
SvNOK_on(sv);
SvREADONLY_on(sv);
- SvUTF8_on(sv);
+ if (utf8)
+ SvUTF8_on(sv);
}
}
break;