From 61d30f47d59933fc5eb461d573a3a961fa08aa2b Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 22 Dec 2011 10:10:53 -0800 Subject: [PATCH] Use only \w+ for internal feature names This will make it possible to create macros for each. --- ext/arybase/arybase.xs | 16 ++++++++-------- gv.c | 2 +- lib/feature.pm | 2 +- regen/feature.pl | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ext/arybase/arybase.xs b/ext/arybase/arybase.xs index cbc0741..14fd03c 100644 --- a/ext/arybase/arybase.xs +++ b/ext/arybase/arybase.xs @@ -107,7 +107,7 @@ STATIC SV * ab_hint(pTHX_ const bool create) { STATIC IV current_base(pTHX) { #define current_base() current_base(aTHX) SV *hsv = ab_hint(0); - assert(FEATURE_IS_ENABLED_d("$[")); + assert(FEATURE_IS_ENABLED_d("arybase")); if (!hsv || !SvOK(hsv)) return 0; return SvIV(hsv); } @@ -173,7 +173,7 @@ STATIC void ab_process_assignment(pTHX_ OP *left, OP *right) { STATIC OP *ab_ck_sassign(pTHX_ OP *o) { o = (*ab_old_ck_sassign)(aTHX_ o); - if (o->op_type == OP_SASSIGN && FEATURE_IS_ENABLED_d("$[")) { + if (o->op_type == OP_SASSIGN && FEATURE_IS_ENABLED_d("arybase")) { OP *right = cBINOPx(o)->op_first; OP *left = right->op_sibling; if (left) ab_process_assignment(left, right); @@ -183,7 +183,7 @@ STATIC OP *ab_ck_sassign(pTHX_ OP *o) { STATIC OP *ab_ck_aassign(pTHX_ OP *o) { o = (*ab_old_ck_aassign)(aTHX_ o); - if (o->op_type == OP_AASSIGN && FEATURE_IS_ENABLED_d("$[")) { + if (o->op_type == OP_AASSIGN && FEATURE_IS_ENABLED_d("arybase")) { OP *right = cBINOPx(o)->op_first; OP *left = cBINOPx(right->op_sibling)->op_first->op_sibling; right = cBINOPx(right)->op_first->op_sibling; @@ -352,7 +352,7 @@ static OP *ab_ck_base(pTHX_ OP *o) PL_op->op_type); } o = (*old_ck)(aTHX_ o); - if (!FEATURE_IS_ENABLED_d("$[")) return o; + if (!FEATURE_IS_ENABLED_d("arybase")) return o; /* We need two switch blocks, as the type may have changed. */ switch (o->op_type) { case OP_AELEM : @@ -425,7 +425,7 @@ BOOT: void FETCH(...) PREINIT: - SV *ret = FEATURE_IS_ENABLED_d("$[") + SV *ret = FEATURE_IS_ENABLED_d("arybase") ? cop_hints_fetch_pvs(PL_curcop, "$[", 0) : 0; PPCODE: @@ -435,7 +435,7 @@ FETCH(...) void STORE(SV *sv, IV newbase) CODE: - if (FEATURE_IS_ENABLED_d("$[")) { + if (FEATURE_IS_ENABLED_d("arybase")) { SV *base = cop_hints_fetch_pvs(PL_curcop, "$[", 0); if (SvOK(base) ? SvIV(base) == newbase : !newbase) XSRETURN_EMPTY; Perl_croak(aTHX_ "That use of $[ is unsupported"); @@ -453,7 +453,7 @@ FETCH(SV *sv) if (!SvROK(sv) || SvTYPE(SvRV(sv)) >= SVt_PVAV) Perl_croak(aTHX_ "Not a SCALAR reference"); { - SV *base = FEATURE_IS_ENABLED_d("$[") + SV *base = FEATURE_IS_ENABLED_d("arybase") ? cop_hints_fetch_pvs(PL_curcop, "$[", 0) : 0; SvGETMAGIC(SvRV(sv)); @@ -469,7 +469,7 @@ STORE(SV *sv, SV *newbase) if (!SvROK(sv) || SvTYPE(SvRV(sv)) >= SVt_PVAV) Perl_croak(aTHX_ "Not a SCALAR reference"); { - SV *base = FEATURE_IS_ENABLED_d("$[") + SV *base = FEATURE_IS_ENABLED_d("arybase") ? cop_hints_fetch_pvs(PL_curcop, "$[", 0) : 0; SvGETMAGIC(newbase); diff --git a/gv.c b/gv.c index 37a1bd9..d683faa 100644 --- a/gv.c +++ b/gv.c @@ -1940,7 +1940,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, goto magicalize; case '[': /* $[ */ if ((sv_type == SVt_PV || sv_type == SVt_PVGV) - && FEATURE_IS_ENABLED_d("$[")) { + && FEATURE_IS_ENABLED_d("arybase")) { if (addmg) (void)hv_store(stash,name,len,(SV *)gv,0); require_tie_mod(gv,name,newSVpvs("arybase"),"FETCH",0); addmg = 0; diff --git a/lib/feature.pm b/lib/feature.pm index 34727f0..d68c8ec 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -18,7 +18,7 @@ my %feature = ( ); my %default_feature = ( - array_base => 'feature_no$[', + array_base => 'feature_noarybase', ); our %feature_bundle = ( diff --git a/regen/feature.pl b/regen/feature.pl index aed9f54..6454025 100644 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -28,7 +28,7 @@ my %feature = ( # These work backwards--the presence of the hint elem disables the feature: my %default_feature = ( - array_base => 'no$[', + array_base => 'noarybase', ); my %feature_bundle = ( -- 2.7.4