Skip to content

Commit c291c6e

Browse files
committed
tick in symbols: rename new prototype scan_word and provide a forwarder
The change in prototype of the non-API scan_word() function caused B::Hooks::Parser to fail to build. Instead, rename scan_word() with the new prototype to scan_word6() and provide a scan_word() with the old signature that forwards calls to the new function. scan_word6() may be removed once tick in symbol becomes an error Fixes #21162
1 parent d61ea02 commit c291c6e

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed

embed.fnc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,11 @@ Adp |char * |scan_vstring |NN const char *s \
29002900
|NN const char * const e \
29012901
|NN SV *sv
29022902
EXpx |char * |scan_word |NN char *s \
2903+
|NN char *dest \
2904+
|STRLEN destlen \
2905+
|int allow_package \
2906+
|NN STRLEN *slp
2907+
EXpx |char * |scan_word6 |NN char *s \
29032908
|NN char *dest \
29042909
|STRLEN destlen \
29052910
|int allow_package \

embed.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,8 @@
17031703
# define reg_temp_copy(a,b) Perl_reg_temp_copy(aTHX_ a,b)
17041704
# define report_uninit(a) Perl_report_uninit(aTHX_ a)
17051705
# define scan_str(a,b,c,d,e) Perl_scan_str(aTHX_ a,b,c,d,e)
1706-
# define scan_word(a,b,c,d,e,f) Perl_scan_word(aTHX_ a,b,c,d,e,f)
1706+
# define scan_word(a,b,c,d,e) Perl_scan_word(aTHX_ a,b,c,d,e)
1707+
# define scan_word6(a,b,c,d,e,f) Perl_scan_word6(aTHX_ a,b,c,d,e,f)
17071708
# define skipspace_flags(a,b) Perl_skipspace_flags(aTHX_ a,b)
17081709
# define sv_magicext_mglob(a) Perl_sv_magicext_mglob(aTHX_ a)
17091710
# define sv_only_taint_gmagic Perl_sv_only_taint_gmagic

proto.h

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

toke.c

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,7 @@ S_force_word(pTHX_ char *start, int token, int check_keyword, int allow_pack)
22632263
if ( isIDFIRST_lazy_if_safe(s, PL_bufend, UTF)
22642264
|| (allow_pack && *s == ':' && s[1] == ':') )
22652265
{
2266-
s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, allow_pack, &len, allow_pack);
2266+
s = scan_word6(s, PL_tokenbuf, sizeof PL_tokenbuf, allow_pack, &len, allow_pack);
22672267
if (check_keyword) {
22682268
char *s2 = PL_tokenbuf;
22692269
STRLEN len2 = len;
@@ -4675,7 +4675,7 @@ S_intuit_method(pTHX_ char *start, SV *ioname, CV *cv)
46754675
return *s == '(' ? METHCALL : METHCALL0;
46764676
}
46774677

