This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fourth attempt to silence S_emulate_eaccess compiler warning
[perl5.git] / parser.h
CommitLineData
5912531f
DM
1/* parser.h
2 *
bc641c27 3 * Copyright (c) 2006, 2007, Larry Wall and others
5912531f
DM
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
acdf0a21
DM
12#define YYEMPTY (-2)
13
5912531f
DM
14typedef struct {
15 YYSTYPE val; /* semantic value */
16 short state;
17 AV *comppad; /* value of PL_comppad when this value was created */
33703721 18 I32 savestack_ix; /* size of savestack at this state */
5912531f
DM
19#ifdef DEBUGGING
20 const char *name; /* token/rule name for -Dpv */
21#endif
22} yy_stack_frame;
23
22735491 24typedef struct yy_parser {
199e78b7
DM
25
26 /* parser state */
27
22735491 28 struct yy_parser *old_parser; /* previous value of PL_parser */
5912531f 29 YYSTYPE yylval; /* value of lookahead symbol, set by yylex() */
9bd87817 30 int yychar; /* The lookahead symbol. */
5912531f
DM
31
32 /* Number of tokens to shift before error messages enabled. */
33 int yyerrstatus;
34
35 int stack_size;
36 int yylen; /* length of active reduction */
22735491 37 yy_stack_frame *stack; /* base of stack */
5912531f 38 yy_stack_frame *ps; /* current stack frame */
199e78b7
DM
39
40 /* lexer state */
41
42 I32 lex_brackets; /* bracket count */
43 I32 lex_casemods; /* casemod count */
44 char *lex_brackstack;/* what kind of brackets to pop */
45 char *lex_casestack; /* what kind of case mods in effect */
651b5b28
NC
46 U8 lex_defer; /* state after determined token */
47 bool lex_dojoin; /* doing an array interpolation */
48 U8 lex_expect; /* expect after determined token */
53a7735b 49 U8 expect; /* how to interpret ambiguous tokens */
199e78b7
DM
50 I32 lex_formbrack; /* bracket count at outer format level */
51 OP *lex_inpat; /* in pattern $) and $| are special */
199e78b7
DM
52 OP *lex_op; /* extra info to pass back on op */
53 SV *lex_repl; /* runtime replacement from s/// */
651b5b28 54 U16 lex_inwhat; /* what kind of quoting are we in */
f06b5848 55 OPCODE last_lop_op; /* last list operator */
199e78b7
DM
56 I32 lex_starts; /* how many interps done on level */
57 SV *lex_stuff; /* runtime pattern from m// or s/// */
58 I32 multi_start; /* 1st line of multi-line string */
670a9cb2 59 I32 multi_end; /* last line of multi-line string */
651b5b28
NC
60 char multi_open; /* delimiter of said string */
61 char multi_close; /* delimiter of said string */
199e78b7
DM
62 char pending_ident; /* pending identifier lookup */
63 bool preambled;
670a9cb2 64 /* XXX I32 space */
199e78b7 65 SUBLEXINFO sublex_info;
bdc0bf6f 66 SV *linestr; /* current chunk of src text */
f06b5848
DM
67 char *bufptr;
68 char *oldbufptr;
69 char *oldoldbufptr;
70 char *bufend;
71 char *linestart; /* beginning of most recently read line */
72 char *last_uni; /* position of last named-unary op */
73 char *last_lop; /* position of last list operator */
12bd6ede
DM
74 line_t copline; /* current line number */
75 U16 in_my; /* we're compiling a "my"/"our" declaration */
bc177e6b 76 U8 lex_state; /* next token is determined */
12bd6ede
DM
77 /* space for a U8 here */
78 HV *in_my_stash; /* declared class of this "my" declaration */
2f9285f8 79 PerlIO *rsfp; /* current source file pointer */
5486870f 80 AV *rsfp_filters; /* holds chain of active source filters */
13765c85 81 U8 error_count; /* how many compile errors so far, max 10 */
199e78b7
DM
82
83#ifdef PERL_MAD
84 SV *endwhite;
85 I32 faketokens;
86 I32 lasttoke;
87 SV *nextwhite;
88 I32 realtokenstart;
89 SV *skipwhite;
90 SV *thisclose;
91 MADPROP * thismad;
92 SV *thisopen;
93 SV *thisstuff;
94 SV *thistoken;
95 SV *thiswhite;
fb205e7a
DM
96
97/* What we know when we're in LEX_KNOWNEXT state. */
98 NEXTTOKE nexttoke[5]; /* value of next token, if any */
99 I32 curforce;
100#else
101 YYSTYPE nextval[5]; /* value of next token, if any */
102 I32 nexttype[5]; /* type of next token */
103 I32 nexttoke;
199e78b7 104#endif
fb205e7a 105
7c4baf47 106 COP *saved_curcop; /* the previous PL_curcop */
14047fc9 107 char tokenbuf[256];
7c4baf47 108
5912531f
DM
109} yy_parser;
110
111