* This code was copied from perl/toke.c and subsequently butchered
* by Lukas Mai (2012).
*/
+/* vi: set ft=c: */
/* vvvvvvvvvvvvvvvvvvvvv I HAVE NO IDEA WHAT I'M DOING vvvvvvvvvvvvvvvvvvvv */
#define PL_linestr (PL_parser->linestr)
# define UTF ((PL_linestr && DO_UTF8(PL_linestr)) || (PL_hints & HINT_UTF8))
#endif
-static STRLEN S_scan_word(const char *start, int allow_package) {
+static STRLEN S_scan_word(pTHX_ const char *start, int allow_package) {
const char *s = start;
for (;;) {
if (isALNUM(*s) || (!UTF && isALNUMC_L1(*s))) { /* UTF handled below */
termlen = 1;
}
else {
- termcode = utf8_to_uvchr_buf((U8*)s, (U8*)PL_bufend, &termlen);
+ termcode = IF_HAVE_PERL_5_16(
+ utf8_to_uvchr_buf((U8*)s, (U8*)PL_bufend, &termlen),
+ utf8_to_uvchr((U8*)s, &termlen)
+ );
Copy(s, termstr, termlen, U8);
if (!UTF8_IS_INVARIANT(term))
has_utf8 = TRUE;
char * const svlast = SvEND(sv) - 1;
for (; s < ns; s++) {
- if (*s == '\n' && !PL_rsfp && !PL_parser->filtered)
+ if (*s == '\n' && !PL_rsfp &&
+ IF_HAVE_PERL_5_16(
+ !PL_parser->filtered,
+ TRUE
+ )
+ )
CopLINE_inc(PL_curcop);
}
if (!found)
if (PL_multi_open == PL_multi_close) {
for (; s < PL_bufend; s++,to++) {
/* embedded newlines increment the current line number */
- if (*s == '\n' && !PL_rsfp && !PL_parser->filtered)
+ if (*s == '\n' && !PL_rsfp &&
+ IF_HAVE_PERL_5_16(
+ !PL_parser->filtered,
+ 1
+ )
+ )
CopLINE_inc(PL_curcop);
/* handle quoted delimiters */
if (*s == '\\' && s+1 < PL_bufend && term != '\\') {
/* read until we run out of string, or we find the terminator */
for (; s < PL_bufend; s++,to++) {
/* embedded newlines increment the line count */
- if (*s == '\n' && !PL_rsfp && !PL_parser->filtered)
+ if (*s == '\n' && !PL_rsfp &&
+ IF_HAVE_PERL_5_16(
+ !PL_parser->filtered,
+ 1
+ )
+ )
CopLINE_inc(PL_curcop);
/* backslashes can escape the open or closing characters */
if (*s == '\\' && s+1 < PL_bufend) {