4678-
s = scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len, FALSE);
4678+
s = scan_word6(s, tmpbuf, sizeof tmpbuf, TRUE, &len, FALSE);
46794679
/* start is the beginning of the possible filehandle/object,
46804680
* and s is the end of it
46814681
* tmpbuf is a copy of it (but with single quotes as double colons)
@@ -5303,7 +5303,7 @@ yyl_dollar(pTHX_ char *s)
53035303
} while (isSPACE(*t));
53045304
if (isIDFIRST_lazy_if_safe(t, PL_bufend, UTF)) {
53055305
STRLEN len;
5306-
t = scan_word(t, tmpbuf, sizeof tmpbuf, TRUE,
5306+
t = scan_word6(t, tmpbuf, sizeof tmpbuf, TRUE,
53075307
&len, TRUE);
53085308
while (isSPACE(*t))
53095309
t++;
@@ -5337,7 +5337,7 @@ yyl_dollar(pTHX_ char *s)
53375337
char tmpbuf[sizeof PL_tokenbuf];
53385338
int t2;
53395339
STRLEN len;
5340-
scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len, FALSE);
5340+
scan_word6(s, tmpbuf, sizeof tmpbuf, TRUE, &len, FALSE);
53415341
if ((t2 = keyword(tmpbuf, len, 0))) {
53425342
/* binary operators exclude handle interpretations */
53435343
switch (t2) {
@@ -5408,7 +5408,7 @@ yyl_sub(pTHX_ char *s, const int key)
54085408
{
54095409

54105410
PL_expect = XATTRBLOCK;
5411-
d = scan_word(s, tmpbuf, sizeof PL_tokenbuf - 1, TRUE,
5411+
d = scan_word6(s, tmpbuf, sizeof PL_tokenbuf - 1, TRUE,
54125412
&len, TRUE);
54135413
if (key == KEY_format)
54145414
format_name = S_newSV_maybe_utf8(aTHX_ s, d - s);
@@ -5993,7 +5993,7 @@ yyl_colon(pTHX_ char *s)
59935993
I32 tmp;
59945994
SV *sv;
59955995
STRLEN len;
5996-
char *d = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len, FALSE);
5996+
char *d = scan_word6(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len, FALSE);
59975997
if (isLOWER(*s) && (tmp = keyword(PL_tokenbuf, len, 0))) {
59985998
if (tmp < 0) tmp = -tmp;
59995999
switch (tmp) {
@@ -6175,7 +6175,7 @@ yyl_leftcurly(pTHX_ char *s, const U8 formbrack)
61756175
}
61766176
if (d < PL_bufend && isIDFIRST_lazy_if_safe(d, PL_bufend, UTF)) {
61776177
STRLEN len;
6178-
d = scan_word(d, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1,
6178+
d = scan_word6(d, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1,
61796179
FALSE, &len, FALSE);
61806180
while (d < PL_bufend && SPACE_OR_TAB(*d))
61816181
d++;
@@ -7022,7 +7022,7 @@ yyl_foreach(pTHX_ char *s)
70227022
/* skip optional package name, as in "for my abc $x (..)" */
70237023
if (UNLIKELY(isIDFIRST_lazy_if_safe(p, PL_bufend, UTF))) {
70247024
STRLEN len;
7025-
p = scan_word(p, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len, TRUE);
7025+
p = scan_word6(p, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len, TRUE);
70267026
p = skipspace(p);
70277027
paren_is_valid = FALSE;
70287028
}
@@ -7053,7 +7053,7 @@ yyl_do(pTHX_ char *s, I32 orig_keyword)
70537053
char *d;
70547054
STRLEN len;
70557055
*PL_tokenbuf = '&';
7056-
d = scan_word(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1,
7056+
d = scan_word6(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1,
70577057
1, &len, TRUE);
70587058
if (len && memNEs(PL_tokenbuf+1, len, "CORE")
70597059
&& !keyword(PL_tokenbuf + 1, len, 0)) {
@@ -7089,7 +7089,7 @@ yyl_my(pTHX_ char *s, I32 my)
70897089
s = skipspace(s);
70907090
if (isIDFIRST_lazy_if_safe(s, PL_bufend, UTF)) {
70917091
STRLEN len;
7092-
s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len, TRUE);
7092+
s = scan_word6(s, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len, TRUE);
70937093
if (memEQs(PL_tokenbuf, len, "sub"))
70947094
return yyl_sub(aTHX_ s, my);
70957095
PL_in_my_stash = find_in_my_stash(PL_tokenbuf, len);
@@ -7561,7 +7561,7 @@ yyl_just_a_word(pTHX_ char *s, STRLEN len, I32 orig_keyword, struct code c)
75617561

75627562
if (*s == '\'' || (*s == ':' && s[1] == ':')) {
75637563
STRLEN morelen;
7564-
s = scan_word(s, PL_tokenbuf + len, sizeof PL_tokenbuf - len,
7564+
s = scan_word6(s, PL_tokenbuf + len, sizeof PL_tokenbuf - len,
75657565
TRUE, &morelen, TRUE);
75667566
if (no_op_error) {
75677567
no_op("Bareword",s);
@@ -8311,7 +8311,7 @@ yyl_word_or_keyword(pTHX_ char *s, STRLEN len, I32 key, I32 orig_keyword, struct
83118311
s = skipspace(s);
83128312
if (isIDFIRST_lazy_if_safe(s, PL_bufend, UTF)) {
83138313
const char *t;
8314-
char *d = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len, FALSE);
8314+
char *d = scan_word6(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len, FALSE);
83158315
for (t=d; isSPACE(*t);)
83168316
t++;
83178317
if ( *t && memCHRs("|&*+-=!?:.", *t) && ckWARN_d(WARN_PRECEDENCE)
@@ -8759,7 +8759,7 @@ yyl_key_core(pTHX_ char *s, STRLEN len, struct code c)
87598759
STRLEN olen = len;
87608760
char *d = s;
87618761
s += 2;
8762-
s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len, FALSE);
8762+
s = scan_word6(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len, FALSE);
87638763
if ((*s == ':' && s[1] == ':')
87648764
|| (!(key = keyword(PL_tokenbuf, len, 1)) && *s == '\''))
87658765
{
@@ -8838,7 +8838,7 @@ yyl_keylookup(pTHX_ char *s, GV *gv)
88388838
c.gv = gv;
88398839

88408840
PL_bufptr = s;
8841-
s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len, FALSE);
8841+
s = scan_word6(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &len, FALSE);
88428842

88438843
/* Some keywords can be followed by any delimiter, including ':' */
88448844
anydelim = word_takes_any_delimiter(PL_tokenbuf, len);
@@ -10247,22 +10247,30 @@ S_parse_ident(pTHX_ char **s, char **d, char * const e, int allow_package,
1024710247

1024810248
/* Returns a NUL terminated string, with the length of the string written to
1024910249
*slp
10250+
10251+
scan_word6() may be removed once ' in names is removed.
1025010252
*/
1025110253
char *
10252-
Perl_scan_word(pTHX_ char *s, char *dest, STRLEN destlen, int allow_package, STRLEN *slp, bool warn_tick)
10254+
Perl_scan_word6(pTHX_ char *s, char *dest, STRLEN destlen, int allow_package, STRLEN *slp, bool warn_tick)
1025310255
{
1025410256
char *d = dest;
1025510257
char * const e = d + destlen - 3; /* two-character token, ending NUL */
1025610258
bool is_utf8 = cBOOL(UTF);
1025710259

10258-
PERL_ARGS_ASSERT_SCAN_WORD;
10260+
PERL_ARGS_ASSERT_SCAN_WORD6;
1025910261

1026010262
parse_ident(&s, &d, e, allow_package, is_utf8, TRUE, warn_tick);
1026110263
*d = '\0';
1026210264
*slp = d - dest;
1026310265
return s;
1026410266
}
1026510267

10268+
char *
10269+
Perl_scan_word(pTHX_ char *s, char *dest, STRLEN destlen, int allow_package, STRLEN *slp)
10270+
{
10271+
PERL_ARGS_ASSERT_SCAN_WORD;
10272+
return scan_word6(s, dest, destlen, allow_package, slp, FALSE);
10273+
}
1026610274

1026710275
/* scan s and extract an identifier ($var) from it if possible
1026810276
* into dest.
@@ -13723,7 +13731,7 @@ Perl_parse_label(pTHX_ U32 flags)
1372313731
t = s = PL_bufptr;
1372413732
if (!isIDFIRST_lazy_if_safe(s, PL_bufend, UTF))
1372513733
goto no_label;
13726-
t = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &wlen, FALSE);
13734+
t = scan_word6(s, PL_tokenbuf, sizeof PL_tokenbuf, FALSE, &wlen, FALSE);
1372713735
if (word_takes_any_delimiter(s, wlen))
1372813736
goto no_label;
1372913737
bufptr_pos = s - SvPVX(PL_linestr);

0 commit comments

Comments
 (0)