#endif
#include "perlapi.h"
+#ifndef PERL_MAD
+# undef PL_madskills
+# undef PL_xmlfp
+# define PL_madskills 0
+# define PL_xmlfp 0
+#endif
#if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_GET_CONTEXT) && !defined(PERL_CORE)
# undef aTHX
#define PL_linestr (vTHX->Ilinestr)
#define PL_localpatches (vTHX->Ilocalpatches)
#define PL_lockhook (vTHX->Ilockhook)
+#define PL_madskills (vTHX->Imadskills)
#define PL_main_cv (vTHX->Imain_cv)
#define PL_main_root (vTHX->Imain_root)
#define PL_main_start (vTHX->Imain_start)
#define PL_uudmap (vTHX->Iuudmap)
#define PL_warnhook (vTHX->Iwarnhook)
#define PL_widesyscalls (vTHX->Iwidesyscalls)
+#define PL_xmlfp (vTHX->Ixmlfp)
#define PL_yycharp (vTHX->Iyycharp)
#define PL_yylvalp (vTHX->Iyylvalp)
#define PL_Ilinestr PL_linestr
#define PL_Ilocalpatches PL_localpatches
#define PL_Ilockhook PL_lockhook
+#define PL_Imadskills PL_madskills
#define PL_Imain_cv PL_main_cv
#define PL_Imain_root PL_main_root
#define PL_Imain_start PL_main_start
#define PL_Iuudmap PL_uudmap
#define PL_Iwarnhook PL_warnhook
#define PL_Iwidesyscalls PL_widesyscalls
+#define PL_Ixmlfp PL_xmlfp
#define PL_Iyycharp PL_yycharp
#define PL_Iyylvalp PL_yylvalp
PERLVARI(Isavebegin, bool, FALSE) /* save BEGINs for compiler */
+#ifdef PERL_MAD
+PERLVARI(Imadskills, bool, FALSE) /* preserve all syntactic info */
+ /* (MAD = Misc Attribute Decoration) */
+PERLVARI(Ixmlfp, PerlIO *,NULL)
+#endif
+
PERLVAR(Icustom_op_names, HV*) /* Names of user defined ops */
PERLVAR(Icustom_op_descs, HV*) /* Descriptions of user defined ops */
#define OPCODE U16
#endif
+#ifdef PERL_MAD
+# define MADPROP_IN_BASEOP MADPROP* op_madprop;
+#else
+# define MADPROP_IN_BASEOP
+#endif
+
#ifdef BASEOP_DEFINITION
#define BASEOP BASEOP_DEFINITION
#else
OP* op_next; \
OP* op_sibling; \
OP* (CPERLscope(*op_ppaddr))(pTHX); \
+ MADPROP_IN_BASEOP \
PADOFFSET op_targ; \
unsigned op_type:9; \
unsigned op_opt:1; \
(var = (OP*)safemalloc(size), memzero(var, size))
#define FreeOp(p) Safefree(p)
#endif
+
+#ifdef PERL_MAD
+# define MAD_NULL 1
+# define MAD_PV 2
+# define MAD_OP 3
+# define MAD_SV 4
+
+struct madprop {
+ MADPROP* mad_next;
+ void *mad_val;
+ U32 mad_vlen;
+/* short mad_count; */
+ char mad_key;
+ char mad_type;
+};
+
+struct token {
+ I32 tk_type;
+ YYSTYPE tk_lval;
+ MADPROP* tk_mad;
+};
+#endif
typedef MEM_SIZE STRLEN;
+#ifdef PERL_MAD
+typedef struct token TOKEN;
+typedef struct madprop MADPROP;
+typedef struct nexttoken NEXTTOKE;
+#endif
typedef struct op OP;
typedef struct cop COP;
typedef struct unop UNOP;
# define USE_HASH_SEED
#endif
+/* Win32 defines a type 'WORD' in windef.h. This conflicts with the enumerator
+ * 'WORD' defined in perly.h. The yytokentype enum is only a debugging aid, so
+ * it's not really needed.
+ */
+#if defined(WIN32)
+# define YYTOKENTYPE
+#endif
+#include "perly.h"
+
+#ifdef PERL_MAD
+struct nexttoken {
+ YYSTYPE next_val; /* value of next token, if any */
+ I32 next_type; /* type of next token */
+ MADPROP *next_mad; /* everything else about that token */
+};
+#endif
+
#include "regexp.h"
#include "sv.h"
#include "util.h"
#endif
#endif
-/* Win32 defines a type 'WORD' in windef.h. This conflicts with the enumerator
- * 'WORD' defined in perly.h. The yytokentype enum is only a debugging aid, so
- * it's not really needed.
- */
-#if defined(WIN32)
-# define YYTOKENTYPE
-#endif
-#include "perly.h"
-
#define LEX_NOTPARSING 11 /* borrowed from toke.c */
typedef enum {
#if !defined(PERL_FOR_X2P)
# include "embedvar.h"
#endif
+#ifndef PERL_MAD
+# undef PL_madskills
+# undef PL_xmlfp
+# define PL_madskills 0
+# define PL_xmlfp 0
+#endif
/* Now include all the 'global' variables
* If we don't have threads or multiple interpreters
#define PL_localpatches (*Perl_Ilocalpatches_ptr(aTHX))
#undef PL_lockhook
#define PL_lockhook (*Perl_Ilockhook_ptr(aTHX))
+#undef PL_madskills
+#define PL_madskills (*Perl_Imadskills_ptr(aTHX))
#undef PL_main_cv
#define PL_main_cv (*Perl_Imain_cv_ptr(aTHX))
#undef PL_main_root
#define PL_warnhook (*Perl_Iwarnhook_ptr(aTHX))
#undef PL_widesyscalls
#define PL_widesyscalls (*Perl_Iwidesyscalls_ptr(aTHX))
+#undef PL_xmlfp
+#define PL_xmlfp (*Perl_Ixmlfp_ptr(aTHX))
#undef PL_yycharp
#define PL_yycharp (*Perl_Iyycharp_ptr(aTHX))
#undef PL_yylvalp