move PL_in_my and PL_in_my_stash into the PL_parser struct
[p5sagit/p5-mst-13.2.git] / parser.h
1 /*    parser.h
2  *
3  *    Copyright (c) 2006, 2007, Larry Wall and others
4  *
5  *    You may distribute under the terms of either the GNU General Public
6  *    License or the Artistic License, as specified in the README file.
7  * 
8  * This file defines the layout of the parser object used by the parser
9  * and lexer (perly.c, toke,c).
10  */
11
12 #define YYEMPTY         (-2)
13
14 typedef struct {
15     YYSTYPE val;    /* semantic value */
16     short   state;
17     AV      *comppad; /* value of PL_comppad when this value was created */
18 #ifdef DEBUGGING
19     const char  *name; /* token/rule name for -Dpv */
20 #endif
21 } yy_stack_frame;
22
23 typedef struct yy_parser {
24
25     /* parser state */
26
27     struct yy_parser *old_parser; /* previous value of PL_parser */
28     YYSTYPE         yylval;     /* value of lookahead symbol, set by yylex() */
29     int             yychar;     /* The lookahead symbol.  */
30
31     /* Number of tokens to shift before error messages enabled.  */
32     int             yyerrstatus;
33
34     int             stack_size;
35     int             yylen;      /* length of active reduction */
36     yy_stack_frame  *stack;     /* base of stack */
37     yy_stack_frame  *ps;        /* current stack frame */
38
39     /* lexer state */
40
41     I32         lex_brackets;   /* bracket count */
42     I32         lex_casemods;   /* casemod count */
43     char        *lex_brackstack;/* what kind of brackets to pop */
44     char        *lex_casestack; /* what kind of case mods in effect */
45     U8          lex_defer;      /* state after determined token */
46     bool        lex_dojoin;     /* doing an array interpolation */
47     U8          lex_expect;     /* expect after determined token */
48     U8          expect;         /* how to interpret ambiguous tokens */
49     I32         lex_formbrack;  /* bracket count at outer format level */
50     OP          *lex_inpat;     /* in pattern $) and $| are special */
51     OP          *lex_op;        /* extra info to pass back on op */
52     SV          *lex_repl;      /* runtime replacement from s/// */
53     U16         lex_inwhat;     /* what kind of quoting are we in */
54     OPCODE      last_lop_op;    /* last list operator */
55     I32         lex_starts;     /* how many interps done on level */
56     SV          *lex_stuff;     /* runtime pattern from m// or s/// */
57     I32         multi_start;    /* 1st line of multi-line string */
58     char        multi_open;     /* delimiter of said string */
59     char        multi_close;    /* delimiter of said string */
60     char        pending_ident;  /* pending identifier lookup */
61     bool        preambled;
62     SUBLEXINFO  sublex_info;
63     SV          *linestr;       /* current chunk of src text */
64     char        *bufptr;        
65     char        *oldbufptr;     
66     char        *oldoldbufptr;  
67     char        *bufend;        
68     char        *linestart;     /* beginning of most recently read line */
69     char        *last_uni;      /* position of last named-unary op */
70     char        *last_lop;      /* position of last list operator */
71     line_t      copline;        /* current line number */
72     U16         in_my;          /* we're compiling a "my"/"our" declaration */
73     U8          lex_state;      /* next token is determined */
74     /* space for a U8 here */
75     HV          *in_my_stash;   /* declared class of this "my" declaration */
76     PerlIO      *rsfp;          /* current source file pointer */
77     AV          *rsfp_filters;  /* holds chain of active source filters */
78
79 #ifdef PERL_MAD
80     SV          *endwhite;
81     I32         faketokens;
82     I32         lasttoke;
83     SV          *nextwhite;
84     I32         realtokenstart;
85     SV          *skipwhite;
86     SV          *thisclose;
87     MADPROP *   thismad;
88     SV          *thisopen;
89     SV          *thisstuff;
90     SV          *thistoken;
91     SV          *thiswhite;
92
93 /* What we know when we're in LEX_KNOWNEXT state. */
94     NEXTTOKE    nexttoke[5];    /* value of next token, if any */
95     I32         curforce;
96 #else
97     YYSTYPE     nextval[5];     /* value of next token, if any */
98     I32         nexttype[5];    /* type of next token */
99     I32         nexttoke;
100 #endif
101
102     COP         *saved_curcop;  /* the previous PL_curcop */
103
104 } yy_parser;
105     
106