#define yychar (*PL_yycharp)
#define yylval (*PL_yylvalp)
-static char ident_too_long[] = "Identifier too long";
-static char c_without_g[] = "Use of /c modifier is meaningless without /g";
-static char c_in_subst[] = "Use of /c modifier is meaningless in s///";
+static const char ident_too_long[] =
+ "Identifier too long";
+static const char c_without_g[] =
+ "Use of /c modifier is meaningless without /g";
+static const char c_in_subst[] =
+ "Use of /c modifier is meaningless in s///";
static void restore_rsfp(pTHX_ void *f);
#ifndef PERL_NO_UTF16_FILTER
#define LEX_KNOWNEXT 0
#ifdef DEBUGGING
-static char* lex_state_names[] = {
+static const char* const lex_state_names[] = {
"KNOWNEXT",
"FORMLINE",
"INTERPCONST",
* The UNIDOR macro is for unary functions that can be followed by the //
* operator (such as C<shift // 0>).
*/
-#define UNI2(f,x) return ( \
- yylval.ival = f, \
- PL_expect = x, \
- PL_bufptr = s, \
- PL_last_uni = PL_oldbufptr, \
- PL_last_lop_op = f, \
- REPORT( \
- (*s == '(' || (s = skipspace(s), *s == '(') \
- ? (int)FUNC1 : (int)UNIOP)))
+#define UNI2(f,x) { \
+ yylval.ival = f; \
+ PL_expect = x; \
+ PL_bufptr = s; \
+ PL_last_uni = PL_oldbufptr; \
+ PL_last_lop_op = f; \
+ if (*s == '(') \
+ return REPORT( (int)FUNC1 ); \
+ s = skipspace(s); \
+ return REPORT( *s=='(' ? (int)FUNC1 : (int)UNIOP ); \
+ }
#define UNI(f) UNI2(f,XTERM)
#define UNIDOR(f) UNI2(f,XTERMORDORDOR)
-#define UNIBRACK(f) return ( \
- yylval.ival = f, \
- PL_bufptr = s, \
- PL_last_uni = PL_oldbufptr, \
- REPORT( \
- (*s == '(' || (s = skipspace(s), *s == '(') \
- ? (int)FUNC1 : (int)UNIOP)))
+#define UNIBRACK(f) { \
+ yylval.ival = f; \
+ PL_bufptr = s; \
+ PL_last_uni = PL_oldbufptr; \
+ if (*s == '(') \
+ return REPORT( (int)FUNC1 ); \
+ s = skipspace(s); \
+ return REPORT( (*s == '(') ? (int)FUNC1 : (int)UNIOP ); \
+ }
/* grandfather return to old style */
#define OLDLOP(f) return(yylval.ival=f,PL_expect = XTERM,PL_bufptr = s,(int)LSTOP)
TOKENTYPE_GVVAL
};
-static struct debug_tokens { int token, type; char *name;} debug_tokens[] =
+static struct debug_tokens { const int token, type; const char *name; }
+ const debug_tokens[] =
{
{ ADDOP, TOKENTYPE_OPNUM, "ADDOP" },
{ ANDAND, TOKENTYPE_NONE, "ANDAND" },
/* dump the returned token in rv, plus any optional arg in yylval */
STATIC int
-S_tokereport(pTHX_ char* s, I32 rv)
+S_tokereport(pTHX_ const char* s, I32 rv)
{
if (DEBUG_T_TEST) {
- char *name = Nullch;
+ const char *name = Nullch;
enum token_type type = TOKENTYPE_NONE;
- struct debug_tokens *p;
- SV* report = NEWSV(0, 60);
-
- Perl_sv_catpvf(aTHX_ report, "<== ");
+ const struct debug_tokens *p;
+ SV* report = newSVpvn("<== ", 4);
for (p = debug_tokens; p->token; p++) {
if (p->token == (int)rv) {
}
}
if (name)
- Perl_sv_catpvf(aTHX_ report, "%s", name);
+ Perl_sv_catpv(aTHX_ report, name);
else if ((char)rv > ' ' && (char)rv < '~')
Perl_sv_catpvf(aTHX_ report, "'%c'", (char)rv);
else if (!rv)
- Perl_sv_catpvf(aTHX_ report, "EOF");
+ Perl_sv_catpv(aTHX_ report, "EOF");
else
Perl_sv_catpvf(aTHX_ report, "?? %"IVdf, (IV)rv);
switch (type) {
case TOKENTYPE_GVVAL: /* doesn't appear to be used */
break;
case TOKENTYPE_IVAL:
- Perl_sv_catpvf(aTHX_ report, "(ival=%"IVdf")", yylval.ival);
+ Perl_sv_catpvf(aTHX_ report, "(ival=%"IVdf")", (IV)yylval.ival);
break;
case TOKENTYPE_OPNUM:
Perl_sv_catpvf(aTHX_ report, "(ival=op_%s)",
Perl_sv_catpv(aTHX_ report, "(opval=null)");
break;
}
- Perl_sv_catpvf(aTHX_ report, " at line %d [", CopLINE(PL_curcop));
+ Perl_sv_catpvf(aTHX_ report, " at line %"IVdf" [", (IV)CopLINE(PL_curcop));
if (s - PL_bufptr > 0)
sv_catpvn(report, PL_bufptr, s - PL_bufptr);
else {
if (PL_oldbufptr && *PL_oldbufptr)
sv_catpv(report, PL_tokenbuf);
}
- PerlIO_printf(Perl_debug_log, "### %s]\n", SvPV_nolen(report));
+ PerlIO_printf(Perl_debug_log, "### %s]\n", SvPV_nolen_const(report));
};
return (int)rv;
}
*/
STATIC void
-S_no_op(pTHX_ char *what, char *s)
+S_no_op(pTHX_ const char *what, char *s)
{
char *oldbp = PL_bufptr;
bool is_first = (PL_oldbufptr == PL_linestart);
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
"\t(Missing semicolon on previous line?)\n");
else if (PL_oldoldbufptr && isIDFIRST_lazy_if(PL_oldoldbufptr,UTF)) {
- char *t;
+ const char *t;
for (t = PL_oldoldbufptr; *t && (isALNUM_lazy_if(t,UTF) || *t == ':'); t++) ;
if (t < PL_bufptr && isSPACE(*t))
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
) {
*tmpbuf = '^';
tmpbuf[1] = toCTRL(PL_multi_close);
- s = "\\n";
tmpbuf[2] = '\0';
s = tmpbuf;
}
*/
void
-Perl_deprecate(pTHX_ char *s)
+Perl_deprecate(pTHX_ const char *s)
{
if (ckWARN(WARN_DEPRECATED))
Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), "Use of %s is deprecated", s);
}
void
-Perl_deprecate_old(pTHX_ char *s)
+Perl_deprecate_old(pTHX_ const char *s)
{
/* This function should NOT be called for any new deprecated warnings */
/* Use Perl_deprecate instead */
/* in its own right. */
if (ckWARN2(WARN_DEPRECATED, WARN_SYNTAX))
- Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
+ Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
"Use of %s is deprecated", s);
}
static void
strip_return(SV *sv)
{
- register char *s = SvPVX(sv);
- register char *e = s + SvCUR(sv);
+ register const char *s = SvPVX_const(sv);
+ register const char *e = s + SvCUR(sv);
/* outer loop optimized to do nothing if there are no CR-LFs */
while (s < e) {
if (*s++ == '\r' && *s == '\n') {
STATIC I32
S_cr_textfilter(pTHX_ int idx, SV *sv, int maxlen)
{
- I32 count = FILTER_READ(idx+1, sv, maxlen);
+ const I32 count = FILTER_READ(idx+1, sv, maxlen);
if (count > 0 && !maxlen)
strip_return(sv);
return count;
void
Perl_lex_start(pTHX_ SV *line)
{
- char *s;
+ const char *s;
STRLEN len;
SAVEI32(PL_lex_dojoin);
PL_linestr = line;
if (SvREADONLY(PL_linestr))
PL_linestr = sv_2mortal(newSVsv(PL_linestr));
- s = SvPV(PL_linestr, len);
+ s = SvPV_const(PL_linestr, len);
if (!len || s[len-1] != ';') {
if (!(SvFLAGS(PL_linestr) & SVs_TEMP))
PL_linestr = sv_2mortal(newSVsv(PL_linestr));
sv_upgrade(sv, SVt_PVMG);
sv_setpvn(sv,PL_bufptr,PL_bufend-PL_bufptr);
(void)SvIOK_on(sv);
- SvIVX(sv) = 0;
+ SvIV_set(sv, 0);
av_store(CopFILEAV(PL_curcop),(I32)CopLINE(PL_curcop),sv);
}
}
S_newSV_maybe_utf8(pTHX_ const char *start, STRLEN len)
{
SV *sv = newSVpvn(start,len);
- if (UTF && !IN_BYTES && is_utf8_string((U8*)start, len))
+ if (UTF && !IN_BYTES && is_utf8_string((const U8*)start, len))
SvUTF8_on(sv);
return sv;
}
*/
STATIC void
-S_force_ident(pTHX_ register char *s, int kind)
+S_force_ident(pTHX_ register const char *s, int kind)
{
if (s && *s) {
- OP* o = (OP*)newSVOP(OP_CONST, 0, newSVpv(s,0));
+ OP* const o = (OP*)newSVOP(OP_CONST, 0, newSVpv(s,0));
PL_nextval[PL_nexttoke].opval = o;
force_next(WORD);
if (kind) {
NV retval = 0.0;
NV nshift = 1.0;
STRLEN len;
- char *start = SvPVx(sv,len);
- bool utf = SvUTF8(sv) ? TRUE : FALSE;
- char *end = start + len;
+ const char *start = SvPV_const(sv,len);
+ const char *end = start + len;
+ const bool utf = SvUTF8(sv) ? TRUE : FALSE;
while (start < end) {
STRLEN skip;
UV n;
version = yylval.opval;
ver = cSVOPx(version)->op_sv;
if (SvPOK(ver) && !SvNIOK(ver)) {
- (void)SvUPGRADE(ver, SVt_PVNV);
- SvNVX(ver) = str_to_version(ver);
+ SvUPGRADE(ver, SVt_PVNV);
+ SvNV_set(ver, str_to_version(ver));
SvNOK_on(ver); /* hint that it is a version */
}
}
goto finish;
d = s;
if ( PL_hints & HINT_NEW_STRING ) {
- pv = sv_2mortal(newSVpvn(SvPVX(pv), len));
+ pv = sv_2mortal(newSVpvn(SvPVX_const(pv), len));
if (SvUTF8(sv))
SvUTF8_on(pv);
}
*d++ = *s++;
}
*d = '\0';
- SvCUR_set(sv, d - SvPVX(sv));
+ SvCUR_set(sv, d - SvPVX_const(sv));
finish:
if ( PL_hints & HINT_NEW_STRING )
return new_constant(NULL, 0, "q", sv, pv, "q");
STATIC I32
S_sublex_start(pTHX)
{
- register I32 op_type = yylval.ival;
+ const register I32 op_type = yylval.ival;
if (op_type == OP_NULL) {
yylval.opval = PL_lex_op;
if (SvTYPE(sv) == SVt_PVIV) {
/* Overloaded constants, nothing fancy: Convert to SVt_PV: */
STRLEN len;
- char *p;
- SV *nsv;
-
- p = SvPV(sv, len);
- nsv = newSVpvn(p, len);
+ const char *p = SvPV_const(sv, len);
+ SV * const nsv = newSVpvn(p, len);
if (SvUTF8(sv))
SvUTF8_on(nsv);
SvREFCNT_dec(sv);
STATIC I32
S_sublex_push(pTHX)
{
+ dVAR;
ENTER;
PL_lex_state = PL_sublex_info.super_state;
STATIC I32
S_sublex_done(pTHX)
{
+ dVAR;
if (!PL_lex_starts++) {
SV *sv = newSVpvn("",0);
if (SvUTF8(PL_linestr))
continue;
}
- i = d - SvPVX(sv); /* remember current offset */
+ i = d - SvPVX_const(sv); /* remember current offset */
SvGROW(sv, SvLEN(sv) + 256); /* never more than 256 chars in a range */
d = SvPVX(sv) + i; /* refresh d after realloc */
d -= 2; /* eat the first char and the - */
default:
{
if (ckWARN(WARN_MISC) &&
- isALNUM(*s) &&
+ isALNUM(*s) &&
*s != '_')
Perl_warner(aTHX_ packWARN(WARN_MISC),
"Unrecognized escape \\%c passed through",
}
}
if (hicount) {
- STRLEN offset = d - SvPVX(sv);
+ STRLEN offset = d - SvPVX_const(sv);
U8 *src, *dst;
d = SvGROW(sv, SvLEN(sv) + hicount + 1) + offset;
src = (U8 *)d - 1;
dst = src+hicount;
d += hicount;
- while (src >= (U8 *)SvPVX(sv)) {
+ while (src >= (const U8 *)SvPVX_const(sv)) {
if (!NATIVE_IS_INVARIANT(*src)) {
U8 ch = NATIVE_TO_ASCII(*src);
*dst-- = (U8)UTF8_EIGHT_BIT_LO(ch);
char* e = strchr(s, '}');
SV *res;
STRLEN len;
- char *str;
+ const char *str;
if (!e) {
yyerror("Missing right brace on \\N{}");
res, Nullsv, "\\N{...}" );
if (has_utf8)
sv_utf8_upgrade(res);
- str = SvPV(res,len);
+ str = SvPV_const(res,len);
#ifdef EBCDIC_NEVER_MIND
/* charnames uses pack U and that has been
* recently changed to do the below uni->native
* gets revoked, but the semantics is still
* desireable for charnames. --jhi */
{
- UV uv = utf8_to_uvchr((U8*)str, 0);
+ UV uv = utf8_to_uvchr((const U8*)str, 0);
if (uv < 0x100) {
- U8 tmpbuf[UTF8_MAXLEN+1], *d;
+ U8 tmpbuf[UTF8_MAXBYTES+1], *d;
d = uvchr_to_utf8(tmpbuf, UNI_TO_NATIVE(uv));
sv_setpvn(res, (char *)tmpbuf, d - tmpbuf);
- str = SvPV(res, len);
+ str = SvPV_const(res, len);
}
}
#endif
if (!has_utf8 && SvUTF8(res)) {
- char *ostart = SvPVX(sv);
+ const char *ostart = SvPVX_const(sv);
SvCUR_set(sv, d - ostart);
SvPOK_on(sv);
*d = '\0';
has_utf8 = TRUE;
}
if (len > (STRLEN)(e - s + 4)) { /* I _guess_ 4 is \N{} --jhi */
- char *odest = SvPVX(sv);
+ const char *odest = SvPVX_const(sv);
SvGROW(sv, (SvLEN(sv) + len - (e - s + 4)));
d = SvPVX(sv) + (d - odest);
s += len;
if (need > len) {
/* encoded value larger than old, need extra space (NOTE: SvCUR() not set here) */
- STRLEN off = d - SvPVX(sv);
+ STRLEN off = d - SvPVX_const(sv);
d = SvGROW(sv, SvLEN(sv) + (need-len)) + off;
}
d = (char*)uvchr_to_utf8((U8*)d, uv);
/* terminate the string and set up the sv */
*d = '\0';
- SvCUR_set(sv, d - SvPVX(sv));
+ SvCUR_set(sv, d - SvPVX_const(sv));
if (SvCUR(sv) >= SvLEN(sv))
Perl_croak(aTHX_ "panic: constant overflowed allocated space");
/* shrink the sv if we allocated more than we used */
if (SvCUR(sv) + 5 < SvLEN(sv)) {
- SvLEN_set(sv, SvCUR(sv) + 1);
- Renew(SvPVX(sv), SvLEN(sv), char);
+ SvPV_shrink_to_cur(sv);
}
/* return the substring (via yylval) only if we parsed anything */
int weight = 2; /* let's weigh the evidence */
char seen[256];
unsigned char un_char = 255, last_un_char;
- char *send = strchr(s,']');
+ const char *send = strchr(s,']');
char tmpbuf[sizeof PL_tokenbuf * 4];
if (!send) /* has to be an expression */
if (GvIO(gv))
return 0;
if ((cv = GvCVu(gv))) {
- char *proto = SvPVX(cv);
+ const char *proto = SvPVX_const(cv);
if (proto) {
if (*proto == ';')
proto++;
* compile-time require of perl5db.pl.
*/
-STATIC char*
+STATIC const char*
S_incl_perldb(pTHX)
{
if (PL_perldb) {
- char *pdb = PerlEnv_getenv("PERL5DB");
+ const char *pdb = PerlEnv_getenv("PERL5DB");
if (pdb)
return pdb;
PL_rsfp_filters = newAV();
if (!datasv)
datasv = NEWSV(255,0);
- if (!SvUPGRADE(datasv, SVt_PVIO))
- Perl_die(aTHX_ "Can't upgrade filter_add data to SVt_PVIO");
- IoANY(datasv) = (void *)funcp; /* stash funcp into spare field */
+ SvUPGRADE(datasv, SVt_PVIO);
+ IoANY(datasv) = FPTR2DPTR(void *, funcp); /* stash funcp into spare field */
IoFLAGS(datasv) |= IOf_FAKE_DIRP;
DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_add func %p (%s)\n",
- (void*)funcp, SvPV_nolen(datasv)));
+ IoANY(datasv), SvPV_nolen(datasv)));
av_unshift(PL_rsfp_filters, 1);
av_store(PL_rsfp_filters, 0, datasv) ;
return(datasv);
Perl_filter_del(pTHX_ filter_t funcp)
{
SV *datasv;
- DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_del func %p", (void*)funcp));
+
+#ifdef DEBUGGING
+ DEBUG_P(PerlIO_printf(Perl_debug_log, "filter_del func %p", FPTR2DPTR(XPVIO *, funcp)));
+#endif
if (!PL_rsfp_filters || AvFILLp(PL_rsfp_filters)<0)
return;
/* if filter is on top of stack (usual case) just pop it off */
datasv = FILTER_DATA(AvFILLp(PL_rsfp_filters));
- if (IoANY(datasv) == (void *)funcp) {
+ if (IoANY(datasv) == FPTR2DPTR(void *, funcp)) {
IoFLAGS(datasv) &= ~IOf_FAKE_DIRP;
IoANY(datasv) = (void *)NULL;
sv_free(av_pop(PL_rsfp_filters));
if (maxlen) {
/* Want a block */
int len ;
- int old_len = SvCUR(buf_sv) ;
+ const int old_len = SvCUR(buf_sv);
/* ensure buf_sv is large enough */
SvGROW(buf_sv, (STRLEN)(old_len + maxlen)) ;
return FILTER_READ(idx+1, buf_sv, maxlen); /* recurse */
}
/* Get function pointer hidden within datasv */
- funcp = (filter_t)IoANY(datasv);
+ funcp = DPTR2FPTR(filter_t, IoANY(datasv));
DEBUG_P(PerlIO_printf(Perl_debug_log,
"filter_read %d: via function %p (%s)\n",
- idx, (void*)funcp, SvPV_nolen(datasv)));
+ idx, datasv, SvPV_nolen_const(datasv)));
/* Call function. The function is expected to */
/* call "FILTER_READ(idx+1, buf_sv)" first. */
/* Return: <0:error, =0:eof, >0:not eof */
}
STATIC HV *
-S_find_in_my_stash(pTHX_ char *pkgname, I32 len)
+S_find_in_my_stash(pTHX_ const char *pkgname, I32 len)
{
GV *gv;
if ((gv = gv_fetchpv(pkgname, FALSE, SVt_PVCV))) {
SV *sv;
if (GvCV(gv) && (sv = cv_const_sv(GvCV(gv)))) {
- pkgname = SvPV_nolen(sv);
+ pkgname = SvPV_nolen_const(sv);
}
}
}
#ifdef DEBUGGING
- static char* exp_name[] =
+ static const char* const exp_name[] =
{ "OPERATOR", "TERM", "REF", "STATE", "BLOCK", "ATTRBLOCK",
"ATTRTERM", "TERMBLOCK", "TERMORDORDOR"
};
#endif
/* handle \E or end of string */
if (PL_bufptr == PL_bufend || PL_bufptr[1] == 'E') {
- char oldmod;
-
/* if at a \E */
if (PL_lex_casemods) {
- oldmod = PL_lex_casestack[--PL_lex_casemods];
+ const char oldmod = PL_lex_casestack[--PL_lex_casemods];
PL_lex_casestack[PL_lex_casemods] = '\0';
if (PL_bufptr != PL_bufend
/* The count here deliberately includes the NUL
that terminates the C string constant. This
embeds the opening NUL into the string. */
+ const char *splits = PL_splitstr;
sv_catpvn(PL_linestr, "our @F=split(q", 15);
- s = PL_splitstr;
do {
/* Need to \ \s */
- if (*s == '\\')
- sv_catpvn(PL_linestr, s, 1);
- sv_catpvn(PL_linestr, s, 1);
- } while (*s++);
+ if (*splits == '\\')
+ sv_catpvn(PL_linestr, splits, 1);
+ sv_catpvn(PL_linestr, splits, 1);
+ } while (*splits++);
/* This loop will embed the trailing NUL of
PL_linestr as the last thing it does before
terminating. */
sv_upgrade(sv, SVt_PVMG);
sv_setsv(sv,PL_linestr);
(void)SvIOK_on(sv);
- SvIVX(sv) = 0;
+ SvIV_set(sv, 0);
av_store(CopFILEAV(PL_curcop),(I32)CopLINE(PL_curcop),sv);
}
goto retry;
}
PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr);
PL_last_lop = PL_last_uni = Nullch;
- sv_setpv(PL_linestr,"");
+ sv_setpvn(PL_linestr,"",0);
TOKEN(';'); /* not infinite loop because rsfp is NULL now */
}
/* If it looks like the start of a BOM or raw UTF-16,
if (PL_doextract) {
/* Incest with pod. */
if (*s == '=' && strnEQ(s, "=cut", 4)) {
- sv_setpv(PL_linestr, "");
+ sv_setpvn(PL_linestr, "", 0);
PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr);
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
PL_last_lop = PL_last_uni = Nullch;
sv_upgrade(sv, SVt_PVMG);
sv_setsv(sv,PL_linestr);
(void)SvIOK_on(sv);
- SvIVX(sv) = 0;
+ SvIV_set(sv, 0);
av_store(CopFILEAV(PL_curcop),(I32)CopLINE(PL_curcop),sv);
}
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
d = s + 2;
#ifdef ALTERNATE_SHEBANG
else {
- static char as[] = ALTERNATE_SHEBANG;
+ static char const as[] = ALTERNATE_SHEBANG;
if (*s == as[0] && strnEQ(s, as, sizeof(as) - 1))
d = s + (sizeof(as) - 1);
}
else {
STRLEN blen;
STRLEN llen;
- char *bstart = SvPV(CopFILESV(PL_curcop),blen);
- char *lstart = SvPV(x,llen);
+ const char *bstart = SvPV_const(CopFILESV(PL_curcop),blen);
+ const char *lstart = SvPV_const(x,llen);
if (llen < blen) {
bstart += blen - llen;
if (strnEQ(bstart, lstart, llen) && bstart[-1] == '/') {
* contains the start of the Perl program.
*/
if (d && *s != '#') {
- char *c = ipath;
+ const char *c = ipath;
while (*c && !strchr("; \t\r\n\f\v#", *c))
c++;
if (c < d)
!instr(s,"indir") &&
instr(PL_origargv[0],"perl"))
{
+ dVAR;
char **newargv;
*ipathend = '\0';
}
#endif
if (d) {
- U32 oldpdb = PL_perldb;
- bool oldn = PL_minus_n;
- bool oldp = PL_minus_p;
+ const U32 oldpdb = PL_perldb;
+ const bool oldn = PL_minus_n;
+ const bool oldp = PL_minus_p;
while (*d && !isSPACE(*d)) d++;
while (SPACE_OR_TAB(*d)) d++;
if (*d++ == '-') {
- bool switches_done = PL_doswitches;
+ const bool switches_done = PL_doswitches;
do {
- if (*d == 'M' || *d == 'm') {
- char *m = d;
+ if (*d == 'M' || *d == 'm' || *d == 'C') {
+ const char *m = d;
while (*d && !isSPACE(*d)) d++;
Perl_croak(aTHX_ "Too late for \"-%.*s\" option",
(int)(d - m), m);
/* if we have already added "LINE: while (<>) {",
we must not do it again */
{
- sv_setpv(PL_linestr, "");
+ sv_setpvn(PL_linestr, "", 0);
PL_oldoldbufptr = PL_oldbufptr = s = PL_linestart = SvPVX(PL_linestr);
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
PL_last_lop = PL_last_uni = Nullch;
#else
; /* skip to avoid loading attributes.pm */
#endif
- else
+ else
Perl_croak(aTHX_ "The 'unique' attribute may only be applied to 'our' variables");
}
}
tmp = (PL_expect == XOPERATOR ? '=' : '{'); /*'}(' for vi */
if (*s != ';' && *s != '}' && *s != tmp && (tmp != '=' || *s != ')')) {
- char q = ((*s == '\'') ? '"' : '\'');
+ const char q = ((*s == '\'') ? '"' : '\'');
/* If here for an expression, and parsed no attrs, back off. */
if (tmp == '=' && !attrs) {
s = PL_bufptr;
while (d < PL_bufend && SPACE_OR_TAB(*d))
d++;
if (*d == '}') {
- char minus = (PL_tokenbuf[0] == '-');
+ const char minus = (PL_tokenbuf[0] == '-');
s = force_word(s + minus, WORD, FALSE, TRUE, FALSE);
if (minus)
force_next('-');
PL_expect = XSTATE;
break;
default: {
- char *t;
+ const char *t;
if (PL_oldoldbufptr == PL_last_lop)
PL_lex_brackstack[PL_lex_brackets++] = XTERM;
else
* eval"") we have to resolve the ambiguity. This code
* covers the case where the first term in the curlies is a
* quoted string. Most other cases need to be explicitly
- * disambiguated by prepending a `+' before the opening
+ * disambiguated by prepending a "+" before the opening
* curly in order to force resolution as an anon hash.
*
* XXX should probably propagate the outer expectation
&& !isALNUM(*t))))
{
/* skip q//-like construct */
- char *tmps;
+ const char *tmps;
char open, close, term;
I32 brackets = 1;
goto retry;
}
if (PL_lex_brackets < PL_lex_formbrack) {
- char *t;
+ const char *t;
#ifdef PERL_STRICT_CR
for (t = s; SPACE_OR_TAB(*t); t++) ;
#else
* warn on m:!=~\s+([/?]|[msy]\W|tr\W): */
if (*s == '~' && ckWARN(WARN_SYNTAX)) {
- char *t = s+1;
+ const char *t = s+1;
while (t < PL_bufend && isSPACE(*t))
++t;
(t = strchr(s, '}')) && (t = strchr(t, '=')))
{
char tmpbuf[sizeof PL_tokenbuf];
- STRLEN len;
for (t++; isSPACE(*t); t++) ;
if (isIDFIRST_lazy_if(t,UTF)) {
+ STRLEN len;
t = scan_word(t, tmpbuf, sizeof tmpbuf, TRUE, &len);
for (; isSPACE(*t); t++) ;
if (*t == ';' && get_cv(tmpbuf, FALSE))
PL_expect = XOPERATOR;
if (PL_lex_state == LEX_NORMAL && isSPACE((char)tmp)) {
- bool islop = (PL_last_lop == PL_oldoldbufptr);
+ const bool islop = (PL_last_lop == PL_oldoldbufptr);
if (!islop || PL_last_lop_op == OP_GREPSTART)
PL_expect = XOPERATOR;
else if (strchr("$@\"'`q", *s))
/* Warn about @ where they meant $. */
if (ckWARN(WARN_SYNTAX)) {
if (*s == '[' || *s == '{') {
- char *t = s + 1;
+ const char *t = s + 1;
while (*t && (isALNUM_lazy_if(t,UTF) || strchr(" \t$#+-'\"", *t)))
t++;
if (*t == '}' || *t == ']') {
if (!s)
missingterm((char*)0);
yylval.ival = OP_CONST;
+ /* FIXME. I think that this can be const if char *d is replaced by
+ more localised variables. */
for (d = SvPV(PL_lex_stuff, len); len; len--, d++) {
if (*d == '$' || *d == '@' || *d == '\\' || !UTF8_IS_INVARIANT((U8)*d)) {
yylval.ival = OP_STRINGIFY;
case 'v':
if (isDIGIT(s[1]) && PL_expect != XOPERATOR) {
- char *start = s;
- start++;
- start++;
+ char *start = s + 2;
while (isDIGIT(*start) || *start == '_')
start++;
if (*start == '.' && isDIGIT(start[1])) {
else if (!isALPHA(*start) && (PL_expect == XTERM
|| PL_expect == XREF || PL_expect == XSTATE
|| PL_expect == XTERMORDORDOR)) {
- char c = *start;
+ const char c = *start;
GV *gv;
*start = '\0';
gv = gv_fetchpv(s, FALSE, SVt_PVCV);
just_a_word: {
SV *sv;
int pkgname = 0;
- char lastchar = (PL_bufptr == PL_oldoldbufptr ? 0 : PL_bufptr[-1]);
+ const char lastchar = (PL_bufptr == PL_oldoldbufptr ? 0 : PL_bufptr[-1]);
/* Get the rest if it looks like a package qualifier */
sv = newSVpvn("CORE::GLOBAL::",14);
sv_catpv(sv,PL_tokenbuf);
}
- else
- sv = newSVpv(PL_tokenbuf,0);
+ else {
+ /* If len is 0, newSVpv does strlen(), which is correct.
+ If len is non-zero, then it will be the true length,
+ and so the scalar will be created correctly. */
+ sv = newSVpv(PL_tokenbuf,len);
+ }
/* Presume this is going to be a bareword of some sort. */
yylval.opval->op_private = OPpCONST_BARE;
/* UTF-8 package name? */
if (UTF && !IN_BYTES &&
- is_utf8_string((U8*)SvPVX(sv), SvCUR(sv)))
+ is_utf8_string((U8*)SvPVX_const(sv), SvCUR(sv)))
SvUTF8_on(sv);
/* And if "Foo::", then that's what it certainly is. */
/* Is there a prototype? */
if (SvPOK(cv)) {
STRLEN len;
- char *proto = SvPV((SV*)cv, len);
+ const char *proto = SvPV_const((SV*)cv, len);
if (!len)
TERM(FUNC0SUB);
if (*proto == '$' && proto[1] == '\0')
while (*proto == ';')
proto++;
if (*proto == '&' && *s == '{') {
- sv_setpv(PL_subname, PL_curstash ?
+ sv_setpv(PL_subname, PL_curstash ?
"__ANON__" : "__ANON__::__ANON__");
PREBLOCK(LSTOPSUB);
}
case KEY___PACKAGE__:
yylval.opval = (OP*)newSVOP(OP_CONST, 0,
(PL_curstash
- ? newSVpv(HvNAME(PL_curstash), 0)
+ ? newSVhek(HvNAME_HEK(PL_curstash))
: &PL_sv_undef));
TERM(THING);
case KEY___DATA__:
case KEY___END__: {
GV *gv;
-
- /*SUPPRESS 560*/
if (PL_rsfp && (!PL_in_eval || PL_tokenbuf[2] == 'D')) {
- char *pname = "main";
+ const char *pname = "main";
if (PL_tokenbuf[2] == 'D')
- pname = HvNAME(PL_curstash ? PL_curstash : PL_defstash);
+ pname = HvNAME_get(PL_curstash ? PL_curstash : PL_defstash);
gv = gv_fetchpv(Perl_form(aTHX_ "%s::DATA", pname), TRUE, SVt_PVIO);
GvMULTI_on(gv);
if (!GvIO(gv))
IoIFP(GvIOp(gv)) = PL_rsfp;
#if defined(HAS_FCNTL) && defined(F_SETFD)
{
- int fd = PerlIO_fileno(PL_rsfp);
+ const int fd = PerlIO_fileno(PL_rsfp);
fcntl(fd,F_SETFD,fd >= 3);
}
#endif
SPAGAIN;
name = POPs;
PUTBACK;
- PerlIO_apply_layers(aTHX_ PL_rsfp, NULL,
+ PerlIO_apply_layers(aTHX_ PL_rsfp, NULL,
Perl_form(aTHX_ ":encoding(%"SVf")",
name));
FREETMPS;
case KEY_open:
s = skipspace(s);
if (isIDFIRST_lazy_if(s,UTF)) {
- char *t;
+ const char *t;
for (d = s; isALNUM_lazy_if(d,UTF); d++) ;
for (t=d; *t && isSPACE(*t); t++) ;
if ( *t && strchr("|&*+-=!?:.", *t) && ckWARN_d(WARN_PRECEDENCE)
s = scan_str(s,FALSE,FALSE);
if (!s)
missingterm((char*)0);
+ PL_expect = XOPERATOR;
force_next(')');
if (SvCUR(PL_lex_stuff)) {
OP *words = Nullop;
SV *sv;
for (; isSPACE(*d) && len; --len, ++d) ;
if (len) {
- char *b = d;
+ const char *b = d;
if (!warned && ckWARN(WARN_QW)) {
for (; !isSPACE(*d) && len; --len, ++d) {
if (*d == ',') {
missingterm((char*)0);
yylval.ival = OP_STRINGIFY;
if (SvIVX(PL_lex_stuff) == '\'')
- SvIVX(PL_lex_stuff) = 0; /* qq'$foo' should intepolate */
+ SvIV_set(PL_lex_stuff, 0); /* qq'$foo' should intepolate */
TERM(sublex_start());
case KEY_qr:
SSize_t tboffset = 0;
expectation attrful;
bool have_name, have_proto, bad_proto;
- int key = tmp;
+ const int key = tmp;
s = skipspace(s);
Perl_croak(aTHX_ "Missing name in \"my sub\"");
PL_expect = XTERMBLOCK;
attrful = XATTRTERM;
- sv_setpv(PL_subname,"?");
+ sv_setpvn(PL_subname,"?",1);
have_name = FALSE;
}
Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
"Illegal character in prototype for %"SVf" : %s",
PL_subname, d);
- SvCUR(PL_lex_stuff) = tmp;
+ SvCUR_set(PL_lex_stuff, tmp);
have_proto = TRUE;
s = skipspace(s);
/* might be an "our" variable" */
if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) {
/* build ops for a bareword */
- SV *sym = newSVpv(HvNAME(PAD_COMPNAME_OURSTASH(tmp)), 0);
+ HV *stash = PAD_COMPNAME_OURSTASH(tmp);
+ HEK *stashname = HvNAME_HEK(stash);
+ SV *sym = newSVhek(stashname);
sv_catpvn(sym, "::", 2);
sv_catpv(sym, PL_tokenbuf+1);
yylval.opval = (OP*)newSVOP(OP_CONST, 0, sym);
return WORD;
}
+/*
+ * The following code was generated by perl_keyword.pl.
+ */
+
I32
-Perl_keyword(pTHX_ register char *d, I32 len)
+Perl_keyword (pTHX_ const char *name, I32 len)
{
- switch (*d) {
- case '_':
- if (d[1] == '_') {
- if (strEQ(d,"__FILE__")) return -KEY___FILE__;
- if (strEQ(d,"__LINE__")) return -KEY___LINE__;
- if (strEQ(d,"__PACKAGE__")) return -KEY___PACKAGE__;
- if (strEQ(d,"__DATA__")) return KEY___DATA__;
- if (strEQ(d,"__END__")) return KEY___END__;
- }
- break;
- case 'A':
- if (strEQ(d,"AUTOLOAD")) return KEY_AUTOLOAD;
- break;
- case 'a':
- switch (len) {
- case 3:
- if (strEQ(d,"and")) return -KEY_and;
- if (strEQ(d,"abs")) return -KEY_abs;
- break;
- case 5:
- if (strEQ(d,"alarm")) return -KEY_alarm;
- if (strEQ(d,"atan2")) return -KEY_atan2;
- break;
- case 6:
- if (strEQ(d,"accept")) return -KEY_accept;
- break;
- }
- break;
- case 'B':
- if (strEQ(d,"BEGIN")) return KEY_BEGIN;
- break;
- case 'b':
- if (strEQ(d,"bless")) return -KEY_bless;
- if (strEQ(d,"bind")) return -KEY_bind;
- if (strEQ(d,"binmode")) return -KEY_binmode;
- break;
- case 'C':
- if (strEQ(d,"CORE")) return -KEY_CORE;
- if (strEQ(d,"CHECK")) return KEY_CHECK;
- break;
- case 'c':
- switch (len) {
- case 3:
- if (strEQ(d,"cmp")) return -KEY_cmp;
- if (strEQ(d,"chr")) return -KEY_chr;
- if (strEQ(d,"cos")) return -KEY_cos;
- break;
- case 4:
- if (strEQ(d,"chop")) return -KEY_chop;
- break;
- case 5:
- if (strEQ(d,"close")) return -KEY_close;
- if (strEQ(d,"chdir")) return -KEY_chdir;
- if (strEQ(d,"chomp")) return -KEY_chomp;
- if (strEQ(d,"chmod")) return -KEY_chmod;
- if (strEQ(d,"chown")) return -KEY_chown;
- if (strEQ(d,"crypt")) return -KEY_crypt;
- break;
- case 6:
- if (strEQ(d,"chroot")) return -KEY_chroot;
- if (strEQ(d,"caller")) return -KEY_caller;
- break;
- case 7:
- if (strEQ(d,"connect")) return -KEY_connect;
- break;
- case 8:
- if (strEQ(d,"closedir")) return -KEY_closedir;
- if (strEQ(d,"continue")) return -KEY_continue;
- break;
- }
- break;
- case 'D':
- if (strEQ(d,"DESTROY")) return KEY_DESTROY;
- break;
- case 'd':
- switch (len) {
- case 2:
- if (strEQ(d,"do")) return KEY_do;
- break;
- case 3:
- if (strEQ(d,"die")) return -KEY_die;
- break;
- case 4:
- if (strEQ(d,"dump")) return -KEY_dump;
- break;
- case 6:
- if (strEQ(d,"delete")) return KEY_delete;
- break;
- case 7:
- if (strEQ(d,"defined")) return KEY_defined;
- if (strEQ(d,"dbmopen")) return -KEY_dbmopen;
- break;
- case 8:
- if (strEQ(d,"dbmclose")) return -KEY_dbmclose;
- break;
- }
- break;
- case 'E':
- if (strEQ(d,"END")) return KEY_END;
- break;
- case 'e':
- switch (len) {
- case 2:
- if (strEQ(d,"eq")) return -KEY_eq;
- break;
- case 3:
- if (strEQ(d,"eof")) return -KEY_eof;
- if (strEQ(d,"err")) return -KEY_err;
- if (strEQ(d,"exp")) return -KEY_exp;
- break;
- case 4:
- if (strEQ(d,"else")) return KEY_else;
- if (strEQ(d,"exit")) return -KEY_exit;
- if (strEQ(d,"eval")) return KEY_eval;
- if (strEQ(d,"exec")) return -KEY_exec;
- if (strEQ(d,"each")) return -KEY_each;
- break;
- case 5:
- if (strEQ(d,"elsif")) return KEY_elsif;
- break;
- case 6:
- if (strEQ(d,"exists")) return KEY_exists;
- if (strEQ(d,"elseif") && ckWARN_d(WARN_SYNTAX))
- Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
- "elseif should be elsif");
- break;
- case 8:
- if (strEQ(d,"endgrent")) return -KEY_endgrent;
- if (strEQ(d,"endpwent")) return -KEY_endpwent;
- break;
- case 9:
- if (strEQ(d,"endnetent")) return -KEY_endnetent;
- break;
- case 10:
- if (strEQ(d,"endhostent")) return -KEY_endhostent;
- if (strEQ(d,"endservent")) return -KEY_endservent;
- break;
- case 11:
- if (strEQ(d,"endprotoent")) return -KEY_endprotoent;
- break;
- }
- break;
- case 'f':
- switch (len) {
- case 3:
- if (strEQ(d,"for")) return KEY_for;
- break;
- case 4:
- if (strEQ(d,"fork")) return -KEY_fork;
- break;
- case 5:
- if (strEQ(d,"fcntl")) return -KEY_fcntl;
- if (strEQ(d,"flock")) return -KEY_flock;
- break;
- case 6:
- if (strEQ(d,"format")) return KEY_format;
- if (strEQ(d,"fileno")) return -KEY_fileno;
- break;
- case 7:
- if (strEQ(d,"foreach")) return KEY_foreach;
- break;
- case 8:
- if (strEQ(d,"formline")) return -KEY_formline;
- break;
- }
- break;
- case 'g':
- if (strnEQ(d,"get",3)) {
- d += 3;
- if (*d == 'p') {
- switch (len) {
- case 7:
- if (strEQ(d,"ppid")) return -KEY_getppid;
- if (strEQ(d,"pgrp")) return -KEY_getpgrp;
- break;
- case 8:
- if (strEQ(d,"pwent")) return -KEY_getpwent;
- if (strEQ(d,"pwnam")) return -KEY_getpwnam;
- if (strEQ(d,"pwuid")) return -KEY_getpwuid;
- break;
- case 11:
- if (strEQ(d,"peername")) return -KEY_getpeername;
- if (strEQ(d,"protoent")) return -KEY_getprotoent;
- if (strEQ(d,"priority")) return -KEY_getpriority;
- break;
- case 14:
- if (strEQ(d,"protobyname")) return -KEY_getprotobyname;
- break;
- case 16:
- if (strEQ(d,"protobynumber"))return -KEY_getprotobynumber;
- break;
- }
- }
- else if (*d == 'h') {
- if (strEQ(d,"hostbyname")) return -KEY_gethostbyname;
- if (strEQ(d,"hostbyaddr")) return -KEY_gethostbyaddr;
- if (strEQ(d,"hostent")) return -KEY_gethostent;
- }
- else if (*d == 'n') {
- if (strEQ(d,"netbyname")) return -KEY_getnetbyname;
- if (strEQ(d,"netbyaddr")) return -KEY_getnetbyaddr;
- if (strEQ(d,"netent")) return -KEY_getnetent;
- }
- else if (*d == 's') {
- if (strEQ(d,"servbyname")) return -KEY_getservbyname;
- if (strEQ(d,"servbyport")) return -KEY_getservbyport;
- if (strEQ(d,"servent")) return -KEY_getservent;
- if (strEQ(d,"sockname")) return -KEY_getsockname;
- if (strEQ(d,"sockopt")) return -KEY_getsockopt;
- }
- else if (*d == 'g') {
- if (strEQ(d,"grent")) return -KEY_getgrent;
- if (strEQ(d,"grnam")) return -KEY_getgrnam;
- if (strEQ(d,"grgid")) return -KEY_getgrgid;
- }
- else if (*d == 'l') {
- if (strEQ(d,"login")) return -KEY_getlogin;
- }
- else if (*d == 'c' && d[1] == '\0') return -KEY_getc;
- break;
- }
- switch (len) {
- case 2:
- if (strEQ(d,"gt")) return -KEY_gt;
- if (strEQ(d,"ge")) return -KEY_ge;
- break;
- case 4:
- if (strEQ(d,"grep")) return KEY_grep;
- if (strEQ(d,"goto")) return KEY_goto;
- if (strEQ(d,"glob")) return KEY_glob;
- break;
- case 6:
- if (strEQ(d,"gmtime")) return -KEY_gmtime;
- break;
- }
- break;
- case 'h':
- if (strEQ(d,"hex")) return -KEY_hex;
- break;
- case 'I':
- if (strEQ(d,"INIT")) return KEY_INIT;
- break;
- case 'i':
- switch (len) {
- case 2:
- if (strEQ(d,"if")) return KEY_if;
- break;
- case 3:
- if (strEQ(d,"int")) return -KEY_int;
- break;
- case 5:
- if (strEQ(d,"index")) return -KEY_index;
- if (strEQ(d,"ioctl")) return -KEY_ioctl;
- break;
- }
- break;
- case 'j':
- if (strEQ(d,"join")) return -KEY_join;
- break;
- case 'k':
- if (len == 4) {
- if (strEQ(d,"keys")) return -KEY_keys;
- if (strEQ(d,"kill")) return -KEY_kill;
- }
- break;
- case 'l':
- switch (len) {
- case 2:
- if (strEQ(d,"lt")) return -KEY_lt;
- if (strEQ(d,"le")) return -KEY_le;
- if (strEQ(d,"lc")) return -KEY_lc;
- break;
- case 3:
- if (strEQ(d,"log")) return -KEY_log;
- break;
- case 4:
- if (strEQ(d,"last")) return KEY_last;
- if (strEQ(d,"link")) return -KEY_link;
- if (strEQ(d,"lock")) return -KEY_lock;
- break;
- case 5:
- if (strEQ(d,"local")) return KEY_local;
- if (strEQ(d,"lstat")) return -KEY_lstat;
- break;
- case 6:
- if (strEQ(d,"length")) return -KEY_length;
- if (strEQ(d,"listen")) return -KEY_listen;
- break;
- case 7:
- if (strEQ(d,"lcfirst")) return -KEY_lcfirst;
- break;
- case 9:
- if (strEQ(d,"localtime")) return -KEY_localtime;
- break;
- }
- break;
- case 'm':
- switch (len) {
- case 1: return KEY_m;
- case 2:
- if (strEQ(d,"my")) return KEY_my;
- break;
- case 3:
- if (strEQ(d,"map")) return KEY_map;
- break;
- case 5:
- if (strEQ(d,"mkdir")) return -KEY_mkdir;
- break;
- case 6:
- if (strEQ(d,"msgctl")) return -KEY_msgctl;
- if (strEQ(d,"msgget")) return -KEY_msgget;
- if (strEQ(d,"msgrcv")) return -KEY_msgrcv;
- if (strEQ(d,"msgsnd")) return -KEY_msgsnd;
- break;
- }
- break;
- case 'n':
- if (strEQ(d,"next")) return KEY_next;
- if (strEQ(d,"ne")) return -KEY_ne;
- if (strEQ(d,"not")) return -KEY_not;
- if (strEQ(d,"no")) return KEY_no;
- break;
- case 'o':
- switch (len) {
- case 2:
- if (strEQ(d,"or")) return -KEY_or;
- break;
- case 3:
- if (strEQ(d,"ord")) return -KEY_ord;
- if (strEQ(d,"oct")) return -KEY_oct;
- if (strEQ(d,"our")) return KEY_our;
- break;
- case 4:
- if (strEQ(d,"open")) return -KEY_open;
- break;
- case 7:
- if (strEQ(d,"opendir")) return -KEY_opendir;
- break;
- }
- break;
- case 'p':
- switch (len) {
- case 3:
- if (strEQ(d,"pop")) return -KEY_pop;
- if (strEQ(d,"pos")) return KEY_pos;
- break;
- case 4:
- if (strEQ(d,"push")) return -KEY_push;
- if (strEQ(d,"pack")) return -KEY_pack;
- if (strEQ(d,"pipe")) return -KEY_pipe;
- break;
- case 5:
- if (strEQ(d,"print")) return KEY_print;
- break;
- case 6:
- if (strEQ(d,"printf")) return KEY_printf;
- break;
- case 7:
- if (strEQ(d,"package")) return KEY_package;
- break;
- case 9:
- if (strEQ(d,"prototype")) return KEY_prototype;
- }
- break;
- case 'q':
- if (len == 1) {
- return KEY_q;
- }
- else if (len == 2) {
- switch (d[1]) {
- case 'r': return KEY_qr;
- case 'q': return KEY_qq;
- case 'w': return KEY_qw;
- case 'x': return KEY_qx;
- };
- }
- else if (strEQ(d,"quotemeta")) return -KEY_quotemeta;
- break;
- case 'r':
- switch (len) {
- case 3:
- if (strEQ(d,"ref")) return -KEY_ref;
- break;
- case 4:
- if (strEQ(d,"read")) return -KEY_read;
- if (strEQ(d,"rand")) return -KEY_rand;
- if (strEQ(d,"recv")) return -KEY_recv;
- if (strEQ(d,"redo")) return KEY_redo;
- break;
- case 5:
- if (strEQ(d,"rmdir")) return -KEY_rmdir;
- if (strEQ(d,"reset")) return -KEY_reset;
- break;
- case 6:
- if (strEQ(d,"return")) return KEY_return;
- if (strEQ(d,"rename")) return -KEY_rename;
- if (strEQ(d,"rindex")) return -KEY_rindex;
- break;
- case 7:
- if (strEQ(d,"require")) return KEY_require;
- if (strEQ(d,"reverse")) return -KEY_reverse;
- if (strEQ(d,"readdir")) return -KEY_readdir;
- break;
- case 8:
- if (strEQ(d,"readlink")) return -KEY_readlink;
- if (strEQ(d,"readline")) return -KEY_readline;
- if (strEQ(d,"readpipe")) return -KEY_readpipe;
- break;
- case 9:
- if (strEQ(d,"rewinddir")) return -KEY_rewinddir;
- break;
- }
- break;
- case 's':
- switch (d[1]) {
- case 0: return KEY_s;
- case 'c':
- if (strEQ(d,"scalar")) return KEY_scalar;
- break;
- case 'e':
- switch (len) {
- case 4:
- if (strEQ(d,"seek")) return -KEY_seek;
- if (strEQ(d,"send")) return -KEY_send;
- break;
- case 5:
- if (strEQ(d,"semop")) return -KEY_semop;
- break;
- case 6:
- if (strEQ(d,"select")) return -KEY_select;
- if (strEQ(d,"semctl")) return -KEY_semctl;
- if (strEQ(d,"semget")) return -KEY_semget;
- break;
- case 7:
- if (strEQ(d,"setpgrp")) return -KEY_setpgrp;
- if (strEQ(d,"seekdir")) return -KEY_seekdir;
- break;
- case 8:
- if (strEQ(d,"setpwent")) return -KEY_setpwent;
- if (strEQ(d,"setgrent")) return -KEY_setgrent;
- break;
- case 9:
- if (strEQ(d,"setnetent")) return -KEY_setnetent;
- break;
- case 10:
- if (strEQ(d,"setsockopt")) return -KEY_setsockopt;
- if (strEQ(d,"sethostent")) return -KEY_sethostent;
- if (strEQ(d,"setservent")) return -KEY_setservent;
- break;
- case 11:
- if (strEQ(d,"setpriority")) return -KEY_setpriority;
- if (strEQ(d,"setprotoent")) return -KEY_setprotoent;
- break;
- }
- break;
- case 'h':
- switch (len) {
- case 5:
- if (strEQ(d,"shift")) return -KEY_shift;
- break;
- case 6:
- if (strEQ(d,"shmctl")) return -KEY_shmctl;
- if (strEQ(d,"shmget")) return -KEY_shmget;
- break;
- case 7:
- if (strEQ(d,"shmread")) return -KEY_shmread;
- break;
- case 8:
- if (strEQ(d,"shmwrite")) return -KEY_shmwrite;
- if (strEQ(d,"shutdown")) return -KEY_shutdown;
- break;
- }
- break;
- case 'i':
- if (strEQ(d,"sin")) return -KEY_sin;
- break;
- case 'l':
- if (strEQ(d,"sleep")) return -KEY_sleep;
- break;
- case 'o':
- if (strEQ(d,"sort")) return KEY_sort;
- if (strEQ(d,"socket")) return -KEY_socket;
- if (strEQ(d,"socketpair")) return -KEY_socketpair;
- break;
- case 'p':
- if (strEQ(d,"split")) return KEY_split;
- if (strEQ(d,"sprintf")) return -KEY_sprintf;
- if (strEQ(d,"splice")) return -KEY_splice;
- break;
- case 'q':
- if (strEQ(d,"sqrt")) return -KEY_sqrt;
- break;
- case 'r':
- if (strEQ(d,"srand")) return -KEY_srand;
- break;
- case 't':
- if (strEQ(d,"stat")) return -KEY_stat;
- if (strEQ(d,"study")) return KEY_study;
- break;
- case 'u':
- if (strEQ(d,"substr")) return -KEY_substr;
- if (strEQ(d,"sub")) return KEY_sub;
- break;
- case 'y':
- switch (len) {
- case 6:
- if (strEQ(d,"system")) return -KEY_system;
- break;
- case 7:
- if (strEQ(d,"symlink")) return -KEY_symlink;
- if (strEQ(d,"syscall")) return -KEY_syscall;
- if (strEQ(d,"sysopen")) return -KEY_sysopen;
- if (strEQ(d,"sysread")) return -KEY_sysread;
- if (strEQ(d,"sysseek")) return -KEY_sysseek;
- break;
- case 8:
- if (strEQ(d,"syswrite")) return -KEY_syswrite;
- break;
- }
- break;
- }
- break;
- case 't':
- switch (len) {
- case 2:
- if (strEQ(d,"tr")) return KEY_tr;
- break;
- case 3:
- if (strEQ(d,"tie")) return KEY_tie;
- break;
- case 4:
- if (strEQ(d,"tell")) return -KEY_tell;
- if (strEQ(d,"tied")) return KEY_tied;
- if (strEQ(d,"time")) return -KEY_time;
- break;
- case 5:
- if (strEQ(d,"times")) return -KEY_times;
- break;
- case 7:
- if (strEQ(d,"telldir")) return -KEY_telldir;
- break;
- case 8:
- if (strEQ(d,"truncate")) return -KEY_truncate;
- break;
- }
- break;
- case 'u':
- switch (len) {
- case 2:
- if (strEQ(d,"uc")) return -KEY_uc;
- break;
- case 3:
- if (strEQ(d,"use")) return KEY_use;
- break;
- case 5:
- if (strEQ(d,"undef")) return KEY_undef;
- if (strEQ(d,"until")) return KEY_until;
- if (strEQ(d,"untie")) return KEY_untie;
- if (strEQ(d,"utime")) return -KEY_utime;
- if (strEQ(d,"umask")) return -KEY_umask;
- break;
- case 6:
- if (strEQ(d,"unless")) return KEY_unless;
- if (strEQ(d,"unpack")) return -KEY_unpack;
- if (strEQ(d,"unlink")) return -KEY_unlink;
- break;
- case 7:
- if (strEQ(d,"unshift")) return -KEY_unshift;
- if (strEQ(d,"ucfirst")) return -KEY_ucfirst;
- break;
- }
- break;
- case 'v':
- if (strEQ(d,"values")) return -KEY_values;
- if (strEQ(d,"vec")) return -KEY_vec;
- break;
- case 'w':
- switch (len) {
- case 4:
- if (strEQ(d,"warn")) return -KEY_warn;
- if (strEQ(d,"wait")) return -KEY_wait;
- break;
- case 5:
- if (strEQ(d,"while")) return KEY_while;
- if (strEQ(d,"write")) return -KEY_write;
- break;
- case 7:
- if (strEQ(d,"waitpid")) return -KEY_waitpid;
- break;
- case 9:
- if (strEQ(d,"wantarray")) return -KEY_wantarray;
- break;
- }
- break;
- case 'x':
- if (len == 1) return -KEY_x;
- if (strEQ(d,"xor")) return -KEY_xor;
- break;
- case 'y':
- if (len == 1) return KEY_y;
- break;
- case 'z':
- break;
- }
- return 0;
+ switch (len)
+ {
+ case 1: /* 5 tokens of length 1 */
+ switch (name[0])
+ {
+ case 'm':
+ { /* m */
+ return KEY_m;
+ }
+
+ case 'q':
+ { /* q */
+ return KEY_q;
+ }
+
+ case 's':
+ { /* s */
+ return KEY_s;
+ }
+
+ case 'x':
+ { /* x */
+ return -KEY_x;
+ }
+
+ case 'y':
+ { /* y */
+ return KEY_y;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 2: /* 18 tokens of length 2 */
+ switch (name[0])
+ {
+ case 'd':
+ if (name[1] == 'o')
+ { /* do */
+ return KEY_do;
+ }
+
+ goto unknown;
+
+ case 'e':
+ if (name[1] == 'q')
+ { /* eq */
+ return -KEY_eq;
+ }
+
+ goto unknown;
+
+ case 'g':
+ switch (name[1])
+ {
+ case 'e':
+ { /* ge */
+ return -KEY_ge;
+ }
+
+ case 't':
+ { /* gt */
+ return -KEY_gt;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 'i':
+ if (name[1] == 'f')
+ { /* if */
+ return KEY_if;
+ }
+
+ goto unknown;
+
+ case 'l':
+ switch (name[1])
+ {
+ case 'c':
+ { /* lc */
+ return -KEY_lc;
+ }
+
+ case 'e':
+ { /* le */
+ return -KEY_le;
+ }
+
+ case 't':
+ { /* lt */
+ return -KEY_lt;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 'm':
+ if (name[1] == 'y')
+ { /* my */
+ return KEY_my;
+ }
+
+ goto unknown;
+
+ case 'n':
+ switch (name[1])
+ {
+ case 'e':
+ { /* ne */
+ return -KEY_ne;
+ }
+
+ case 'o':
+ { /* no */
+ return KEY_no;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 'o':
+ if (name[1] == 'r')
+ { /* or */
+ return -KEY_or;
+ }
+
+ goto unknown;
+
+ case 'q':
+ switch (name[1])
+ {
+ case 'q':
+ { /* qq */
+ return KEY_qq;
+ }
+
+ case 'r':
+ { /* qr */
+ return KEY_qr;
+ }
+
+ case 'w':
+ { /* qw */
+ return KEY_qw;
+ }
+
+ case 'x':
+ { /* qx */
+ return KEY_qx;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 't':
+ if (name[1] == 'r')
+ { /* tr */
+ return KEY_tr;
+ }
+
+ goto unknown;
+
+ case 'u':
+ if (name[1] == 'c')
+ { /* uc */
+ return -KEY_uc;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 3: /* 28 tokens of length 3 */
+ switch (name[0])
+ {
+ case 'E':
+ if (name[1] == 'N' &&
+ name[2] == 'D')
+ { /* END */
+ return KEY_END;
+ }
+
+ goto unknown;
+
+ case 'a':
+ switch (name[1])
+ {
+ case 'b':
+ if (name[2] == 's')
+ { /* abs */
+ return -KEY_abs;
+ }
+
+ goto unknown;
+
+ case 'n':
+ if (name[2] == 'd')
+ { /* and */
+ return -KEY_and;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'c':
+ switch (name[1])
+ {
+ case 'h':
+ if (name[2] == 'r')
+ { /* chr */
+ return -KEY_chr;
+ }
+
+ goto unknown;
+
+ case 'm':
+ if (name[2] == 'p')
+ { /* cmp */
+ return -KEY_cmp;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[2] == 's')
+ { /* cos */
+ return -KEY_cos;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'd':
+ if (name[1] == 'i' &&
+ name[2] == 'e')
+ { /* die */
+ return -KEY_die;
+ }
+
+ goto unknown;
+
+ case 'e':
+ switch (name[1])
+ {
+ case 'o':
+ if (name[2] == 'f')
+ { /* eof */
+ return -KEY_eof;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[2] == 'r')
+ { /* err */
+ return -KEY_err;
+ }
+
+ goto unknown;
+
+ case 'x':
+ if (name[2] == 'p')
+ { /* exp */
+ return -KEY_exp;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'f':
+ if (name[1] == 'o' &&
+ name[2] == 'r')
+ { /* for */
+ return KEY_for;
+ }
+
+ goto unknown;
+
+ case 'h':
+ if (name[1] == 'e' &&
+ name[2] == 'x')
+ { /* hex */
+ return -KEY_hex;
+ }
+
+ goto unknown;
+
+ case 'i':
+ if (name[1] == 'n' &&
+ name[2] == 't')
+ { /* int */
+ return -KEY_int;
+ }
+
+ goto unknown;
+
+ case 'l':
+ if (name[1] == 'o' &&
+ name[2] == 'g')
+ { /* log */
+ return -KEY_log;
+ }
+
+ goto unknown;
+
+ case 'm':
+ if (name[1] == 'a' &&
+ name[2] == 'p')
+ { /* map */
+ return KEY_map;
+ }
+
+ goto unknown;
+
+ case 'n':
+ if (name[1] == 'o' &&
+ name[2] == 't')
+ { /* not */
+ return -KEY_not;
+ }
+
+ goto unknown;
+
+ case 'o':
+ switch (name[1])
+ {
+ case 'c':
+ if (name[2] == 't')
+ { /* oct */
+ return -KEY_oct;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[2] == 'd')
+ { /* ord */
+ return -KEY_ord;
+ }
+
+ goto unknown;
+
+ case 'u':
+ if (name[2] == 'r')
+ { /* our */
+ return KEY_our;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'p':
+ if (name[1] == 'o')
+ {
+ switch (name[2])
+ {
+ case 'p':
+ { /* pop */
+ return -KEY_pop;
+ }
+
+ case 's':
+ { /* pos */
+ return KEY_pos;
+ }
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[1] == 'e' &&
+ name[2] == 'f')
+ { /* ref */
+ return -KEY_ref;
+ }
+
+ goto unknown;
+
+ case 's':
+ switch (name[1])
+ {
+ case 'i':
+ if (name[2] == 'n')
+ { /* sin */
+ return -KEY_sin;
+ }
+
+ goto unknown;
+
+ case 'u':
+ if (name[2] == 'b')
+ { /* sub */
+ return KEY_sub;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 't':
+ if (name[1] == 'i' &&
+ name[2] == 'e')
+ { /* tie */
+ return KEY_tie;
+ }
+
+ goto unknown;
+
+ case 'u':
+ if (name[1] == 's' &&
+ name[2] == 'e')
+ { /* use */
+ return KEY_use;
+ }
+
+ goto unknown;
+
+ case 'v':
+ if (name[1] == 'e' &&
+ name[2] == 'c')
+ { /* vec */
+ return -KEY_vec;
+ }
+
+ goto unknown;
+
+ case 'x':
+ if (name[1] == 'o' &&
+ name[2] == 'r')
+ { /* xor */
+ return -KEY_xor;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 4: /* 40 tokens of length 4 */
+ switch (name[0])
+ {
+ case 'C':
+ if (name[1] == 'O' &&
+ name[2] == 'R' &&
+ name[3] == 'E')
+ { /* CORE */
+ return -KEY_CORE;
+ }
+
+ goto unknown;
+
+ case 'I':
+ if (name[1] == 'N' &&
+ name[2] == 'I' &&
+ name[3] == 'T')
+ { /* INIT */
+ return KEY_INIT;
+ }
+
+ goto unknown;
+
+ case 'b':
+ if (name[1] == 'i' &&
+ name[2] == 'n' &&
+ name[3] == 'd')
+ { /* bind */
+ return -KEY_bind;
+ }
+
+ goto unknown;
+
+ case 'c':
+ if (name[1] == 'h' &&
+ name[2] == 'o' &&
+ name[3] == 'p')
+ { /* chop */
+ return -KEY_chop;
+ }
+
+ goto unknown;
+
+ case 'd':
+ if (name[1] == 'u' &&
+ name[2] == 'm' &&
+ name[3] == 'p')
+ { /* dump */
+ return -KEY_dump;
+ }
+
+ goto unknown;
+
+ case 'e':
+ switch (name[1])
+ {
+ case 'a':
+ if (name[2] == 'c' &&
+ name[3] == 'h')
+ { /* each */
+ return -KEY_each;
+ }
+
+ goto unknown;
+
+ case 'l':
+ if (name[2] == 's' &&
+ name[3] == 'e')
+ { /* else */
+ return KEY_else;
+ }
+
+ goto unknown;
+
+ case 'v':
+ if (name[2] == 'a' &&
+ name[3] == 'l')
+ { /* eval */
+ return KEY_eval;
+ }
+
+ goto unknown;
+
+ case 'x':
+ switch (name[2])
+ {
+ case 'e':
+ if (name[3] == 'c')
+ { /* exec */
+ return -KEY_exec;
+ }
+
+ goto unknown;
+
+ case 'i':
+ if (name[3] == 't')
+ { /* exit */
+ return -KEY_exit;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 'f':
+ if (name[1] == 'o' &&
+ name[2] == 'r' &&
+ name[3] == 'k')
+ { /* fork */
+ return -KEY_fork;
+ }
+
+ goto unknown;
+
+ case 'g':
+ switch (name[1])
+ {
+ case 'e':
+ if (name[2] == 't' &&
+ name[3] == 'c')
+ { /* getc */
+ return -KEY_getc;
+ }
+
+ goto unknown;
+
+ case 'l':
+ if (name[2] == 'o' &&
+ name[3] == 'b')
+ { /* glob */
+ return KEY_glob;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[2] == 't' &&
+ name[3] == 'o')
+ { /* goto */
+ return KEY_goto;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[2] == 'e' &&
+ name[3] == 'p')
+ { /* grep */
+ return KEY_grep;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'j':
+ if (name[1] == 'o' &&
+ name[2] == 'i' &&
+ name[3] == 'n')
+ { /* join */
+ return -KEY_join;
+ }
+
+ goto unknown;
+
+ case 'k':
+ switch (name[1])
+ {
+ case 'e':
+ if (name[2] == 'y' &&
+ name[3] == 's')
+ { /* keys */
+ return -KEY_keys;
+ }
+
+ goto unknown;
+
+ case 'i':
+ if (name[2] == 'l' &&
+ name[3] == 'l')
+ { /* kill */
+ return -KEY_kill;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'l':
+ switch (name[1])
+ {
+ case 'a':
+ if (name[2] == 's' &&
+ name[3] == 't')
+ { /* last */
+ return KEY_last;
+ }
+
+ goto unknown;
+
+ case 'i':
+ if (name[2] == 'n' &&
+ name[3] == 'k')
+ { /* link */
+ return -KEY_link;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[2] == 'c' &&
+ name[3] == 'k')
+ { /* lock */
+ return -KEY_lock;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'n':
+ if (name[1] == 'e' &&
+ name[2] == 'x' &&
+ name[3] == 't')
+ { /* next */
+ return KEY_next;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[1] == 'p' &&
+ name[2] == 'e' &&
+ name[3] == 'n')
+ { /* open */
+ return -KEY_open;
+ }
+
+ goto unknown;
+
+ case 'p':
+ switch (name[1])
+ {
+ case 'a':
+ if (name[2] == 'c' &&
+ name[3] == 'k')
+ { /* pack */
+ return -KEY_pack;
+ }
+
+ goto unknown;
+
+ case 'i':
+ if (name[2] == 'p' &&
+ name[3] == 'e')
+ { /* pipe */
+ return -KEY_pipe;
+ }
+
+ goto unknown;
+
+ case 'u':
+ if (name[2] == 's' &&
+ name[3] == 'h')
+ { /* push */
+ return -KEY_push;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'r':
+ switch (name[1])
+ {
+ case 'a':
+ if (name[2] == 'n' &&
+ name[3] == 'd')
+ { /* rand */
+ return -KEY_rand;
+ }
+
+ goto unknown;
+
+ case 'e':
+ switch (name[2])
+ {
+ case 'a':
+ if (name[3] == 'd')
+ { /* read */
+ return -KEY_read;
+ }
+
+ goto unknown;
+
+ case 'c':
+ if (name[3] == 'v')
+ { /* recv */
+ return -KEY_recv;
+ }
+
+ goto unknown;
+
+ case 'd':
+ if (name[3] == 'o')
+ { /* redo */
+ return KEY_redo;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 's':
+ switch (name[1])
+ {
+ case 'e':
+ switch (name[2])
+ {
+ case 'e':
+ if (name[3] == 'k')
+ { /* seek */
+ return -KEY_seek;
+ }
+
+ goto unknown;
+
+ case 'n':
+ if (name[3] == 'd')
+ { /* send */
+ return -KEY_send;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'o':
+ if (name[2] == 'r' &&
+ name[3] == 't')
+ { /* sort */
+ return KEY_sort;
+ }
+
+ goto unknown;
+
+ case 'q':
+ if (name[2] == 'r' &&
+ name[3] == 't')
+ { /* sqrt */
+ return -KEY_sqrt;
+ }
+
+ goto unknown;
+
+ case 't':
+ if (name[2] == 'a' &&
+ name[3] == 't')
+ { /* stat */
+ return -KEY_stat;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 't':
+ switch (name[1])
+ {
+ case 'e':
+ if (name[2] == 'l' &&
+ name[3] == 'l')
+ { /* tell */
+ return -KEY_tell;
+ }
+
+ goto unknown;
+
+ case 'i':
+ switch (name[2])
+ {
+ case 'e':
+ if (name[3] == 'd')
+ { /* tied */
+ return KEY_tied;
+ }
+
+ goto unknown;
+
+ case 'm':
+ if (name[3] == 'e')
+ { /* time */
+ return -KEY_time;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 'w':
+ if (name[1] == 'a')
+ {
+ switch (name[2])
+ {
+ case 'i':
+ if (name[3] == 't')
+ { /* wait */
+ return -KEY_wait;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[3] == 'n')
+ { /* warn */
+ return -KEY_warn;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 5: /* 36 tokens of length 5 */
+ switch (name[0])
+ {
+ case 'B':
+ if (name[1] == 'E' &&
+ name[2] == 'G' &&
+ name[3] == 'I' &&
+ name[4] == 'N')
+ { /* BEGIN */
+ return KEY_BEGIN;
+ }
+
+ goto unknown;
+
+ case 'C':
+ if (name[1] == 'H' &&
+ name[2] == 'E' &&
+ name[3] == 'C' &&
+ name[4] == 'K')
+ { /* CHECK */
+ return KEY_CHECK;
+ }
+
+ goto unknown;
+
+ case 'a':
+ switch (name[1])
+ {
+ case 'l':
+ if (name[2] == 'a' &&
+ name[3] == 'r' &&
+ name[4] == 'm')
+ { /* alarm */
+ return -KEY_alarm;
+ }
+
+ goto unknown;
+
+ case 't':
+ if (name[2] == 'a' &&
+ name[3] == 'n' &&
+ name[4] == '2')
+ { /* atan2 */
+ return -KEY_atan2;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'b':
+ if (name[1] == 'l' &&
+ name[2] == 'e' &&
+ name[3] == 's' &&
+ name[4] == 's')
+ { /* bless */
+ return -KEY_bless;
+ }
+
+ goto unknown;
+
+ case 'c':
+ switch (name[1])
+ {
+ case 'h':
+ switch (name[2])
+ {
+ case 'd':
+ if (name[3] == 'i' &&
+ name[4] == 'r')
+ { /* chdir */
+ return -KEY_chdir;
+ }
+
+ goto unknown;
+
+ case 'm':
+ if (name[3] == 'o' &&
+ name[4] == 'd')
+ { /* chmod */
+ return -KEY_chmod;
+ }
+
+ goto unknown;
+
+ case 'o':
+ switch (name[3])
+ {
+ case 'm':
+ if (name[4] == 'p')
+ { /* chomp */
+ return -KEY_chomp;
+ }
+
+ goto unknown;
+
+ case 'w':
+ if (name[4] == 'n')
+ { /* chown */
+ return -KEY_chown;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 'l':
+ if (name[2] == 'o' &&
+ name[3] == 's' &&
+ name[4] == 'e')
+ { /* close */
+ return -KEY_close;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[2] == 'y' &&
+ name[3] == 'p' &&
+ name[4] == 't')
+ { /* crypt */
+ return -KEY_crypt;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'e':
+ if (name[1] == 'l' &&
+ name[2] == 's' &&
+ name[3] == 'i' &&
+ name[4] == 'f')
+ { /* elsif */
+ return KEY_elsif;
+ }
+
+ goto unknown;
+
+ case 'f':
+ switch (name[1])
+ {
+ case 'c':
+ if (name[2] == 'n' &&
+ name[3] == 't' &&
+ name[4] == 'l')
+ { /* fcntl */
+ return -KEY_fcntl;
+ }
+
+ goto unknown;
+
+ case 'l':
+ if (name[2] == 'o' &&
+ name[3] == 'c' &&
+ name[4] == 'k')
+ { /* flock */
+ return -KEY_flock;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'i':
+ switch (name[1])
+ {
+ case 'n':
+ if (name[2] == 'd' &&
+ name[3] == 'e' &&
+ name[4] == 'x')
+ { /* index */
+ return -KEY_index;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[2] == 'c' &&
+ name[3] == 't' &&
+ name[4] == 'l')
+ { /* ioctl */
+ return -KEY_ioctl;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'l':
+ switch (name[1])
+ {
+ case 'o':
+ if (name[2] == 'c' &&
+ name[3] == 'a' &&
+ name[4] == 'l')
+ { /* local */
+ return KEY_local;
+ }
+
+ goto unknown;
+
+ case 's':
+ if (name[2] == 't' &&
+ name[3] == 'a' &&
+ name[4] == 't')
+ { /* lstat */
+ return -KEY_lstat;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'm':
+ if (name[1] == 'k' &&
+ name[2] == 'd' &&
+ name[3] == 'i' &&
+ name[4] == 'r')
+ { /* mkdir */
+ return -KEY_mkdir;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[1] == 'r' &&
+ name[2] == 'i' &&
+ name[3] == 'n' &&
+ name[4] == 't')
+ { /* print */
+ return KEY_print;
+ }
+
+ goto unknown;
+
+ case 'r':
+ switch (name[1])
+ {
+ case 'e':
+ if (name[2] == 's' &&
+ name[3] == 'e' &&
+ name[4] == 't')
+ { /* reset */
+ return -KEY_reset;
+ }
+
+ goto unknown;
+
+ case 'm':
+ if (name[2] == 'd' &&
+ name[3] == 'i' &&
+ name[4] == 'r')
+ { /* rmdir */
+ return -KEY_rmdir;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 's':
+ switch (name[1])
+ {
+ case 'e':
+ if (name[2] == 'm' &&
+ name[3] == 'o' &&
+ name[4] == 'p')
+ { /* semop */
+ return -KEY_semop;
+ }
+
+ goto unknown;
+
+ case 'h':
+ if (name[2] == 'i' &&
+ name[3] == 'f' &&
+ name[4] == 't')
+ { /* shift */
+ return -KEY_shift;
+ }
+
+ goto unknown;
+
+ case 'l':
+ if (name[2] == 'e' &&
+ name[3] == 'e' &&
+ name[4] == 'p')
+ { /* sleep */
+ return -KEY_sleep;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[2] == 'l' &&
+ name[3] == 'i' &&
+ name[4] == 't')
+ { /* split */
+ return KEY_split;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[2] == 'a' &&
+ name[3] == 'n' &&
+ name[4] == 'd')
+ { /* srand */
+ return -KEY_srand;
+ }
+
+ goto unknown;
+
+ case 't':
+ if (name[2] == 'u' &&
+ name[3] == 'd' &&
+ name[4] == 'y')
+ { /* study */
+ return KEY_study;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 't':
+ if (name[1] == 'i' &&
+ name[2] == 'm' &&
+ name[3] == 'e' &&
+ name[4] == 's')
+ { /* times */
+ return -KEY_times;
+ }
+
+ goto unknown;
+
+ case 'u':
+ switch (name[1])
+ {
+ case 'm':
+ if (name[2] == 'a' &&
+ name[3] == 's' &&
+ name[4] == 'k')
+ { /* umask */
+ return -KEY_umask;
+ }
+
+ goto unknown;
+
+ case 'n':
+ switch (name[2])
+ {
+ case 'd':
+ if (name[3] == 'e' &&
+ name[4] == 'f')
+ { /* undef */
+ return KEY_undef;
+ }
+
+ goto unknown;
+
+ case 't':
+ if (name[3] == 'i')
+ {
+ switch (name[4])
+ {
+ case 'e':
+ { /* untie */
+ return KEY_untie;
+ }
+
+ case 'l':
+ { /* until */
+ return KEY_until;
+ }
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 't':
+ if (name[2] == 'i' &&
+ name[3] == 'm' &&
+ name[4] == 'e')
+ { /* utime */
+ return -KEY_utime;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'w':
+ switch (name[1])
+ {
+ case 'h':
+ if (name[2] == 'i' &&
+ name[3] == 'l' &&
+ name[4] == 'e')
+ { /* while */
+ return KEY_while;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[2] == 'i' &&
+ name[3] == 't' &&
+ name[4] == 'e')
+ { /* write */
+ return -KEY_write;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 6: /* 33 tokens of length 6 */
+ switch (name[0])
+ {
+ case 'a':
+ if (name[1] == 'c' &&
+ name[2] == 'c' &&
+ name[3] == 'e' &&
+ name[4] == 'p' &&
+ name[5] == 't')
+ { /* accept */
+ return -KEY_accept;
+ }
+
+ goto unknown;
+
+ case 'c':
+ switch (name[1])
+ {
+ case 'a':
+ if (name[2] == 'l' &&
+ name[3] == 'l' &&
+ name[4] == 'e' &&
+ name[5] == 'r')
+ { /* caller */
+ return -KEY_caller;
+ }
+
+ goto unknown;
+
+ case 'h':
+ if (name[2] == 'r' &&
+ name[3] == 'o' &&
+ name[4] == 'o' &&
+ name[5] == 't')
+ { /* chroot */
+ return -KEY_chroot;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'd':
+ if (name[1] == 'e' &&
+ name[2] == 'l' &&
+ name[3] == 'e' &&
+ name[4] == 't' &&
+ name[5] == 'e')
+ { /* delete */
+ return KEY_delete;
+ }
+
+ goto unknown;
+
+ case 'e':
+ switch (name[1])
+ {
+ case 'l':
+ if (name[2] == 's' &&
+ name[3] == 'e' &&
+ name[4] == 'i' &&
+ name[5] == 'f')
+ { /* elseif */
+ if(ckWARN_d(WARN_SYNTAX))
+ Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "elseif should be elsif");
+ }
+
+ goto unknown;
+
+ case 'x':
+ if (name[2] == 'i' &&
+ name[3] == 's' &&
+ name[4] == 't' &&
+ name[5] == 's')
+ { /* exists */
+ return KEY_exists;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'f':
+ switch (name[1])
+ {
+ case 'i':
+ if (name[2] == 'l' &&
+ name[3] == 'e' &&
+ name[4] == 'n' &&
+ name[5] == 'o')
+ { /* fileno */
+ return -KEY_fileno;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[2] == 'r' &&
+ name[3] == 'm' &&
+ name[4] == 'a' &&
+ name[5] == 't')
+ { /* format */
+ return KEY_format;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'g':
+ if (name[1] == 'm' &&
+ name[2] == 't' &&
+ name[3] == 'i' &&
+ name[4] == 'm' &&
+ name[5] == 'e')
+ { /* gmtime */
+ return -KEY_gmtime;
+ }
+
+ goto unknown;
+
+ case 'l':
+ switch (name[1])
+ {
+ case 'e':
+ if (name[2] == 'n' &&
+ name[3] == 'g' &&
+ name[4] == 't' &&
+ name[5] == 'h')
+ { /* length */
+ return -KEY_length;
+ }
+
+ goto unknown;
+
+ case 'i':
+ if (name[2] == 's' &&
+ name[3] == 't' &&
+ name[4] == 'e' &&
+ name[5] == 'n')
+ { /* listen */
+ return -KEY_listen;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'm':
+ if (name[1] == 's' &&
+ name[2] == 'g')
+ {
+ switch (name[3])
+ {
+ case 'c':
+ if (name[4] == 't' &&
+ name[5] == 'l')
+ { /* msgctl */
+ return -KEY_msgctl;
+ }
+
+ goto unknown;
+
+ case 'g':
+ if (name[4] == 'e' &&
+ name[5] == 't')
+ { /* msgget */
+ return -KEY_msgget;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[4] == 'c' &&
+ name[5] == 'v')
+ { /* msgrcv */
+ return -KEY_msgrcv;
+ }
+
+ goto unknown;
+
+ case 's':
+ if (name[4] == 'n' &&
+ name[5] == 'd')
+ { /* msgsnd */
+ return -KEY_msgsnd;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[1] == 'r' &&
+ name[2] == 'i' &&
+ name[3] == 'n' &&
+ name[4] == 't' &&
+ name[5] == 'f')
+ { /* printf */
+ return KEY_printf;
+ }
+
+ goto unknown;
+
+ case 'r':
+ switch (name[1])
+ {
+ case 'e':
+ switch (name[2])
+ {
+ case 'n':
+ if (name[3] == 'a' &&
+ name[4] == 'm' &&
+ name[5] == 'e')
+ { /* rename */
+ return -KEY_rename;
+ }
+
+ goto unknown;
+
+ case 't':
+ if (name[3] == 'u' &&
+ name[4] == 'r' &&
+ name[5] == 'n')
+ { /* return */
+ return KEY_return;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'i':
+ if (name[2] == 'n' &&
+ name[3] == 'd' &&
+ name[4] == 'e' &&
+ name[5] == 'x')
+ { /* rindex */
+ return -KEY_rindex;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 's':
+ switch (name[1])
+ {
+ case 'c':
+ if (name[2] == 'a' &&
+ name[3] == 'l' &&
+ name[4] == 'a' &&
+ name[5] == 'r')
+ { /* scalar */
+ return KEY_scalar;
+ }
+
+ goto unknown;
+
+ case 'e':
+ switch (name[2])
+ {
+ case 'l':
+ if (name[3] == 'e' &&
+ name[4] == 'c' &&
+ name[5] == 't')
+ { /* select */
+ return -KEY_select;
+ }
+
+ goto unknown;
+
+ case 'm':
+ switch (name[3])
+ {
+ case 'c':
+ if (name[4] == 't' &&
+ name[5] == 'l')
+ { /* semctl */
+ return -KEY_semctl;
+ }
+
+ goto unknown;
+
+ case 'g':
+ if (name[4] == 'e' &&
+ name[5] == 't')
+ { /* semget */
+ return -KEY_semget;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 'h':
+ if (name[2] == 'm')
+ {
+ switch (name[3])
+ {
+ case 'c':
+ if (name[4] == 't' &&
+ name[5] == 'l')
+ { /* shmctl */
+ return -KEY_shmctl;
+ }
+
+ goto unknown;
+
+ case 'g':
+ if (name[4] == 'e' &&
+ name[5] == 't')
+ { /* shmget */
+ return -KEY_shmget;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[2] == 'c' &&
+ name[3] == 'k' &&
+ name[4] == 'e' &&
+ name[5] == 't')
+ { /* socket */
+ return -KEY_socket;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[2] == 'l' &&
+ name[3] == 'i' &&
+ name[4] == 'c' &&
+ name[5] == 'e')
+ { /* splice */
+ return -KEY_splice;
+ }
+
+ goto unknown;
+
+ case 'u':
+ if (name[2] == 'b' &&
+ name[3] == 's' &&
+ name[4] == 't' &&
+ name[5] == 'r')
+ { /* substr */
+ return -KEY_substr;
+ }
+
+ goto unknown;
+
+ case 'y':
+ if (name[2] == 's' &&
+ name[3] == 't' &&
+ name[4] == 'e' &&
+ name[5] == 'm')
+ { /* system */
+ return -KEY_system;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'u':
+ if (name[1] == 'n')
+ {
+ switch (name[2])
+ {
+ case 'l':
+ switch (name[3])
+ {
+ case 'e':
+ if (name[4] == 's' &&
+ name[5] == 's')
+ { /* unless */
+ return KEY_unless;
+ }
+
+ goto unknown;
+
+ case 'i':
+ if (name[4] == 'n' &&
+ name[5] == 'k')
+ { /* unlink */
+ return -KEY_unlink;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'p':
+ if (name[3] == 'a' &&
+ name[4] == 'c' &&
+ name[5] == 'k')
+ { /* unpack */
+ return -KEY_unpack;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'v':
+ if (name[1] == 'a' &&
+ name[2] == 'l' &&
+ name[3] == 'u' &&
+ name[4] == 'e' &&
+ name[5] == 's')
+ { /* values */
+ return -KEY_values;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 7: /* 28 tokens of length 7 */
+ switch (name[0])
+ {
+ case 'D':
+ if (name[1] == 'E' &&
+ name[2] == 'S' &&
+ name[3] == 'T' &&
+ name[4] == 'R' &&
+ name[5] == 'O' &&
+ name[6] == 'Y')
+ { /* DESTROY */
+ return KEY_DESTROY;
+ }
+
+ goto unknown;
+
+ case '_':
+ if (name[1] == '_' &&
+ name[2] == 'E' &&
+ name[3] == 'N' &&
+ name[4] == 'D' &&
+ name[5] == '_' &&
+ name[6] == '_')
+ { /* __END__ */
+ return KEY___END__;
+ }
+
+ goto unknown;
+
+ case 'b':
+ if (name[1] == 'i' &&
+ name[2] == 'n' &&
+ name[3] == 'm' &&
+ name[4] == 'o' &&
+ name[5] == 'd' &&
+ name[6] == 'e')
+ { /* binmode */
+ return -KEY_binmode;
+ }
+
+ goto unknown;
+
+ case 'c':
+ if (name[1] == 'o' &&
+ name[2] == 'n' &&
+ name[3] == 'n' &&
+ name[4] == 'e' &&
+ name[5] == 'c' &&
+ name[6] == 't')
+ { /* connect */
+ return -KEY_connect;
+ }
+
+ goto unknown;
+
+ case 'd':
+ switch (name[1])
+ {
+ case 'b':
+ if (name[2] == 'm' &&
+ name[3] == 'o' &&
+ name[4] == 'p' &&
+ name[5] == 'e' &&
+ name[6] == 'n')
+ { /* dbmopen */
+ return -KEY_dbmopen;
+ }
+
+ goto unknown;
+
+ case 'e':
+ if (name[2] == 'f' &&
+ name[3] == 'i' &&
+ name[4] == 'n' &&
+ name[5] == 'e' &&
+ name[6] == 'd')
+ { /* defined */
+ return KEY_defined;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'f':
+ if (name[1] == 'o' &&
+ name[2] == 'r' &&
+ name[3] == 'e' &&
+ name[4] == 'a' &&
+ name[5] == 'c' &&
+ name[6] == 'h')
+ { /* foreach */
+ return KEY_foreach;
+ }
+
+ goto unknown;
+
+ case 'g':
+ if (name[1] == 'e' &&
+ name[2] == 't' &&
+ name[3] == 'p')
+ {
+ switch (name[4])
+ {
+ case 'g':
+ if (name[5] == 'r' &&
+ name[6] == 'p')
+ { /* getpgrp */
+ return -KEY_getpgrp;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[5] == 'i' &&
+ name[6] == 'd')
+ { /* getppid */
+ return -KEY_getppid;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'l':
+ if (name[1] == 'c' &&
+ name[2] == 'f' &&
+ name[3] == 'i' &&
+ name[4] == 'r' &&
+ name[5] == 's' &&
+ name[6] == 't')
+ { /* lcfirst */
+ return -KEY_lcfirst;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[1] == 'p' &&
+ name[2] == 'e' &&
+ name[3] == 'n' &&
+ name[4] == 'd' &&
+ name[5] == 'i' &&
+ name[6] == 'r')
+ { /* opendir */
+ return -KEY_opendir;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[1] == 'a' &&
+ name[2] == 'c' &&
+ name[3] == 'k' &&
+ name[4] == 'a' &&
+ name[5] == 'g' &&
+ name[6] == 'e')
+ { /* package */
+ return KEY_package;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[1] == 'e')
+ {
+ switch (name[2])
+ {
+ case 'a':
+ if (name[3] == 'd' &&
+ name[4] == 'd' &&
+ name[5] == 'i' &&
+ name[6] == 'r')
+ { /* readdir */
+ return -KEY_readdir;
+ }
+
+ goto unknown;
+
+ case 'q':
+ if (name[3] == 'u' &&
+ name[4] == 'i' &&
+ name[5] == 'r' &&
+ name[6] == 'e')
+ { /* require */
+ return KEY_require;
+ }
+
+ goto unknown;
+
+ case 'v':
+ if (name[3] == 'e' &&
+ name[4] == 'r' &&
+ name[5] == 's' &&
+ name[6] == 'e')
+ { /* reverse */
+ return -KEY_reverse;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 's':
+ switch (name[1])
+ {
+ case 'e':
+ switch (name[2])
+ {
+ case 'e':
+ if (name[3] == 'k' &&
+ name[4] == 'd' &&
+ name[5] == 'i' &&
+ name[6] == 'r')
+ { /* seekdir */
+ return -KEY_seekdir;
+ }
+
+ goto unknown;
+
+ case 't':
+ if (name[3] == 'p' &&
+ name[4] == 'g' &&
+ name[5] == 'r' &&
+ name[6] == 'p')
+ { /* setpgrp */
+ return -KEY_setpgrp;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'h':
+ if (name[2] == 'm' &&
+ name[3] == 'r' &&
+ name[4] == 'e' &&
+ name[5] == 'a' &&
+ name[6] == 'd')
+ { /* shmread */
+ return -KEY_shmread;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[2] == 'r' &&
+ name[3] == 'i' &&
+ name[4] == 'n' &&
+ name[5] == 't' &&
+ name[6] == 'f')
+ { /* sprintf */
+ return -KEY_sprintf;
+ }
+
+ goto unknown;
+
+ case 'y':
+ switch (name[2])
+ {
+ case 'm':
+ if (name[3] == 'l' &&
+ name[4] == 'i' &&
+ name[5] == 'n' &&
+ name[6] == 'k')
+ { /* symlink */
+ return -KEY_symlink;
+ }
+
+ goto unknown;
+
+ case 's':
+ switch (name[3])
+ {
+ case 'c':
+ if (name[4] == 'a' &&
+ name[5] == 'l' &&
+ name[6] == 'l')
+ { /* syscall */
+ return -KEY_syscall;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[4] == 'p' &&
+ name[5] == 'e' &&
+ name[6] == 'n')
+ { /* sysopen */
+ return -KEY_sysopen;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[4] == 'e' &&
+ name[5] == 'a' &&
+ name[6] == 'd')
+ { /* sysread */
+ return -KEY_sysread;
+ }
+
+ goto unknown;
+
+ case 's':
+ if (name[4] == 'e' &&
+ name[5] == 'e' &&
+ name[6] == 'k')
+ { /* sysseek */
+ return -KEY_sysseek;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 't':
+ if (name[1] == 'e' &&
+ name[2] == 'l' &&
+ name[3] == 'l' &&
+ name[4] == 'd' &&
+ name[5] == 'i' &&
+ name[6] == 'r')
+ { /* telldir */
+ return -KEY_telldir;
+ }
+
+ goto unknown;
+
+ case 'u':
+ switch (name[1])
+ {
+ case 'c':
+ if (name[2] == 'f' &&
+ name[3] == 'i' &&
+ name[4] == 'r' &&
+ name[5] == 's' &&
+ name[6] == 't')
+ { /* ucfirst */
+ return -KEY_ucfirst;
+ }
+
+ goto unknown;
+
+ case 'n':
+ if (name[2] == 's' &&
+ name[3] == 'h' &&
+ name[4] == 'i' &&
+ name[5] == 'f' &&
+ name[6] == 't')
+ { /* unshift */
+ return -KEY_unshift;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'w':
+ if (name[1] == 'a' &&
+ name[2] == 'i' &&
+ name[3] == 't' &&
+ name[4] == 'p' &&
+ name[5] == 'i' &&
+ name[6] == 'd')
+ { /* waitpid */
+ return -KEY_waitpid;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 8: /* 26 tokens of length 8 */
+ switch (name[0])
+ {
+ case 'A':
+ if (name[1] == 'U' &&
+ name[2] == 'T' &&
+ name[3] == 'O' &&
+ name[4] == 'L' &&
+ name[5] == 'O' &&
+ name[6] == 'A' &&
+ name[7] == 'D')
+ { /* AUTOLOAD */
+ return KEY_AUTOLOAD;
+ }
+
+ goto unknown;
+
+ case '_':
+ if (name[1] == '_')
+ {
+ switch (name[2])
+ {
+ case 'D':
+ if (name[3] == 'A' &&
+ name[4] == 'T' &&
+ name[5] == 'A' &&
+ name[6] == '_' &&
+ name[7] == '_')
+ { /* __DATA__ */
+ return KEY___DATA__;
+ }
+
+ goto unknown;
+
+ case 'F':
+ if (name[3] == 'I' &&
+ name[4] == 'L' &&
+ name[5] == 'E' &&
+ name[6] == '_' &&
+ name[7] == '_')
+ { /* __FILE__ */
+ return -KEY___FILE__;
+ }
+
+ goto unknown;
+
+ case 'L':
+ if (name[3] == 'I' &&
+ name[4] == 'N' &&
+ name[5] == 'E' &&
+ name[6] == '_' &&
+ name[7] == '_')
+ { /* __LINE__ */
+ return -KEY___LINE__;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'c':
+ switch (name[1])
+ {
+ case 'l':
+ if (name[2] == 'o' &&
+ name[3] == 's' &&
+ name[4] == 'e' &&
+ name[5] == 'd' &&
+ name[6] == 'i' &&
+ name[7] == 'r')
+ { /* closedir */
+ return -KEY_closedir;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[2] == 'n' &&
+ name[3] == 't' &&
+ name[4] == 'i' &&
+ name[5] == 'n' &&
+ name[6] == 'u' &&
+ name[7] == 'e')
+ { /* continue */
+ return -KEY_continue;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'd':
+ if (name[1] == 'b' &&
+ name[2] == 'm' &&
+ name[3] == 'c' &&
+ name[4] == 'l' &&
+ name[5] == 'o' &&
+ name[6] == 's' &&
+ name[7] == 'e')
+ { /* dbmclose */
+ return -KEY_dbmclose;
+ }
+
+ goto unknown;
+
+ case 'e':
+ if (name[1] == 'n' &&
+ name[2] == 'd')
+ {
+ switch (name[3])
+ {
+ case 'g':
+ if (name[4] == 'r' &&
+ name[5] == 'e' &&
+ name[6] == 'n' &&
+ name[7] == 't')
+ { /* endgrent */
+ return -KEY_endgrent;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[4] == 'w' &&
+ name[5] == 'e' &&
+ name[6] == 'n' &&
+ name[7] == 't')
+ { /* endpwent */
+ return -KEY_endpwent;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'f':
+ if (name[1] == 'o' &&
+ name[2] == 'r' &&
+ name[3] == 'm' &&
+ name[4] == 'l' &&
+ name[5] == 'i' &&
+ name[6] == 'n' &&
+ name[7] == 'e')
+ { /* formline */
+ return -KEY_formline;
+ }
+
+ goto unknown;
+
+ case 'g':
+ if (name[1] == 'e' &&
+ name[2] == 't')
+ {
+ switch (name[3])
+ {
+ case 'g':
+ if (name[4] == 'r')
+ {
+ switch (name[5])
+ {
+ case 'e':
+ if (name[6] == 'n' &&
+ name[7] == 't')
+ { /* getgrent */
+ return -KEY_getgrent;
+ }
+
+ goto unknown;
+
+ case 'g':
+ if (name[6] == 'i' &&
+ name[7] == 'd')
+ { /* getgrgid */
+ return -KEY_getgrgid;
+ }
+
+ goto unknown;
+
+ case 'n':
+ if (name[6] == 'a' &&
+ name[7] == 'm')
+ { /* getgrnam */
+ return -KEY_getgrnam;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'l':
+ if (name[4] == 'o' &&
+ name[5] == 'g' &&
+ name[6] == 'i' &&
+ name[7] == 'n')
+ { /* getlogin */
+ return -KEY_getlogin;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[4] == 'w')
+ {
+ switch (name[5])
+ {
+ case 'e':
+ if (name[6] == 'n' &&
+ name[7] == 't')
+ { /* getpwent */
+ return -KEY_getpwent;
+ }
+
+ goto unknown;
+
+ case 'n':
+ if (name[6] == 'a' &&
+ name[7] == 'm')
+ { /* getpwnam */
+ return -KEY_getpwnam;
+ }
+
+ goto unknown;
+
+ case 'u':
+ if (name[6] == 'i' &&
+ name[7] == 'd')
+ { /* getpwuid */
+ return -KEY_getpwuid;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[1] == 'e' &&
+ name[2] == 'a' &&
+ name[3] == 'd')
+ {
+ switch (name[4])
+ {
+ case 'l':
+ if (name[5] == 'i' &&
+ name[6] == 'n')
+ {
+ switch (name[7])
+ {
+ case 'e':
+ { /* readline */
+ return -KEY_readline;
+ }
+
+ case 'k':
+ { /* readlink */
+ return -KEY_readlink;
+ }
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[5] == 'i' &&
+ name[6] == 'p' &&
+ name[7] == 'e')
+ { /* readpipe */
+ return -KEY_readpipe;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 's':
+ switch (name[1])
+ {
+ case 'e':
+ if (name[2] == 't')
+ {
+ switch (name[3])
+ {
+ case 'g':
+ if (name[4] == 'r' &&
+ name[5] == 'e' &&
+ name[6] == 'n' &&
+ name[7] == 't')
+ { /* setgrent */
+ return -KEY_setgrent;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[4] == 'w' &&
+ name[5] == 'e' &&
+ name[6] == 'n' &&
+ name[7] == 't')
+ { /* setpwent */
+ return -KEY_setpwent;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'h':
+ switch (name[2])
+ {
+ case 'm':
+ if (name[3] == 'w' &&
+ name[4] == 'r' &&
+ name[5] == 'i' &&
+ name[6] == 't' &&
+ name[7] == 'e')
+ { /* shmwrite */
+ return -KEY_shmwrite;
+ }
+
+ goto unknown;
+
+ case 'u':
+ if (name[3] == 't' &&
+ name[4] == 'd' &&
+ name[5] == 'o' &&
+ name[6] == 'w' &&
+ name[7] == 'n')
+ { /* shutdown */
+ return -KEY_shutdown;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 'y':
+ if (name[2] == 's' &&
+ name[3] == 'w' &&
+ name[4] == 'r' &&
+ name[5] == 'i' &&
+ name[6] == 't' &&
+ name[7] == 'e')
+ { /* syswrite */
+ return -KEY_syswrite;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 't':
+ if (name[1] == 'r' &&
+ name[2] == 'u' &&
+ name[3] == 'n' &&
+ name[4] == 'c' &&
+ name[5] == 'a' &&
+ name[6] == 't' &&
+ name[7] == 'e')
+ { /* truncate */
+ return -KEY_truncate;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 9: /* 8 tokens of length 9 */
+ switch (name[0])
+ {
+ case 'e':
+ if (name[1] == 'n' &&
+ name[2] == 'd' &&
+ name[3] == 'n' &&
+ name[4] == 'e' &&
+ name[5] == 't' &&
+ name[6] == 'e' &&
+ name[7] == 'n' &&
+ name[8] == 't')
+ { /* endnetent */
+ return -KEY_endnetent;
+ }
+
+ goto unknown;
+
+ case 'g':
+ if (name[1] == 'e' &&
+ name[2] == 't' &&
+ name[3] == 'n' &&
+ name[4] == 'e' &&
+ name[5] == 't' &&
+ name[6] == 'e' &&
+ name[7] == 'n' &&
+ name[8] == 't')
+ { /* getnetent */
+ return -KEY_getnetent;
+ }
+
+ goto unknown;
+
+ case 'l':
+ if (name[1] == 'o' &&
+ name[2] == 'c' &&
+ name[3] == 'a' &&
+ name[4] == 'l' &&
+ name[5] == 't' &&
+ name[6] == 'i' &&
+ name[7] == 'm' &&
+ name[8] == 'e')
+ { /* localtime */
+ return -KEY_localtime;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[1] == 'r' &&
+ name[2] == 'o' &&
+ name[3] == 't' &&
+ name[4] == 'o' &&
+ name[5] == 't' &&
+ name[6] == 'y' &&
+ name[7] == 'p' &&
+ name[8] == 'e')
+ { /* prototype */
+ return KEY_prototype;
+ }
+
+ goto unknown;
+
+ case 'q':
+ if (name[1] == 'u' &&
+ name[2] == 'o' &&
+ name[3] == 't' &&
+ name[4] == 'e' &&
+ name[5] == 'm' &&
+ name[6] == 'e' &&
+ name[7] == 't' &&
+ name[8] == 'a')
+ { /* quotemeta */
+ return -KEY_quotemeta;
+ }
+
+ goto unknown;
+
+ case 'r':
+ if (name[1] == 'e' &&
+ name[2] == 'w' &&
+ name[3] == 'i' &&
+ name[4] == 'n' &&
+ name[5] == 'd' &&
+ name[6] == 'd' &&
+ name[7] == 'i' &&
+ name[8] == 'r')
+ { /* rewinddir */
+ return -KEY_rewinddir;
+ }
+
+ goto unknown;
+
+ case 's':
+ if (name[1] == 'e' &&
+ name[2] == 't' &&
+ name[3] == 'n' &&
+ name[4] == 'e' &&
+ name[5] == 't' &&
+ name[6] == 'e' &&
+ name[7] == 'n' &&
+ name[8] == 't')
+ { /* setnetent */
+ return -KEY_setnetent;
+ }
+
+ goto unknown;
+
+ case 'w':
+ if (name[1] == 'a' &&
+ name[2] == 'n' &&
+ name[3] == 't' &&
+ name[4] == 'a' &&
+ name[5] == 'r' &&
+ name[6] == 'r' &&
+ name[7] == 'a' &&
+ name[8] == 'y')
+ { /* wantarray */
+ return -KEY_wantarray;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 10: /* 9 tokens of length 10 */
+ switch (name[0])
+ {
+ case 'e':
+ if (name[1] == 'n' &&
+ name[2] == 'd')
+ {
+ switch (name[3])
+ {
+ case 'h':
+ if (name[4] == 'o' &&
+ name[5] == 's' &&
+ name[6] == 't' &&
+ name[7] == 'e' &&
+ name[8] == 'n' &&
+ name[9] == 't')
+ { /* endhostent */
+ return -KEY_endhostent;
+ }
+
+ goto unknown;
+
+ case 's':
+ if (name[4] == 'e' &&
+ name[5] == 'r' &&
+ name[6] == 'v' &&
+ name[7] == 'e' &&
+ name[8] == 'n' &&
+ name[9] == 't')
+ { /* endservent */
+ return -KEY_endservent;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'g':
+ if (name[1] == 'e' &&
+ name[2] == 't')
+ {
+ switch (name[3])
+ {
+ case 'h':
+ if (name[4] == 'o' &&
+ name[5] == 's' &&
+ name[6] == 't' &&
+ name[7] == 'e' &&
+ name[8] == 'n' &&
+ name[9] == 't')
+ { /* gethostent */
+ return -KEY_gethostent;
+ }
+
+ goto unknown;
+
+ case 's':
+ switch (name[4])
+ {
+ case 'e':
+ if (name[5] == 'r' &&
+ name[6] == 'v' &&
+ name[7] == 'e' &&
+ name[8] == 'n' &&
+ name[9] == 't')
+ { /* getservent */
+ return -KEY_getservent;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[5] == 'c' &&
+ name[6] == 'k' &&
+ name[7] == 'o' &&
+ name[8] == 'p' &&
+ name[9] == 't')
+ { /* getsockopt */
+ return -KEY_getsockopt;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 's':
+ switch (name[1])
+ {
+ case 'e':
+ if (name[2] == 't')
+ {
+ switch (name[3])
+ {
+ case 'h':
+ if (name[4] == 'o' &&
+ name[5] == 's' &&
+ name[6] == 't' &&
+ name[7] == 'e' &&
+ name[8] == 'n' &&
+ name[9] == 't')
+ { /* sethostent */
+ return -KEY_sethostent;
+ }
+
+ goto unknown;
+
+ case 's':
+ switch (name[4])
+ {
+ case 'e':
+ if (name[5] == 'r' &&
+ name[6] == 'v' &&
+ name[7] == 'e' &&
+ name[8] == 'n' &&
+ name[9] == 't')
+ { /* setservent */
+ return -KEY_setservent;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[5] == 'c' &&
+ name[6] == 'k' &&
+ name[7] == 'o' &&
+ name[8] == 'p' &&
+ name[9] == 't')
+ { /* setsockopt */
+ return -KEY_setsockopt;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[2] == 'c' &&
+ name[3] == 'k' &&
+ name[4] == 'e' &&
+ name[5] == 't' &&
+ name[6] == 'p' &&
+ name[7] == 'a' &&
+ name[8] == 'i' &&
+ name[9] == 'r')
+ { /* socketpair */
+ return -KEY_socketpair;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 11: /* 8 tokens of length 11 */
+ switch (name[0])
+ {
+ case '_':
+ if (name[1] == '_' &&
+ name[2] == 'P' &&
+ name[3] == 'A' &&
+ name[4] == 'C' &&
+ name[5] == 'K' &&
+ name[6] == 'A' &&
+ name[7] == 'G' &&
+ name[8] == 'E' &&
+ name[9] == '_' &&
+ name[10] == '_')
+ { /* __PACKAGE__ */
+ return -KEY___PACKAGE__;
+ }
+
+ goto unknown;
+
+ case 'e':
+ if (name[1] == 'n' &&
+ name[2] == 'd' &&
+ name[3] == 'p' &&
+ name[4] == 'r' &&
+ name[5] == 'o' &&
+ name[6] == 't' &&
+ name[7] == 'o' &&
+ name[8] == 'e' &&
+ name[9] == 'n' &&
+ name[10] == 't')
+ { /* endprotoent */
+ return -KEY_endprotoent;
+ }
+
+ goto unknown;
+
+ case 'g':
+ if (name[1] == 'e' &&
+ name[2] == 't')
+ {
+ switch (name[3])
+ {
+ case 'p':
+ switch (name[4])
+ {
+ case 'e':
+ if (name[5] == 'e' &&
+ name[6] == 'r' &&
+ name[7] == 'n' &&
+ name[8] == 'a' &&
+ name[9] == 'm' &&
+ name[10] == 'e')
+ { /* getpeername */
+ return -KEY_getpeername;
+ }
+
+ goto unknown;
+
+ case 'r':
+ switch (name[5])
+ {
+ case 'i':
+ if (name[6] == 'o' &&
+ name[7] == 'r' &&
+ name[8] == 'i' &&
+ name[9] == 't' &&
+ name[10] == 'y')
+ { /* getpriority */
+ return -KEY_getpriority;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[6] == 't' &&
+ name[7] == 'o' &&
+ name[8] == 'e' &&
+ name[9] == 'n' &&
+ name[10] == 't')
+ { /* getprotoent */
+ return -KEY_getprotoent;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ default:
+ goto unknown;
+ }
+
+ case 's':
+ if (name[4] == 'o' &&
+ name[5] == 'c' &&
+ name[6] == 'k' &&
+ name[7] == 'n' &&
+ name[8] == 'a' &&
+ name[9] == 'm' &&
+ name[10] == 'e')
+ { /* getsockname */
+ return -KEY_getsockname;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 's':
+ if (name[1] == 'e' &&
+ name[2] == 't' &&
+ name[3] == 'p' &&
+ name[4] == 'r')
+ {
+ switch (name[5])
+ {
+ case 'i':
+ if (name[6] == 'o' &&
+ name[7] == 'r' &&
+ name[8] == 'i' &&
+ name[9] == 't' &&
+ name[10] == 'y')
+ { /* setpriority */
+ return -KEY_setpriority;
+ }
+
+ goto unknown;
+
+ case 'o':
+ if (name[6] == 't' &&
+ name[7] == 'o' &&
+ name[8] == 'e' &&
+ name[9] == 'n' &&
+ name[10] == 't')
+ { /* setprotoent */
+ return -KEY_setprotoent;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+ case 12: /* 2 tokens of length 12 */
+ if (name[0] == 'g' &&
+ name[1] == 'e' &&
+ name[2] == 't' &&
+ name[3] == 'n' &&
+ name[4] == 'e' &&
+ name[5] == 't' &&
+ name[6] == 'b' &&
+ name[7] == 'y')
+ {
+ switch (name[8])
+ {
+ case 'a':
+ if (name[9] == 'd' &&
+ name[10] == 'd' &&
+ name[11] == 'r')
+ { /* getnetbyaddr */
+ return -KEY_getnetbyaddr;
+ }
+
+ goto unknown;
+
+ case 'n':
+ if (name[9] == 'a' &&
+ name[10] == 'm' &&
+ name[11] == 'e')
+ { /* getnetbyname */
+ return -KEY_getnetbyname;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 13: /* 4 tokens of length 13 */
+ if (name[0] == 'g' &&
+ name[1] == 'e' &&
+ name[2] == 't')
+ {
+ switch (name[3])
+ {
+ case 'h':
+ if (name[4] == 'o' &&
+ name[5] == 's' &&
+ name[6] == 't' &&
+ name[7] == 'b' &&
+ name[8] == 'y')
+ {
+ switch (name[9])
+ {
+ case 'a':
+ if (name[10] == 'd' &&
+ name[11] == 'd' &&
+ name[12] == 'r')
+ { /* gethostbyaddr */
+ return -KEY_gethostbyaddr;
+ }
+
+ goto unknown;
+
+ case 'n':
+ if (name[10] == 'a' &&
+ name[11] == 'm' &&
+ name[12] == 'e')
+ { /* gethostbyname */
+ return -KEY_gethostbyname;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 's':
+ if (name[4] == 'e' &&
+ name[5] == 'r' &&
+ name[6] == 'v' &&
+ name[7] == 'b' &&
+ name[8] == 'y')
+ {
+ switch (name[9])
+ {
+ case 'n':
+ if (name[10] == 'a' &&
+ name[11] == 'm' &&
+ name[12] == 'e')
+ { /* getservbyname */
+ return -KEY_getservbyname;
+ }
+
+ goto unknown;
+
+ case 'p':
+ if (name[10] == 'o' &&
+ name[11] == 'r' &&
+ name[12] == 't')
+ { /* getservbyport */
+ return -KEY_getservbyport;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+ }
+
+ goto unknown;
+
+ case 14: /* 1 tokens of length 14 */
+ if (name[0] == 'g' &&
+ name[1] == 'e' &&
+ name[2] == 't' &&
+ name[3] == 'p' &&
+ name[4] == 'r' &&
+ name[5] == 'o' &&
+ name[6] == 't' &&
+ name[7] == 'o' &&
+ name[8] == 'b' &&
+ name[9] == 'y' &&
+ name[10] == 'n' &&
+ name[11] == 'a' &&
+ name[12] == 'm' &&
+ name[13] == 'e')
+ { /* getprotobyname */
+ return -KEY_getprotobyname;
+ }
+
+ goto unknown;
+
+ case 16: /* 1 tokens of length 16 */
+ if (name[0] == 'g' &&
+ name[1] == 'e' &&
+ name[2] == 't' &&
+ name[3] == 'p' &&
+ name[4] == 'r' &&
+ name[5] == 'o' &&
+ name[6] == 't' &&
+ name[7] == 'o' &&
+ name[8] == 'b' &&
+ name[9] == 'y' &&
+ name[10] == 'n' &&
+ name[11] == 'u' &&
+ name[12] == 'm' &&
+ name[13] == 'b' &&
+ name[14] == 'e' &&
+ name[15] == 'r')
+ { /* getprotobynumber */
+ return -KEY_getprotobynumber;
+ }
+
+ goto unknown;
+
+ default:
+ goto unknown;
+ }
+
+unknown:
+ return 0;
}
STATIC void
-S_checkcomma(pTHX_ register char *s, char *name, char *what)
+S_checkcomma(pTHX_ register char *s, const char *name, const char *what)
{
- char *w;
+ const char *w;
if (*s == ' ' && s[1] == '(') { /* XXX gotta be a better way */
if (ckWARN(WARN_SYNTAX)) {
s++;
if (*s == ',') {
int kw;
- *s = '\0';
+ *s = '\0'; /* XXX If we didn't do this, we could const a lot of toke.c */
kw = keyword(w, s - w) || get_cv(w, FALSE) != 0;
*s = ',';
if (kw)
and type is used with error messages only. */
STATIC SV *
-S_new_constant(pTHX_ char *s, STRLEN len, const char *key, SV *sv, SV *pv,
+S_new_constant(pTHX_ const char *s, STRLEN len, const char *key, SV *sv, SV *pv,
const char *type)
{
- dSP;
+ dVAR; dSP;
HV *table = GvHV(PL_hintgv); /* ^H */
SV *res;
SV **cvp;
SV *cv, *typesv;
- const char *why1, *why2, *why3;
+ const char *why1 = "", *why2 = "", *why3 = "";
if (!table || !(PL_hints & HINT_LOCALIZE_HH)) {
SV *msg;
msg = Perl_newSVpvf(aTHX_ "Constant(%s): %s%s%s",
(type ? type: "undef"), why1, why2, why3);
msgdone:
- yyerror(SvPVX(msg));
+ yyerror(SvPVX_const(msg));
SvREFCNT_dec(msg);
return sv;
}
/* Check the eval first */
if (!PL_in_eval && SvTRUE(ERRSV)) {
- STRLEN n_a;
sv_catpv(ERRSV, "Propagated");
- yyerror(SvPV(ERRSV, n_a)); /* Duplicates the message inside eval */
+ yyerror(SvPV_nolen_const(ERRSV)); /* Duplicates the message inside eval */
(void)POPs;
res = SvREFCNT_inc(sv);
}
}
STATIC char *
-S_scan_ident(pTHX_ register char *s, register char *send, char *dest, STRLEN destlen, I32 ck_uni)
+S_scan_ident(pTHX_ register char *s, register const char *send, char *dest, STRLEN destlen, I32 ck_uni)
{
register char *d;
register char *e;
if (bracket) {
if (isSPACE(s[-1])) {
while (s < send) {
- char ch = *s++;
+ const char ch = *s++;
if (!SPACE_OR_TAB(ch)) {
*d = ch;
break;
S_scan_pat(pTHX_ char *start, I32 type)
{
PMOP *pm;
- char *s;
+ char *s = scan_str(start,FALSE,FALSE);
- s = scan_str(start,FALSE,FALSE);
- if (!s)
- Perl_croak(aTHX_ "Search pattern not terminated");
+ if (!s) {
+ char *delimiter = skipspace(start);
+ Perl_croak(aTHX_ *delimiter == '?'
+ ? "Search pattern not terminated or ternary operator parsed as search pattern"
+ : "Search pattern not terminated" );
+ }
pm = (PMOP*)newPMOP(type, 0);
if (PL_multi_open == '?')
pmflag(&pm->op_pmflags,*s++);
}
/* issue a warning if /c is specified,but /g is not */
- if (ckWARN(WARN_REGEXP) &&
+ if (ckWARN(WARN_REGEXP) &&
(pm->op_pmflags & PMf_CONTINUE) && !(pm->op_pmflags & PMf_GLOBAL))
{
Perl_warner(aTHX_ packWARN(WARN_REGEXP), c_without_g);
STATIC char *
S_scan_subst(pTHX_ char *start)
{
+ dVAR;
register char *s;
register PMOP *pm;
I32 first_start;
I32 len;
SV *tmpstr;
char term;
+ const char newline[] = "\n";
+ const char *found_newline;
register char *d;
register char *e;
char *peek;
- int outer = (PL_rsfp && !(PL_lex_inwhat == OP_SCALAR));
+ const int outer = (PL_rsfp && !(PL_lex_inwhat == OP_SCALAR));
s += 2;
d = PL_tokenbuf;
#ifndef PERL_STRICT_CR
d = strchr(s, '\r');
if (d) {
- char *olds = s;
+ char * const olds = s;
s = d;
while (s < PL_bufend) {
if (*s == '\r') {
}
*d = '\0';
PL_bufend = d;
- SvCUR_set(PL_linestr, PL_bufend - SvPVX(PL_linestr));
+ SvCUR_set(PL_linestr, PL_bufend - SvPVX_const(PL_linestr));
s = olds;
}
#endif
- d = "\n";
- if (outer || !(d=ninstr(s,PL_bufend,d,d+1)))
- herewas = newSVpvn(s,PL_bufend-s);
- else
- s--, herewas = newSVpvn(s,d-s);
+ if ( outer || !(found_newline = ninstr(s,PL_bufend,newline,newline+1)) ) {
+ herewas = newSVpvn(s,PL_bufend-s);
+ }
+ else {
+ s--;
+ herewas = newSVpvn(s,found_newline-s);
+ }
s += SvCUR(herewas);
tmpstr = NEWSV(87,79);
sv_upgrade(tmpstr, SVt_PVIV);
if (term == '\'') {
op_type = OP_CONST;
- SvIVX(tmpstr) = -1;
+ SvIV_set(tmpstr, -1);
}
else if (term == '`') {
op_type = OP_BACKTICK;
- SvIVX(tmpstr) = '\\';
+ SvIV_set(tmpstr, '\\');
}
CLINE;
if (PL_lex_inwhat == OP_SUBST && PL_in_eval && !PL_rsfp) {
char *bufptr = PL_sublex_info.super_bufptr;
char *bufend = PL_sublex_info.super_bufend;
- char *olds = s - SvCUR(herewas);
+ char * const olds = s - SvCUR(herewas);
s = strchr(bufptr, '\n');
if (!s)
s = bufend;
sv_setpvn(tmpstr,d+1,s-d);
s += len - 1;
sv_catpvn(herewas,s,bufend-s);
- Copy(SvPVX(herewas),bufptr,SvCUR(herewas) + 1,char);
+ Copy(SvPVX_const(herewas),bufptr,SvCUR(herewas) + 1,char);
s = olds;
goto retval;
{
PL_bufend[-2] = '\n';
PL_bufend--;
- SvCUR_set(PL_linestr, PL_bufend - SvPVX(PL_linestr));
+ SvCUR_set(PL_linestr, PL_bufend - SvPVX_const(PL_linestr));
}
else if (PL_bufend[-1] == '\r')
PL_bufend[-1] = '\n';
sv_upgrade(sv, SVt_PVMG);
sv_setsv(sv,PL_linestr);
(void)SvIOK_on(sv);
- SvIVX(sv) = 0;
+ SvIV_set(sv, 0);
av_store(CopFILEAV(PL_curcop), (I32)CopLINE(PL_curcop),sv);
}
if (*s == term && memEQ(s,PL_tokenbuf,len)) {
- STRLEN off = PL_bufend - 1 - SvPVX(PL_linestr);
+ STRLEN off = PL_bufend - 1 - SvPVX_const(PL_linestr);
*(SvPVX(PL_linestr) + off ) = ' ';
sv_catsv(PL_linestr,herewas);
PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
retval:
PL_multi_end = CopLINE(PL_curcop);
if (SvCUR(tmpstr) + 5 < SvLEN(tmpstr)) {
- SvLEN_set(tmpstr, SvCUR(tmpstr) + 1);
- Renew(SvPVX(tmpstr), SvLEN(tmpstr), char);
+ SvPV_shrink_to_cur(tmpstr);
}
SvREFCNT_dec(herewas);
if (!IN_BYTES) {
- if (UTF && is_utf8_string((U8*)SvPVX(tmpstr), SvCUR(tmpstr)))
+ if (UTF && is_utf8_string((U8*)SvPVX_const(tmpstr), SvCUR(tmpstr)))
SvUTF8_on(tmpstr);
else if (PL_encoding)
sv_recode_to_utf8(tmpstr, PL_encoding);
{
register char *s = start; /* current position in buffer */
register char *d;
- register char *e;
+ const char *e;
char *end;
I32 len;
*/
if ((tmp = pad_findmy(d)) != NOT_IN_PAD) {
if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) {
- SV *sym = sv_2mortal(
- newSVpv(HvNAME(PAD_COMPNAME_OURSTASH(tmp)),0));
+ HV *stash = PAD_COMPNAME_OURSTASH(tmp);
+ HEK *stashname = HvNAME_HEK(stash);
+ SV *sym = sv_2mortal(newSVhek(stashname));
sv_catpvn(sym, "::", 2);
sv_catpv(sym, d+1);
d = SvPVX(sym);
I32 brackets = 1; /* bracket nesting level */
bool has_utf8 = FALSE; /* is there any utf8 content? */
I32 termcode; /* terminating char. code */
- U8 termstr[UTF8_MAXLEN]; /* terminating string */
+ U8 termstr[UTF8_MAXBYTES]; /* terminating string */
STRLEN termlen; /* length of terminating string */
char *last = NULL; /* last position for nesting bracket */
assuming. 79 is the SV's initial length. What a random number. */
sv = NEWSV(87,79);
sv_upgrade(sv, SVt_PVIV);
- SvIVX(sv) = termcode;
+ SvIV_set(sv, termcode);
(void)SvPOK_only(sv); /* validate pointer */
/* move past delimiter and try to read a complete string */
bool cont = TRUE;
while (cont) {
- int offset = s - SvPVX(PL_linestr);
- bool found = sv_cat_decode(sv, PL_encoding, PL_linestr,
+ int offset = s - SvPVX_const(PL_linestr);
+ const bool found = sv_cat_decode(sv, PL_encoding, PL_linestr,
&offset, (char*)termstr, termlen);
- char *ns = SvPVX(PL_linestr) + offset;
+ const char *ns = SvPVX_const(PL_linestr) + offset;
char *svlast = SvEND(sv) - 1;
for (; s < ns; s++) {
else {
/* handle quoted delimiters */
if (SvCUR(sv) > 1 && *(svlast-1) == '\\') {
- char *t;
- for (t = svlast-2; t >= SvPVX(sv) && *t == '\\';)
+ const char *t;
+ for (t = svlast-2; t >= SvPVX_const(sv) && *t == '\\';)
t--;
if ((svlast-1 - t) % 2) {
if (!keep_quoted) {
cont = FALSE;
}
else {
- char *t, *w;
+ const char *t;
+ char *w;
if (!last)
last = SvPVX(sv);
- for (w = t = last; t < svlast; w++, t++) {
+ for (t = w = last; t < svlast; w++, t++) {
/* At here, all closes are "was quoted" one,
so we don't check PL_multi_close. */
if (*t == '\\') {
if (w < t) {
*w++ = term;
*w = '\0';
- SvCUR_set(sv, w - SvPVX(sv));
+ SvCUR_set(sv, w - SvPVX_const(sv));
}
last = w;
if (--brackets <= 0)
}
/* terminate the copied string and update the sv's end-of-string */
*to = '\0';
- SvCUR_set(sv, to - SvPVX(sv));
+ SvCUR_set(sv, to - SvPVX_const(sv));
/*
* this next chunk reads more into the buffer if we're not done yet
break; /* handle case where we are done yet :-) */
#ifndef PERL_STRICT_CR
- if (to - SvPVX(sv) >= 2) {
+ if (to - SvPVX_const(sv) >= 2) {
if ((to[-2] == '\r' && to[-1] == '\n') ||
(to[-2] == '\n' && to[-1] == '\r'))
{
to[-2] = '\n';
to--;
- SvCUR_set(sv, to - SvPVX(sv));
+ SvCUR_set(sv, to - SvPVX_const(sv));
}
else if (to[-1] == '\r')
to[-1] = '\n';
}
- else if (to - SvPVX(sv) == 1 && to[-1] == '\r')
+ else if (to - SvPVX_const(sv) == 1 && to[-1] == '\r')
to[-1] = '\n';
#endif
sv_upgrade(sv, SVt_PVMG);
sv_setsv(sv,PL_linestr);
(void)SvIOK_on(sv);
- SvIVX(sv) = 0;
+ SvIV_set(sv, 0);
av_store(CopFILEAV(PL_curcop), (I32)CopLINE(PL_curcop), sv);
}
/* if we allocated too much space, give some back */
if (SvCUR(sv) + 5 < SvLEN(sv)) {
SvLEN_set(sv, SvCUR(sv) + 1);
- Renew(SvPVX(sv), SvLEN(sv), char);
+ SvPV_renew(sv, SvLEN(sv));
}
/* decide whether this is the first or second quoted string we've read
*/
char *
-Perl_scan_num(pTHX_ char *start, YYSTYPE* lvalp)
+Perl_scan_num(pTHX_ const char *start, YYSTYPE* lvalp)
{
- register char *s = start; /* current position in buffer */
+ register const char *s = start; /* current position in buffer */
register char *d; /* destination in temp buffer */
register char *e; /* end of temp buffer */
NV nv; /* number read, as a double */
SV *sv = Nullsv; /* place to put the converted number */
bool floatit; /* boolean: int or float? */
- char *lastub = 0; /* position of last underbar */
- static char number_too_long[] = "Number too long";
+ const char *lastub = 0; /* position of last underbar */
+ static char const number_too_long[] = "Number too long";
/* We use the first character to decide what type of number this is */
I32 shift;
bool overflowed = FALSE;
bool just_zero = TRUE; /* just plain 0 or binary number? */
- static NV nvshift[5] = { 1.0, 2.0, 4.0, 8.0, 16.0 };
- static char* bases[5] = { "", "binary", "", "octal",
- "hexadecimal" };
- static char* Bases[5] = { "", "Binary", "", "Octal",
- "Hexadecimal" };
- static char *maxima[5] = { "",
- "0b11111111111111111111111111111111",
- "",
- "037777777777",
- "0xffffffff" };
- char *base, *Base, *max;
+ static const NV nvshift[5] = { 1.0, 2.0, 4.0, 8.0, 16.0 };
+ static const char* const bases[5] =
+ { "", "binary", "", "octal", "hexadecimal" };
+ static const char* const Bases[5] =
+ { "", "Binary", "", "Octal", "Hexadecimal" };
+ static const char* const maxima[5] =
+ { "",
+ "0b11111111111111111111111111111111",
+ "",
+ "037777777777",
+ "0xffffffff" };
+ const char *base, *Base, *max;
/* check for hex */
if (s[1] == 'x') {
sv_setuv(sv, u);
}
if (just_zero && (PL_hints & HINT_NEW_INTEGER))
- sv = new_constant(start, s - start, "integer",
+ sv = new_constant(start, s - start, "integer",
sv, Nullsv, NULL);
else if (PL_hints & HINT_NEW_BINARY)
sv = new_constant(start, s - start, "binary", sv, Nullsv, NULL);
else
lvalp->opval = Nullop;
- return s;
+ return (char *)s;
}
STATIC char *
while (!needargs) {
if (*s == '.') {
- /*SUPPRESS 530*/
#ifdef PERL_STRICT_CR
for (t = s+1;SPACE_OR_TAB(*t); t++) ;
#else
}
}
if (PL_in_eval && !PL_rsfp) {
- eol = memchr(s,'\n',PL_bufend-s);
+ eol = (char *) memchr(s,'\n',PL_bufend-s);
if (!eol++)
eol = PL_bufend;
}
char *end = SvPVX(stuff) + SvCUR(stuff);
end[-2] = '\n';
end[-1] = '\0';
- SvCUR(stuff)--;
+ SvCUR_set(stuff, SvCUR(stuff) - 1);
}
#endif
}
else
break;
}
- s = eol;
+ s = (char*)eol;
if (PL_rsfp) {
s = filter_gets(PL_linestr, PL_rsfp, 0);
PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(PL_linestr);
else
PL_lex_state = LEX_FORMLINE;
if (!IN_BYTES) {
- if (UTF && is_utf8_string((U8*)SvPVX(stuff), SvCUR(stuff)))
+ if (UTF && is_utf8_string((U8*)SvPVX_const(stuff), SvCUR(stuff)))
SvUTF8_on(stuff);
else if (PL_encoding)
sv_recode_to_utf8(stuff, PL_encoding);
I32
Perl_start_subparse(pTHX_ I32 is_format, U32 flags)
{
- I32 oldsavestack_ix = PL_savestack_ix;
+ const I32 oldsavestack_ix = PL_savestack_ix;
CV* outsidecv = PL_compcv;
if (PL_compcv) {
#pragma segment Perl_yylex
#endif
int
-Perl_yywarn(pTHX_ char *s)
+Perl_yywarn(pTHX_ const char *s)
{
PL_in_eval |= EVAL_WARNONLY;
yyerror(s);
}
int
-Perl_yyerror(pTHX_ char *s)
+Perl_yyerror(pTHX_ const char *s)
{
- char *where = NULL;
- char *context = NULL;
+ const char *where = NULL;
+ const char *context = NULL;
int contlen = -1;
SV *msg;
if (!yychar || (yychar == ';' && !PL_rsfp))
where = "at EOF";
- else if (PL_bufptr > PL_oldoldbufptr && PL_bufptr - PL_oldoldbufptr < 200 &&
- PL_oldoldbufptr != PL_oldbufptr && PL_oldbufptr != PL_bufptr) {
+ else if (PL_oldoldbufptr && PL_bufptr > PL_oldoldbufptr &&
+ PL_bufptr - PL_oldoldbufptr < 200 && PL_oldoldbufptr != PL_oldbufptr &&
+ PL_oldbufptr != PL_bufptr) {
/*
Only for NetWare:
The code below is removed for NetWare because it abends/crashes on NetWare
context = PL_oldoldbufptr;
contlen = PL_bufptr - PL_oldoldbufptr;
}
- else if (PL_bufptr > PL_oldbufptr && PL_bufptr - PL_oldbufptr < 200 &&
- PL_oldbufptr != PL_bufptr) {
+ else if (PL_oldbufptr && PL_bufptr > PL_oldbufptr &&
+ PL_bufptr - PL_oldbufptr < 200 && PL_oldbufptr != PL_bufptr) {
/*
Only for NetWare:
The code below is removed for NetWare because it abends/crashes on NetWare
Perl_sv_catpvf(aTHX_ where_sv, "%c", yychar);
else
Perl_sv_catpvf(aTHX_ where_sv, "\\%03o", yychar & 255);
- where = SvPVX(where_sv);
+ where = SvPVX_const(where_sv);
}
msg = sv_2mortal(newSVpv(s, 0));
Perl_sv_catpvf(aTHX_ msg, " at %s line %"IVdf", ",
STATIC char*
S_swallow_bom(pTHX_ U8 *s)
{
- STRLEN slen;
- slen = SvCUR(PL_linestr);
+ const STRLEN slen = SvCUR(PL_linestr);
switch (s[0]) {
case 0xFF:
if (s[1] == 0xFE) {
static I32
utf16_textfilter(pTHX_ int idx, SV *sv, int maxlen)
{
- STRLEN old = SvCUR(sv);
- I32 count = FILTER_READ(idx+1, sv, maxlen);
+ const STRLEN old = SvCUR(sv);
+ const I32 count = FILTER_READ(idx+1, sv, maxlen);
DEBUG_P(PerlIO_printf(Perl_debug_log,
"utf16_textfilter(%p): %d %d (%d)\n",
utf16_textfilter, idx, maxlen, (int) count));
U8* tmps;
I32 newlen;
New(898, tmps, SvCUR(sv) * 3 / 2 + 1, U8);
- Copy(SvPVX(sv), tmps, old, char);
- utf16_to_utf8((U8*)SvPVX(sv) + old, tmps + old,
+ Copy(SvPVX_const(sv), tmps, old, char);
+ utf16_to_utf8((U8*)SvPVX_const(sv) + old, tmps + old,
SvCUR(sv) - old, &newlen);
sv_usepvn(sv, (char*)tmps, (STRLEN)newlen + old);
}
static I32
utf16rev_textfilter(pTHX_ int idx, SV *sv, int maxlen)
{
- STRLEN old = SvCUR(sv);
- I32 count = FILTER_READ(idx+1, sv, maxlen);
+ const STRLEN old = SvCUR(sv);
+ const I32 count = FILTER_READ(idx+1, sv, maxlen);
DEBUG_P(PerlIO_printf(Perl_debug_log,
"utf16rev_textfilter(%p): %d %d (%d)\n",
utf16rev_textfilter, idx, maxlen, (int) count));
U8* tmps;
I32 newlen;
New(898, tmps, SvCUR(sv) * 3 / 2 + 1, U8);
- Copy(SvPVX(sv), tmps, old, char);
- utf16_to_utf8((U8*)SvPVX(sv) + old, tmps + old,
+ Copy(SvPVX_const(sv), tmps, old, char);
+ utf16_to_utf8((U8*)SvPVX_const(sv) + old, tmps + old,
SvCUR(sv) - old, &newlen);
sv_usepvn(sv, (char*)tmps, (STRLEN)newlen + old);
}
*/
char *
-Perl_scan_vstring(pTHX_ char *s, SV *sv)
+Perl_scan_vstring(pTHX_ const char *s, SV *sv)
{
- char *pos = s;
- char *start = s;
+ const char *pos = s;
+ const char *start = s;
if (*pos == 'v') pos++; /* get past 'v' */
while (pos < PL_bufend && (isDIGIT(*pos) || *pos == '_'))
pos++;
if ( *pos != '.') {
/* this may not be a v-string if followed by => */
- char *next = pos;
+ const char *next = pos;
while (next < PL_bufend && isSPACE(*next))
++next;
if ((PL_bufend - next) >= 2 && *next == '=' && next[1] == '>' ) {
/* return string not v-string */
sv_setpvn(sv,(char *)s,pos-s);
- return pos;
+ return (char *)pos;
}
}
if (!isALPHA(*pos)) {
UV rev;
- U8 tmpbuf[UTF8_MAXLEN+1];
+ U8 tmpbuf[UTF8_MAXBYTES+1];
U8 *tmpend;
if (*s == 'v') s++; /* get past 'v' */
rev = 0;
{
/* this is atoi() that tolerates underscores */
- char *end = pos;
+ const char *end = pos;
UV mult = 1;
while (--end >= s) {
UV orev;
sv_magic(sv,NULL,PERL_MAGIC_vstring,(const char*)start, pos-start);
SvRMAGICAL_on(sv);
}
- return s;
+ return (char *)s;
}
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * ex: set ts=8 sts=4 sw=4 noet:
+ */