Devel-Declare

 view release on metacpan or  search on metacpan

stolen_chunk_of_toke.c  view on Meta::CPAN

    SvPV_set((sv), (MEM_WRAP_CHECK_(n,char)     \
        (char*)saferealloc((Malloc_t)SvPVX(sv), \
               (MEM_SIZE)((n)))));  \
     } STMT_END

#define isCONTROLVAR(x) (isUPPER(x) || strchr("[\\]^_?", (x)))

/* On MacOS, respect nonbreaking spaces */
#ifdef MACOS_TRADITIONAL
#define SPACE_OR_TAB(c) ((c)==' '||(c)=='\312'||(c)=='\t')
#else
#define SPACE_OR_TAB(c) ((c)==' '||(c)=='\t')
#endif

/*
 * Normally, during compile time, PL_curcop == &PL_compiling is true. However,
 * Devel::Declare makes the interpreter call back to perl during compile time,
 * which temporarily enters runtime. Then perl space calls various functions
 * from this file, which are designed to work during compile time. They all
 * happen to operate on PL_curcop, not PL_compiling. That doesn't make a
 * difference in the core, but it does for Devel::Declare, which operates at
 * runtime, but still wants to mangle the things that are about to be compiled.
 * That's why we define our own PL_curcop and make it point to PL_compiling
 * here.
 */
#undef PL_curcop
#define PL_curcop (&PL_compiling)

#define CLINE (PL_copline = (CopLINE(PL_curcop) < PL_copline ? CopLINE(PL_curcop) : PL_copline))

#define LEX_NORMAL    10 /* normal code (ie not within "...")     */
#define LEX_INTERPNORMAL   9 /* code within a string, eg "$foo[$x+1]" */
#define LEX_INTERPCASEMOD  8 /* expecting a \U, \Q or \E etc          */
#define LEX_INTERPPUSH     7 /* starting a new sublex parse level     */
#define LEX_INTERPSTART    6 /* expecting the start of a $var         */

           /* at end of code, eg "$x" followed by:  */
#define LEX_INTERPEND    5 /* ... eg not one of [, { or ->          */
#define LEX_INTERPENDMAYBE   4 /* ... eg one of [, { or ->              */

#define LEX_INTERPCONCAT   3 /* expecting anything, eg at start of
                string or after \E, $foo, etc       */
#define LEX_INTERPCONST    2 /* NOT USED */
#define LEX_FORMLINE     1 /* expecting a format line               */
#define LEX_KNOWNEXT     0 /* next token known; just return it      */

/* and these two are my own madness (mst) */

#if PERL_REVISION == 5 && PERL_VERSION == 8 && PERL_SUBVERSION >= 8
#define PERL_5_8_8_PLUS
#endif

#if PERL_REVISION == 5 && PERL_VERSION > 8
#define PERL_5_9_PLUS
#endif

#if !defined(PERL_5_9_PLUS) && defined(PERL_IMPLICIT_CONTEXT)
/* These two are not exported from the core on Windows.  With 5.9+
   it's not an issue, because they're part of the PL_parser structure,
   which is exported.  On multiplicity/thread builds we can work
   around the lack of export by this formulation, where we provide
   a substitute implementation of the unexported accessor functions.
   On single-interpreter builds we can't, because access is directly
   via symbols that are not exported.  */
# define Perl_Ilinestart_ptr my_Ilinestart_ptr
char **my_Ilinestart_ptr(pTHX) { return &(aTHX->Ilinestart); }
# define Perl_Isublex_info_ptr my_Isublex_info_ptr
static SUBLEXINFO *my_Isublex_info_ptr(pTHX) { return &(aTHX->Isublex_info); }
#endif

#ifdef PERL_5_9_PLUS
/* 5.9+ moves a bunch of things to a PL_parser struct so we need to
   declare the backcompat macros for things to still work (mst) */

/* XXX temporary backwards compatibility */
#define PL_lex_brackets         (PL_parser->lex_brackets)
#define PL_lex_brackstack       (PL_parser->lex_brackstack)
#define PL_lex_casemods         (PL_parser->lex_casemods)
#define PL_lex_casestack        (PL_parser->lex_casestack)
#define PL_lex_defer            (PL_parser->lex_defer)
#define PL_lex_dojoin           (PL_parser->lex_dojoin)
#define PL_lex_expect           (PL_parser->lex_expect)
#define PL_lex_formbrack        (PL_parser->lex_formbrack)
#define PL_lex_inpat            (PL_parser->lex_inpat)
#define PL_lex_inwhat           (PL_parser->lex_inwhat)
#define PL_lex_op               (PL_parser->lex_op)
#define PL_lex_repl             (PL_parser->lex_repl)
#define PL_lex_starts           (PL_parser->lex_starts)
#define PL_lex_stuff            (PL_parser->lex_stuff)
#define PL_multi_start          (PL_parser->multi_start)
#define PL_multi_open           (PL_parser->multi_open)
#define PL_multi_close          (PL_parser->multi_close)
#define PL_pending_ident        (PL_parser->pending_ident)
#define PL_preambled            (PL_parser->preambled)
#define PL_sublex_info          (PL_parser->sublex_info)
#define PL_linestr              (PL_parser->linestr)
#define PL_sublex_info          (PL_parser->sublex_info)
#define PL_linestr              (PL_parser->linestr)
#define PL_expect               (PL_parser->expect)
#define PL_copline              (PL_parser->copline)
#define PL_bufptr               (PL_parser->bufptr)
#define PL_oldbufptr            (PL_parser->oldbufptr)
#define PL_oldoldbufptr         (PL_parser->oldoldbufptr)
#define PL_linestart            (PL_parser->linestart)
#define PL_bufend               (PL_parser->bufend)
#define PL_last_uni             (PL_parser->last_uni)
#define PL_last_lop             (PL_parser->last_lop)
#define PL_last_lop_op          (PL_parser->last_lop_op)
#define PL_lex_state            (PL_parser->lex_state)
#define PL_rsfp                 (PL_parser->rsfp)
#define PL_rsfp_filters         (PL_parser->rsfp_filters)
#define PL_in_my                (PL_parser->in_my)
#define PL_in_my_stash          (PL_parser->in_my_stash)
#define PL_tokenbuf             (PL_parser->tokenbuf)
#define PL_multi_end            (PL_parser->multi_end)
#define PL_error_count          (PL_parser->error_count)
#define PL_nexttoke           (PL_parser->nexttoke)
/* these are from the non-PERL_MAD path but I don't -think- I need
   the PERL_MAD stuff since my code isn't really populating things (mst) */
# ifdef PERL_MAD
#  define PL_curforce		(PL_parser->curforce)



( run in 0.788 second using v1.01-cache-2.11-cpan-8dfa8b56332 )