This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
In the MAD code, eliminate one Perl_sv_catpvf() and convert one
[perl5.git]
/
toke.c
diff --git
a/toke.c
b/toke.c
index
889e7ec
..
2b47e13
100644
(file)
--- a/
toke.c
+++ b/
toke.c
@@
-2969,9
+2969,6
@@
S_readpipe_override(pTHX)
newSVOP(OP_CONST, 0, &PL_sv_undef), /* value will be read later */
newCVREF(0, newGVOP(OP_GV, 0, gv_readpipe))));
}
newSVOP(OP_CONST, 0, &PL_sv_undef), /* value will be read later */
newCVREF(0, newGVOP(OP_GV, 0, gv_readpipe))));
}
- else {
- set_csh();
- }
}
#ifdef PERL_MAD
}
#ifdef PERL_MAD
@@
-3384,8
+3381,10
@@
Perl_yylex(pTHX)
else
Perl_croak(aTHX_ "panic: yylex");
if (PL_madskills) {
else
Perl_croak(aTHX_ "panic: yylex");
if (PL_madskills) {
- SV* const tmpsv = newSVpvs("");
- Perl_sv_catpvf(aTHX_ tmpsv, "\\%c", *s);
+ SV* const tmpsv = newSVpvs("\\ ");
+ /* replace the space with the character we want to escape
+ */
+ SvPVX(tmpsv)[1] = *s;
curmad('_', tmpsv);
}
PL_bufptr = s + 1;
curmad('_', tmpsv);
}
PL_bufptr = s + 1;
@@
-3561,7
+3560,7
@@
Perl_yylex(pTHX)
default:
if (isIDFIRST_lazy_if(s,UTF))
goto keylookup;
default:
if (isIDFIRST_lazy_if(s,UTF))
goto keylookup;
- len = UTF ? Perl_utf8_length((U8 *) PL_linestart, (U8 *) s) : (STRLEN) (s - PL_linestart);
+ len = UTF ? Perl_utf8_length(
aTHX_
(U8 *) PL_linestart, (U8 *) s) : (STRLEN) (s - PL_linestart);
Perl_croak(aTHX_ "Unrecognized character \\x%02X in column %d", *s & 255, (int) len + 1);
case 4:
case 26:
Perl_croak(aTHX_ "Unrecognized character \\x%02X in column %d", *s & 255, (int) len + 1);
case 4:
case 26:
@@
-4235,7
+4234,6
@@
Perl_yylex(pTHX)
switch (tmp) {
case KEY_or:
case KEY_and:
switch (tmp) {
case KEY_or:
case KEY_and:
- case KEY_err:
case KEY_for:
case KEY_unless:
case KEY_if:
case KEY_for:
case KEY_unless:
case KEY_if:
@@
-5922,9
+5920,6
@@
Perl_yylex(pTHX)
case KEY_eof:
UNI(OP_EOF);
case KEY_eof:
UNI(OP_EOF);
- case KEY_err:
- OPERATOR(DOROP);
-
case KEY_exp:
UNI(OP_EXP);
case KEY_exp:
UNI(OP_EXP);
@@
-5932,7
+5927,6
@@
Perl_yylex(pTHX)
UNI(OP_EACH);
case KEY_exec:
UNI(OP_EACH);
case KEY_exec:
- set_csh();
LOP(OP_EXEC,XREF);
case KEY_endhostent:
LOP(OP_EXEC,XREF);
case KEY_endhostent:
@@
-6097,7
+6091,6
@@
Perl_yylex(pTHX)
OPERATOR(GIVEN);
case KEY_glob:
OPERATOR(GIVEN);
case KEY_glob:
- set_csh();
LOP(OP_GLOB,XTERM);
case KEY_hex:
LOP(OP_GLOB,XTERM);
case KEY_hex:
@@
-6439,11
+6432,9
@@
Perl_yylex(pTHX)
UNI(OP_READDIR);
case KEY_readline:
UNI(OP_READDIR);
case KEY_readline:
- set_csh();
UNIDOR(OP_READLINE);
case KEY_readpipe:
UNIDOR(OP_READLINE);
case KEY_readpipe:
- set_csh();
UNIDOR(OP_BACKTICK);
case KEY_rewinddir:
UNIDOR(OP_BACKTICK);
case KEY_rewinddir:
@@
-6762,7
+6753,6
@@
Perl_yylex(pTHX)
}
case KEY_system:
}
case KEY_system:
- set_csh();
LOP(OP_SYSTEM,XREF);
case KEY_symlink:
LOP(OP_SYSTEM,XREF);
case KEY_symlink:
@@
-7328,14
+7318,6
@@
Perl_keyword (pTHX_ const char *name, I32 len, bool all_keywords)
goto unknown;
goto unknown;
- case 'r':
- if (name[2] == 'r')
- { /* err */
- return (all_keywords || FEATURE_IS_ENABLED("err") ? -KEY_err : 0);
- }
-
- goto unknown;
-
case 'x':
if (name[2] == 'p')
{ /* exp */
case 'x':
if (name[2] == 'p')
{ /* exp */
@@
-10976,8
+10958,12
@@
S_scan_subst(pTHX_ char *start)
PL_sublex_info.super_bufend = PL_bufend;
PL_multi_end = 0;
pm->op_pmflags |= PMf_EVAL;
PL_sublex_info.super_bufend = PL_bufend;
PL_multi_end = 0;
pm->op_pmflags |= PMf_EVAL;
- while (es-- > 0)
- sv_catpv(repl, (const char *)(es ? "eval " : "do "));
+ while (es-- > 0) {
+ if (es)
+ sv_catpvs(repl, "eval ");
+ else
+ sv_catpvs(repl, "do ");
+ }
sv_catpvs(repl, "{");
sv_catsv(repl, PL_lex_repl);
if (strchr(SvPVX(PL_lex_repl), '#'))
sv_catpvs(repl, "{");
sv_catsv(repl, PL_lex_repl);
if (strchr(SvPVX(PL_lex_repl), '#'))
@@
-11408,7
+11394,6
@@
S_scan_inputsymbol(pTHX_ char *start)
if (d - PL_tokenbuf != len) {
yylval.ival = OP_GLOB;
if (d - PL_tokenbuf != len) {
yylval.ival = OP_GLOB;
- set_csh();
s = scan_str(start,!!PL_madskills,FALSE);
if (!s)
Perl_croak(aTHX_ "Glob not terminated");
s = scan_str(start,!!PL_madskills,FALSE);
if (!s)
Perl_croak(aTHX_ "Glob not terminated");
@@
-12410,20
+12395,6
@@
S_scan_formline(pTHX_ register char *s)
return s;
}
return s;
}
-STATIC void
-S_set_csh(pTHX)
-{
-#ifdef CSH
- dVAR;
- if (!PL_cshlen)
- PL_cshlen = strlen(PL_cshname);
-#else
-#if defined(USE_ITHREADS)
- PERL_UNUSED_CONTEXT;
-#endif
-#endif
-}
-
I32
Perl_start_subparse(pTHX_ I32 is_format, U32 flags)
{
I32
Perl_start_subparse(pTHX_ I32 is_format, U32 flags)
{
@@
-12522,8
+12493,10
@@
Perl_yyerror(pTHX_ const char *s)
SV * const where_sv = sv_2mortal(newSVpvs("next char "));
if (yychar < 32)
Perl_sv_catpvf(aTHX_ where_sv, "^%c", toCTRL(yychar));
SV * const where_sv = sv_2mortal(newSVpvs("next char "));
if (yychar < 32)
Perl_sv_catpvf(aTHX_ where_sv, "^%c", toCTRL(yychar));
- else if (isPRINT_LC(yychar))
- Perl_sv_catpvf(aTHX_ where_sv, "%c", yychar);
+ else if (isPRINT_LC(yychar)) {
+ const unsigned char string = (unsigned char) yychar;
+ sv_catpvn(where_sv, &string, 1);
+ }
else
Perl_sv_catpvf(aTHX_ where_sv, "\\%03o", yychar & 255);
where = SvPVX_const(where_sv);
else
Perl_sv_catpvf(aTHX_ where_sv, "\\%03o", yychar & 255);
where = SvPVX_const(where_sv);