xref: /netbsd-src/external/bsd/flex/dist/src/initparse.c (revision d909946ca08dceb44d7d0f22ec9488679695d976)
1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar	1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
4 
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8 
9 #define YYEMPTY        (-1)
10 #define yyclearin      (yychar = YYEMPTY)
11 #define yyerrok        (yyerrflag = 0)
12 #define YYRECOVERING() (yyerrflag != 0)
13 #define YYENOMEM       (-2)
14 #define YYEOF          0
15 #undef YYBTYACC
16 #define YYBTYACC 0
17 #define YYDEBUGSTR YYPREFIX "debug"
18 #define YYPREFIX "yy"
19 
20 #define YYPURE 0
21 
22 /*  Copyright (c) 1990 The Regents of the University of California. */
23 /*  All rights reserved. */
24 
25 /*  This code is derived from software contributed to Berkeley by */
26 /*  Vern Paxson. */
27 
28 /*  The United States Government has rights in this work pursuant */
29 /*  to contract no. DE-AC03-76SF00098 between the United States */
30 /*  Department of Energy and the University of California. */
31 
32 /*  This file is part of flex. */
33 
34 /*  Redistribution and use in source and binary forms, with or without */
35 /*  modification, are permitted provided that the following conditions */
36 /*  are met: */
37 
38 /*  1. Redistributions of source code must retain the above copyright */
39 /*     notice, this list of conditions and the following disclaimer. */
40 /*  2. Redistributions in binary form must reproduce the above copyright */
41 /*     notice, this list of conditions and the following disclaimer in the */
42 /*     documentation and/or other materials provided with the distribution. */
43 
44 /*  Neither the name of the University nor the names of its contributors */
45 /*  may be used to endorse or promote products derived from this software */
46 /*  without specific prior written permission. */
47 
48 /*  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
49 /*  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
50 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
51 /*  PURPOSE. */
52 #include "flexdef.h"
53 __RCSID("$NetBSD: initparse.c,v 1.2 2016/03/17 15:28:00 nakayama Exp $");
54 
55 #include "tables.h"
56 
57 int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen;
58 int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule;
59 
60 int *scon_stk;
61 int scon_stk_ptr;
62 
63 static int madeany = false;  /* whether we've made the '.' character class */
64 static int ccldot, cclany;
65 int previous_continued_action;	/* whether the previous rule's action was '|' */
66 
67 #define format_warn3(fmt, a1, a2) \
68 	do{ \
69         char fw3_msg[MAXLINE];\
70         snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
71         lwarn( fw3_msg );\
72 	}while(0)
73 
74 /* Expand a POSIX character class expression. */
75 #define CCL_EXPR(func) \
76 	do{ \
77 	int c; \
78 	for ( c = 0; c < csize; ++c ) \
79 		if ( isascii(c) && func(c) ) \
80 			ccladd( currccl, c ); \
81 	}while(0)
82 
83 /* negated class */
84 #define CCL_NEG_EXPR(func) \
85 	do{ \
86 	int c; \
87 	for ( c = 0; c < csize; ++c ) \
88 		if ( !func(c) ) \
89 			ccladd( currccl, c ); \
90 	}while(0)
91 
92 /* While POSIX defines isblank(), it's not ANSI C. */
93 #define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
94 
95 /* On some over-ambitious machines, such as DEC Alpha's, the default
96  * token type is "long" instead of "int"; this leads to problems with
97  * declaring yylval in flexdef.h.  But so far, all the yacc's I've seen
98  * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
99  * following should ensure that the default token type is "int".
100  */
101 #define YYSTYPE int
102 
103 
104 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
105 /* Default: YYSTYPE is the semantic value type. */
106 typedef int YYSTYPE;
107 # define YYSTYPE_IS_DECLARED 1
108 #endif
109 
110 /* compatibility with bison */
111 #ifdef YYPARSE_PARAM
112 /* compatibility with FreeBSD */
113 # ifdef YYPARSE_PARAM_TYPE
114 #  define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
115 # else
116 #  define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
117 # endif
118 #else
119 # define YYPARSE_DECL() yyparse(void)
120 #endif
121 
122 /* Parameters sent to lex. */
123 #ifdef YYLEX_PARAM
124 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
125 # define YYLEX yylex(YYLEX_PARAM)
126 #else
127 # define YYLEX_DECL() yylex(void)
128 # define YYLEX yylex()
129 #endif
130 
131 /* Parameters sent to yyerror. */
132 #ifndef YYERROR_DECL
133 #define YYERROR_DECL() yyerror(const char *s)
134 #endif
135 #ifndef YYERROR_CALL
136 #define YYERROR_CALL(msg) yyerror(msg)
137 #endif
138 
139 extern int YYPARSE_DECL();
140 
141 #define CHAR 257
142 #define NUMBER 258
143 #define SECTEND 259
144 #define SCDECL 260
145 #define XSCDECL 261
146 #define NAME 262
147 #define PREVCCL 263
148 #define EOF_OP 264
149 #define OPTION_OP 265
150 #define OPT_OUTFILE 266
151 #define OPT_PREFIX 267
152 #define OPT_YYCLASS 268
153 #define OPT_HEADER 269
154 #define OPT_EXTRA_TYPE 270
155 #define OPT_TABLES 271
156 #define CCE_ALNUM 272
157 #define CCE_ALPHA 273
158 #define CCE_BLANK 274
159 #define CCE_CNTRL 275
160 #define CCE_DIGIT 276
161 #define CCE_GRAPH 277
162 #define CCE_LOWER 278
163 #define CCE_PRINT 279
164 #define CCE_PUNCT 280
165 #define CCE_SPACE 281
166 #define CCE_UPPER 282
167 #define CCE_XDIGIT 283
168 #define CCE_NEG_ALNUM 284
169 #define CCE_NEG_ALPHA 285
170 #define CCE_NEG_BLANK 286
171 #define CCE_NEG_CNTRL 287
172 #define CCE_NEG_DIGIT 288
173 #define CCE_NEG_GRAPH 289
174 #define CCE_NEG_LOWER 290
175 #define CCE_NEG_PRINT 291
176 #define CCE_NEG_PUNCT 292
177 #define CCE_NEG_SPACE 293
178 #define CCE_NEG_UPPER 294
179 #define CCE_NEG_XDIGIT 295
180 #define CCL_OP_DIFF 296
181 #define CCL_OP_UNION 297
182 #define BEGIN_REPEAT_POSIX 298
183 #define END_REPEAT_POSIX 299
184 #define BEGIN_REPEAT_FLEX 300
185 #define END_REPEAT_FLEX 301
186 #define YYERRCODE 256
187 typedef int YYINT;
188 static const YYINT yylhs[] = {                           -1,
189     0,    1,    2,    2,    2,    2,    3,    6,    6,    7,
190     7,    7,    8,    9,    9,   10,   10,   10,   10,   10,
191    10,    4,    4,    4,    5,   12,   12,   12,   12,   14,
192    11,   11,   11,   15,   15,   15,   16,   13,   13,   13,
193    13,   18,   18,   17,   19,   19,   19,   19,   19,   20,
194    20,   20,   20,   20,   20,   20,   20,   20,   20,   20,
195    20,   21,   21,   21,   23,   23,   24,   24,   24,   24,
196    25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
197    25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
198    25,   25,   25,   25,   22,   22,
199 };
200 static const YYINT yylen[] = {                            2,
201     5,    0,    3,    2,    0,    1,    1,    1,    1,    2,
202     1,    1,    2,    2,    0,    3,    3,    3,    3,    3,
203     3,    5,    5,    0,    0,    2,    1,    1,    1,    0,
204     4,    3,    0,    3,    1,    1,    1,    2,    3,    2,
205     1,    3,    1,    2,    2,    1,    6,    5,    4,    2,
206     2,    2,    6,    5,    4,    1,    1,    1,    3,    3,
207     1,    3,    3,    1,    3,    4,    4,    2,    2,    0,
208     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
209     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
210     1,    1,    1,    1,    2,    0,
211 };
212 static const YYINT yydefred[] = {                         2,
213     0,    0,    6,    0,    7,    8,    9,   15,   24,    0,
214     4,    0,    0,   12,   11,    0,    0,    0,    0,    0,
215     0,    0,   14,    0,    1,    0,   10,    0,    0,    0,
216     0,    0,    0,    0,    0,   24,    0,   16,   18,   19,
217    20,   17,   21,   32,   36,   37,    0,   35,    0,   29,
218    61,   58,   28,    0,   56,   96,    0,    0,    0,   27,
219     0,    0,    0,    0,    0,   64,   31,    0,   23,   26,
220     0,    0,   70,    0,   22,    0,   40,    0,   44,    0,
221     0,    0,   50,   51,   52,    0,    0,   34,   95,   59,
222    60,    0,    0,   71,   72,   73,   74,   75,   76,   77,
223    78,   79,   80,   82,   81,   83,   84,   85,   86,   87,
224    88,   93,   89,   90,   91,   94,   92,   65,   69,   39,
225     0,    0,    0,   62,   63,   66,    0,   49,    0,   55,
226     0,   67,    0,   48,    0,   54,   47,   53,
227 };
228 #if defined(YYDESTRUCT_CALL) || defined(YYSTYPE_TOSTRING)
229 static const YYINT yystos[] = {                           0,
230   303,  304,  256,  305,  259,  260,  261,  265,  306,  309,
231   311,  312,  307,  256,  262,  310,  266,  267,  268,  269,
232   270,  271,  313,   60,  308,  314,  262,   61,   61,   61,
233    61,   61,   61,   42,  317,  123,  308,  262,  262,  262,
234   262,  262,  262,   62,  256,  262,  318,  319,  307,  256,
235   257,  263,  264,   94,   46,   34,   40,   91,  315,  316,
236   320,  321,  322,  323,  324,  326,   62,   44,  125,  316,
237   325,  321,   94,  327,   10,  321,   36,  124,   47,  298,
238   323,  300,   42,   43,   63,  296,  297,  319,  257,   34,
239    41,  327,  257,  272,  273,  274,  275,  276,  277,  278,
240   279,  280,  281,  282,  283,  284,  285,  286,  287,  288,
241   289,  290,  291,  292,  293,  294,  295,   93,  328,   36,
242   322,  258,  258,  326,  326,   93,   45,  299,   44,  301,
243    44,  257,  258,  299,  258,  301,  299,  301,
244 };
245 #endif /* YYDESTRUCT_CALL || YYSTYPE_TOSTRING */
246 static const YYINT yydgoto[] = {                          1,
247     2,    4,    9,   13,   25,   10,   16,   11,   12,   23,
248    26,   59,   60,   35,   47,   48,   61,   62,   63,   64,
249    65,   71,   66,   74,  119,
250 };
251 static const YYINT yysindex[] = {                         0,
252     0, -222,    0, -155,    0,    0,    0,    0,    0, -215,
253     0, -123,    6,    0,    0, -193,   10,   21,   26,   31,
254    35,   37,    0,   59,    0,  -44,    0, -147, -145, -140,
255  -133, -132, -129,   75, -214,    0,  -19,    0,    0,    0,
256     0,    0,    0,    0,    0,    0,   23,    0,  -48,    0,
257     0,    0,    0,  -17,    0,    0,  -17,   27,  128,    0,
258   -17,   -1,  -30,  -41, -189,    0,    0, -121,    0,    0,
259   -31,  -34,    0,  -87,    0,  -25,    0,  -17,    0, -109,
260   -41, -108,    0,    0,    0,   60,   60,    0,    0,    0,
261     0,   46,  107,    0,    0,    0,    0,    0,    0,    0,
262     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
263     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
264   -30,  -36,  -39,    0,    0,    0, -104,    0, -219,    0,
265  -238,    0, -144,    0, -143,    0,    0,    0,
266 };
267 static const YYINT yyrindex[] = {                         0,
268     0, -141,    0,    0,    0,    0,    0,    0,    0,    0,
269     0, -134,    9,    0,    0, -125,    0,    0,    0,    0,
270     0,    0,    0, -178,    0,   22,    0,    0,    0,    0,
271     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
272     0,    0,    0,    0,    0,    0,    0,    0,  -21,    0,
273     0,    0,    0,    0,    0,    0,    0,   85,    0,    0,
274     0,  144,   47,    4,  -10,    0,    0,    0,    0,    0,
275     0,    0,    0,    0,    0,  146,    0,    0,    0,    0,
276    18,    0,    0,    0,    0,    0,    0,    0,    0,    0,
277     0,    0,  124,    0,    0,    0,    0,    0,    0,    0,
278     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
279     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
280    50,    0,    0,    0,    0,    0,    0,    0,    0,    0,
281     0,    0,    0,    0,    0,    0,    0,    0,
282 };
283 #if YYBTYACC
284 static const YYINT yycindex[] = {                         0,
285     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
286     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
287     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
288     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
289     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
290     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
291     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
292     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
293     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
294     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
295     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
296     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
297     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
298     0,    0,    0,    0,    0,    0,    0,    0,
299 };
300 #endif
301 static const YYINT yygindex[] = {                         0,
302     0,    0,    0,  121,  133,    0,    0,    0,    0,    0,
303     0,    0,  106,    0,    0,   93,    0,   32,   84,  -45,
304     0,    0,   25,   90,    0,
305 };
306 #define YYTABLESIZE 419
307 static const YYINT yytable[] = {                         57,
308    83,   84,   90,   56,  131,  118,   91,  129,   25,   57,
309   120,   24,   33,   46,   56,   55,   56,   81,   33,  135,
310    57,   85,   57,   57,   33,   57,   55,   45,   55,   57,
311    57,   57,   57,    3,   77,   57,   57,   46,  133,   46,
312    14,   45,   33,   46,   46,   79,   15,   46,   33,   46,
313    46,   45,   57,   45,   33,   25,   43,   45,   45,   42,
314    58,   25,  136,   45,   45,   24,   68,   25,   27,   33,
315    28,   58,   33,   58,   54,   81,   69,   30,   36,  134,
316    57,   29,   43,   30,   67,   42,   30,   43,   72,   78,
317    42,   31,   76,   43,   46,   32,   42,   33,   78,   33,
318    34,   33,   33,    5,    6,    7,   86,   87,   45,    8,
319   124,  125,   25,   57,   38,   25,   39,    5,    5,    5,
320    73,   40,   78,    5,   13,   13,   13,   46,   41,   42,
321    13,   33,   43,    3,    3,    3,   44,   75,  126,    3,
322    46,   45,   17,   18,   19,   20,   21,   22,  122,  123,
323    58,  127,  132,   41,  137,   38,   49,  138,   37,   70,
324    88,  121,   92,    0,    0,    0,    0,    0,    0,   93,
325    43,    0,    0,   42,    0,    0,    0,   70,    0,    0,
326     0,    0,    0,    0,   94,   95,   96,   97,   98,   99,
327   100,  101,  102,  103,  104,  105,  106,  107,  108,  109,
328   110,  111,  112,  113,  114,  115,  116,  117,    0,    0,
329     0,    0,    0,    0,    0,    0,   68,    0,    0,    0,
330     0,    0,    0,    0,    0,   89,   51,    0,    0,    0,
331     0,    0,   52,    0,   33,   33,   50,   51,    0,   51,
332     0,   33,   33,   52,   53,   52,   57,    0,    0,    0,
333     0,    0,   57,    0,    0,    0,    0,    0,   82,    0,
334    46,  130,  128,    0,   33,   33,   46,   80,    0,    0,
335     0,   33,   33,    0,   45,    0,    0,   25,   25,    0,
336    45,    0,    0,    0,   25,   25,    0,   57,    0,   57,
337     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
338     0,   46,   93,    0,    0,    0,    0,    0,    0,    0,
339     0,    0,    0,    0,    0,   45,    0,   94,   95,   96,
340    97,   98,   99,  100,  101,  102,  103,  104,  105,  106,
341   107,  108,  109,  110,  111,  112,  113,  114,  115,  116,
342   117,   70,    0,    0,    0,    0,    0,    0,    0,    0,
343     0,    0,    0,    0,    0,    0,   70,   70,   70,   70,
344    70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
345    70,   70,   70,   70,   70,   70,   70,   70,   70,   70,
346    68,    0,    0,    0,    0,    0,    0,    0,    0,    0,
347     0,    0,    0,    0,    0,   68,   68,   68,   68,   68,
348    68,   68,   68,   68,   68,   68,   68,   68,   68,   68,
349    68,   68,   68,   68,   68,   68,   68,   68,   68,
350 };
351 static const YYINT yycheck[] = {                         10,
352    42,   43,   34,   34,   44,   93,   41,   44,    0,   40,
353    36,   60,   34,   10,   34,   46,   34,   63,   40,  258,
354    40,   63,   40,   34,   46,   36,   46,   10,   46,   40,
355    41,   42,   43,  256,   36,   46,   47,   34,  258,   36,
356   256,  256,   34,   40,   41,   47,  262,  262,   40,   46,
357    47,   34,   63,   36,   46,   34,   10,   40,   41,   10,
358    91,   40,  301,   46,   47,   60,   44,   46,  262,   91,
359    61,   91,   94,   91,   94,  121,  125,  256,  123,  299,
360    91,   61,   36,  262,   62,   36,   61,   41,   57,  124,
361    41,   61,   61,   47,   91,   61,   47,   61,  124,   91,
362    42,  123,   94,  259,  260,  261,  296,  297,   91,  265,
363    86,   87,   91,  124,  262,   94,  262,  259,  260,  261,
364    94,  262,  124,  265,  259,  260,  261,  124,  262,  262,
365   265,  123,  262,  259,  260,  261,   62,   10,   93,  265,
366   262,  124,  266,  267,  268,  269,  270,  271,  258,  258,
367    91,   45,  257,   10,  299,   10,   36,  301,   26,   54,
368    68,   78,   73,   -1,   -1,   -1,   -1,   -1,   -1,  257,
369   124,   -1,   -1,  124,   -1,   -1,   -1,   93,   -1,   -1,
370    -1,   -1,   -1,   -1,  272,  273,  274,  275,  276,  277,
371   278,  279,  280,  281,  282,  283,  284,  285,  286,  287,
372   288,  289,  290,  291,  292,  293,  294,  295,   -1,   -1,
373    -1,   -1,   -1,   -1,   -1,   -1,   93,   -1,   -1,   -1,
374    -1,   -1,   -1,   -1,   -1,  257,  257,   -1,   -1,   -1,
375    -1,   -1,  263,   -1,  256,  257,  256,  257,   -1,  257,
376    -1,  263,  264,  263,  264,  263,  257,   -1,   -1,   -1,
377    -1,   -1,  263,   -1,   -1,   -1,   -1,   -1,  300,   -1,
378   257,  301,  299,   -1,  256,  257,  263,  298,   -1,   -1,
379    -1,  263,  264,   -1,  257,   -1,   -1,  256,  257,   -1,
380   263,   -1,   -1,   -1,  263,  264,   -1,  298,   -1,  300,
381    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
382    -1,  298,  257,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
383    -1,   -1,   -1,   -1,   -1,  298,   -1,  272,  273,  274,
384   275,  276,  277,  278,  279,  280,  281,  282,  283,  284,
385   285,  286,  287,  288,  289,  290,  291,  292,  293,  294,
386   295,  257,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
387    -1,   -1,   -1,   -1,   -1,   -1,  272,  273,  274,  275,
388   276,  277,  278,  279,  280,  281,  282,  283,  284,  285,
389   286,  287,  288,  289,  290,  291,  292,  293,  294,  295,
390   257,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
391    -1,   -1,   -1,   -1,   -1,  272,  273,  274,  275,  276,
392   277,  278,  279,  280,  281,  282,  283,  284,  285,  286,
393   287,  288,  289,  290,  291,  292,  293,  294,  295,
394 };
395 #if YYBTYACC
396 static const YYINT yyctable[] = {                        -1,
397    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
398    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
399    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
400    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
401    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
402    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
403    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
404    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
405    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
406    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
407    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
408    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
409    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
410    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
411    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
412    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
413    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
414    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
415    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
416    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
417    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
418    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
419    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
420    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
421    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
422    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
423    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
424    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
425    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
426    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
427    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
428    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
429    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
430    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
431    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
432    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
433    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
434    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
435    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
436    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
437    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
438    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
439 };
440 #endif
441 #define YYFINAL 1
442 #ifndef YYDEBUG
443 #define YYDEBUG 0
444 #endif
445 #define YYMAXTOKEN 301
446 #define YYUNDFTOKEN 329
447 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
448 #if YYDEBUG
449 static const char *const yyname[] = {
450 
451 "$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
452 "'\"'",0,"'$'",0,0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,0,0,
453 0,0,0,0,0,0,0,"'<'","'='","'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
454 0,0,0,0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
455 0,0,0,0,"'{'","'|'","'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
456 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
457 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
458 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","CHAR","NUMBER","SECTEND",
459 "SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","OPTION_OP","OPT_OUTFILE",
460 "OPT_PREFIX","OPT_YYCLASS","OPT_HEADER","OPT_EXTRA_TYPE","OPT_TABLES",
461 "CCE_ALNUM","CCE_ALPHA","CCE_BLANK","CCE_CNTRL","CCE_DIGIT","CCE_GRAPH",
462 "CCE_LOWER","CCE_PRINT","CCE_PUNCT","CCE_SPACE","CCE_UPPER","CCE_XDIGIT",
463 "CCE_NEG_ALNUM","CCE_NEG_ALPHA","CCE_NEG_BLANK","CCE_NEG_CNTRL","CCE_NEG_DIGIT",
464 "CCE_NEG_GRAPH","CCE_NEG_LOWER","CCE_NEG_PRINT","CCE_NEG_PUNCT","CCE_NEG_SPACE",
465 "CCE_NEG_UPPER","CCE_NEG_XDIGIT","CCL_OP_DIFF","CCL_OP_UNION",
466 "BEGIN_REPEAT_POSIX","END_REPEAT_POSIX","BEGIN_REPEAT_FLEX","END_REPEAT_FLEX",
467 "$accept","goal","initlex","sect1","sect1end","sect2","initforrule",
468 "startconddecl","namelist1","options","optionlist","option","scon","flexrule",
469 "rule","scon_stk_ptr","namelist2","sconname","re2","re","series","singleton",
470 "fullccl","string","braceccl","ccl","ccl_expr","illegal-symbol",
471 };
472 static const char *const yyrule[] = {
473 "$accept : goal",
474 "goal : initlex sect1 sect1end sect2 initforrule",
475 "initlex :",
476 "sect1 : sect1 startconddecl namelist1",
477 "sect1 : sect1 options",
478 "sect1 :",
479 "sect1 : error",
480 "sect1end : SECTEND",
481 "startconddecl : SCDECL",
482 "startconddecl : XSCDECL",
483 "namelist1 : namelist1 NAME",
484 "namelist1 : NAME",
485 "namelist1 : error",
486 "options : OPTION_OP optionlist",
487 "optionlist : optionlist option",
488 "optionlist :",
489 "option : OPT_OUTFILE '=' NAME",
490 "option : OPT_EXTRA_TYPE '=' NAME",
491 "option : OPT_PREFIX '=' NAME",
492 "option : OPT_YYCLASS '=' NAME",
493 "option : OPT_HEADER '=' NAME",
494 "option : OPT_TABLES '=' NAME",
495 "sect2 : sect2 scon initforrule flexrule '\\n'",
496 "sect2 : sect2 scon '{' sect2 '}'",
497 "sect2 :",
498 "initforrule :",
499 "flexrule : '^' rule",
500 "flexrule : rule",
501 "flexrule : EOF_OP",
502 "flexrule : error",
503 "scon_stk_ptr :",
504 "scon : '<' scon_stk_ptr namelist2 '>'",
505 "scon : '<' '*' '>'",
506 "scon :",
507 "namelist2 : namelist2 ',' sconname",
508 "namelist2 : sconname",
509 "namelist2 : error",
510 "sconname : NAME",
511 "rule : re2 re",
512 "rule : re2 re '$'",
513 "rule : re '$'",
514 "rule : re",
515 "re : re '|' series",
516 "re : series",
517 "re2 : re '/'",
518 "series : series singleton",
519 "series : singleton",
520 "series : series BEGIN_REPEAT_POSIX NUMBER ',' NUMBER END_REPEAT_POSIX",
521 "series : series BEGIN_REPEAT_POSIX NUMBER ',' END_REPEAT_POSIX",
522 "series : series BEGIN_REPEAT_POSIX NUMBER END_REPEAT_POSIX",
523 "singleton : singleton '*'",
524 "singleton : singleton '+'",
525 "singleton : singleton '?'",
526 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' NUMBER END_REPEAT_FLEX",
527 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' END_REPEAT_FLEX",
528 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER END_REPEAT_FLEX",
529 "singleton : '.'",
530 "singleton : fullccl",
531 "singleton : PREVCCL",
532 "singleton : '\"' string '\"'",
533 "singleton : '(' re ')'",
534 "singleton : CHAR",
535 "fullccl : fullccl CCL_OP_DIFF braceccl",
536 "fullccl : fullccl CCL_OP_UNION braceccl",
537 "fullccl : braceccl",
538 "braceccl : '[' ccl ']'",
539 "braceccl : '[' '^' ccl ']'",
540 "ccl : ccl CHAR '-' CHAR",
541 "ccl : ccl CHAR",
542 "ccl : ccl ccl_expr",
543 "ccl :",
544 "ccl_expr : CCE_ALNUM",
545 "ccl_expr : CCE_ALPHA",
546 "ccl_expr : CCE_BLANK",
547 "ccl_expr : CCE_CNTRL",
548 "ccl_expr : CCE_DIGIT",
549 "ccl_expr : CCE_GRAPH",
550 "ccl_expr : CCE_LOWER",
551 "ccl_expr : CCE_PRINT",
552 "ccl_expr : CCE_PUNCT",
553 "ccl_expr : CCE_SPACE",
554 "ccl_expr : CCE_XDIGIT",
555 "ccl_expr : CCE_UPPER",
556 "ccl_expr : CCE_NEG_ALNUM",
557 "ccl_expr : CCE_NEG_ALPHA",
558 "ccl_expr : CCE_NEG_BLANK",
559 "ccl_expr : CCE_NEG_CNTRL",
560 "ccl_expr : CCE_NEG_DIGIT",
561 "ccl_expr : CCE_NEG_GRAPH",
562 "ccl_expr : CCE_NEG_PRINT",
563 "ccl_expr : CCE_NEG_PUNCT",
564 "ccl_expr : CCE_NEG_SPACE",
565 "ccl_expr : CCE_NEG_XDIGIT",
566 "ccl_expr : CCE_NEG_LOWER",
567 "ccl_expr : CCE_NEG_UPPER",
568 "string : string CHAR",
569 "string :",
570 
571 };
572 #endif
573 
574 int      yydebug;
575 int      yynerrs;
576 
577 int      yyerrflag;
578 int      yychar;
579 YYSTYPE  yyval;
580 YYSTYPE  yylval;
581 
582 /* define the initial stack-sizes */
583 #ifdef YYSTACKSIZE
584 #undef YYMAXDEPTH
585 #define YYMAXDEPTH  YYSTACKSIZE
586 #else
587 #ifdef YYMAXDEPTH
588 #define YYSTACKSIZE YYMAXDEPTH
589 #else
590 #define YYSTACKSIZE 10000
591 #define YYMAXDEPTH  10000
592 #endif
593 #endif
594 
595 #define YYINITSTACKSIZE 200
596 
597 typedef struct {
598     unsigned stacksize;
599     YYINT    *s_base;
600     YYINT    *s_mark;
601     YYINT    *s_last;
602     YYSTYPE  *l_base;
603     YYSTYPE  *l_mark;
604 } YYSTACKDATA;
605 /* variables for the parser stack */
606 static YYSTACKDATA yystack;
607 
608 
609 /* build_eof_action - build the "<<EOF>>" action for the active start
610  *                    conditions
611  */
612 
613 void build_eof_action()
614 	{
615 	int i;
616 	char action_text[MAXLINE];
617 
618 	for ( i = 1; i <= scon_stk_ptr; ++i )
619 		{
620 		if ( sceof[scon_stk[i]] )
621 			format_pinpoint_message(
622 				"multiple <<EOF>> rules for start condition %s",
623 				scname[scon_stk[i]] );
624 
625 		else
626 			{
627 			sceof[scon_stk[i]] = true;
628 
629 			if (previous_continued_action /* && previous action was regular */)
630 				add_action("YY_RULE_SETUP\n");
631 
632 			snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n",
633 				scname[scon_stk[i]] );
634 			add_action( action_text );
635 			}
636 		}
637 
638 	line_directive_out( (FILE *) 0, 1 );
639 
640 	/* This isn't a normal rule after all - don't count it as
641 	 * such, so we don't have any holes in the rule numbering
642 	 * (which make generating "rule can never match" warnings
643 	 * more difficult.
644 	 */
645 	--num_rules;
646 	++num_eof_rules;
647 	}
648 
649 
650 /* format_synerr - write out formatted syntax error */
651 
652 void format_synerr( msg, arg )
653 const char *msg, arg[];
654 	{
655 	char errmsg[MAXLINE];
656 
657 	(void) snprintf( errmsg, sizeof(errmsg), msg, arg );
658 	synerr( errmsg );
659 	}
660 
661 
662 /* synerr - report a syntax error */
663 
664 void synerr( str )
665 const char *str;
666 	{
667 	syntaxerror = true;
668 	pinpoint_message( str );
669 	}
670 
671 
672 /* format_warn - write out formatted warning */
673 
674 void format_warn( msg, arg )
675 const char *msg, arg[];
676 	{
677 	char warn_msg[MAXLINE];
678 
679 	snprintf( warn_msg, sizeof(warn_msg), msg, arg );
680 	lwarn( warn_msg );
681 	}
682 
683 
684 /* lwarn - report a warning, unless -w was given */
685 
686 void lwarn( str )
687 const char *str;
688 	{
689 	line_warning( str, linenum );
690 	}
691 
692 /* format_pinpoint_message - write out a message formatted with one string,
693  *			     pinpointing its location
694  */
695 
696 void format_pinpoint_message( msg, arg )
697 const char *msg, arg[];
698 	{
699 	char errmsg[MAXLINE];
700 
701 	snprintf( errmsg, sizeof(errmsg), msg, arg );
702 	pinpoint_message( errmsg );
703 	}
704 
705 
706 /* pinpoint_message - write out a message, pinpointing its location */
707 
708 void pinpoint_message( str )
709 const char *str;
710 	{
711 	line_pinpoint( str, linenum );
712 	}
713 
714 
715 /* line_warning - report a warning at a given line, unless -w was given */
716 
717 void line_warning( str, line )
718 const char *str;
719 int line;
720 	{
721 	char warning[MAXLINE];
722 
723 	if ( ! nowarn )
724 		{
725 		snprintf( warning, sizeof(warning), "warning, %s", str );
726 		line_pinpoint( warning, line );
727 		}
728 	}
729 
730 
731 /* line_pinpoint - write out a message, pinpointing it at the given line */
732 
733 void line_pinpoint( str, line )
734 const char *str;
735 int line;
736 	{
737 	fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
738 	}
739 
740 
741 /* yyerror - eat up an error message from the parser;
742  *	     currently, messages are ignore
743  */
744 
745 void yyerror( msg )
746 const char *msg;
747 	{
748 		(void)msg;
749 	}
750 
751 #if YYDEBUG
752 #include <stdio.h>		/* needed for printf */
753 #endif
754 
755 #include <stdlib.h>	/* needed for malloc, etc */
756 #include <string.h>	/* needed for memset */
757 
758 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
759 static int yygrowstack(YYSTACKDATA *data)
760 {
761     int i;
762     unsigned newsize;
763     YYINT *newss;
764     YYSTYPE *newvs;
765 
766     if ((newsize = data->stacksize) == 0)
767         newsize = YYINITSTACKSIZE;
768     else if (newsize >= YYMAXDEPTH)
769         return YYENOMEM;
770     else if ((newsize *= 2) > YYMAXDEPTH)
771         newsize = YYMAXDEPTH;
772 
773     i = (int) (data->s_mark - data->s_base);
774     newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
775     if (newss == 0)
776         return YYENOMEM;
777 
778     data->s_base = newss;
779     data->s_mark = newss + i;
780 
781     newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
782     if (newvs == 0)
783         return YYENOMEM;
784 
785     data->l_base = newvs;
786     data->l_mark = newvs + i;
787 
788     data->stacksize = newsize;
789     data->s_last = data->s_base + newsize - 1;
790     return 0;
791 }
792 
793 #if YYPURE || defined(YY_NO_LEAKS)
794 static void yyfreestack(YYSTACKDATA *data)
795 {
796     free(data->s_base);
797     free(data->l_base);
798     memset(data, 0, sizeof(*data));
799 }
800 #else
801 #define yyfreestack(data) /* nothing */
802 #endif
803 
804 #define YYABORT  goto yyabort
805 #define YYREJECT goto yyabort
806 #define YYACCEPT goto yyaccept
807 #define YYERROR  goto yyerrlab
808 
809 int
810 YYPARSE_DECL()
811 {
812     int yym, yyn, yystate;
813 #if YYDEBUG
814     const char *yys;
815 
816     if ((yys = getenv("YYDEBUG")) != 0)
817     {
818         yyn = *yys;
819         if (yyn >= '0' && yyn <= '9')
820             yydebug = yyn - '0';
821     }
822 #endif
823 
824     yynerrs = 0;
825     yyerrflag = 0;
826     yychar = YYEMPTY;
827     yystate = 0;
828 
829 #if YYPURE
830     memset(&yystack, 0, sizeof(yystack));
831 #endif
832 
833     if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
834     yystack.s_mark = yystack.s_base;
835     yystack.l_mark = yystack.l_base;
836     yystate = 0;
837     *yystack.s_mark = 0;
838 
839 yyloop:
840     if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
841     if (yychar < 0)
842     {
843         if ((yychar = YYLEX) < 0) yychar = YYEOF;
844 #if YYDEBUG
845         if (yydebug)
846         {
847             yys = yyname[YYTRANSLATE(yychar)];
848             printf("%sdebug: state %d, reading %d (%s)\n",
849                     YYPREFIX, yystate, yychar, yys);
850         }
851 #endif
852     }
853     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
854             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
855     {
856 #if YYDEBUG
857         if (yydebug)
858             printf("%sdebug: state %d, shifting to state %d\n",
859                     YYPREFIX, yystate, yytable[yyn]);
860 #endif
861         if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
862         {
863             goto yyoverflow;
864         }
865         yystate = yytable[yyn];
866         *++yystack.s_mark = yytable[yyn];
867         *++yystack.l_mark = yylval;
868         yychar = YYEMPTY;
869         if (yyerrflag > 0)  --yyerrflag;
870         goto yyloop;
871     }
872     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
873             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
874     {
875         yyn = yytable[yyn];
876         goto yyreduce;
877     }
878     if (yyerrflag) goto yyinrecovery;
879 
880     YYERROR_CALL("syntax error");
881 
882     goto yyerrlab;
883 
884 yyerrlab:
885     ++yynerrs;
886 
887 yyinrecovery:
888     if (yyerrflag < 3)
889     {
890         yyerrflag = 3;
891         for (;;)
892         {
893             if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
894                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
895             {
896 #if YYDEBUG
897                 if (yydebug)
898                     printf("%sdebug: state %d, error recovery shifting\
899  to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
900 #endif
901                 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
902                 {
903                     goto yyoverflow;
904                 }
905                 yystate = yytable[yyn];
906                 *++yystack.s_mark = yytable[yyn];
907                 *++yystack.l_mark = yylval;
908                 goto yyloop;
909             }
910             else
911             {
912 #if YYDEBUG
913                 if (yydebug)
914                     printf("%sdebug: error recovery discarding state %d\n",
915                             YYPREFIX, *yystack.s_mark);
916 #endif
917                 if (yystack.s_mark <= yystack.s_base) goto yyabort;
918                 --yystack.s_mark;
919                 --yystack.l_mark;
920             }
921         }
922     }
923     else
924     {
925         if (yychar == YYEOF) goto yyabort;
926 #if YYDEBUG
927         if (yydebug)
928         {
929             yys = yyname[YYTRANSLATE(yychar)];
930             printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
931                     YYPREFIX, yystate, yychar, yys);
932         }
933 #endif
934         yychar = YYEMPTY;
935         goto yyloop;
936     }
937 
938 yyreduce:
939 #if YYDEBUG
940     if (yydebug)
941         printf("%sdebug: state %d, reducing by rule %d (%s)\n",
942                 YYPREFIX, yystate, yyn, yyrule[yyn]);
943 #endif
944     yym = yylen[yyn];
945     if (yym)
946         yyval = yystack.l_mark[1-yym];
947     else
948         memset(&yyval, 0, sizeof yyval);
949     switch (yyn)
950     {
951 case 1:
952 	{ /* add default rule */
953 			int def_rule;
954 
955 			pat = cclinit();
956 			cclnegate( pat );
957 
958 			def_rule = mkstate( -pat );
959 
960 			/* Remember the number of the default rule so we
961 			 * don't generate "can't match" warnings for it.
962 			 */
963 			default_rule = num_rules;
964 
965 			finish_rule( def_rule, false, 0, 0, 0);
966 
967 			for ( i = 1; i <= lastsc; ++i )
968 				scset[i] = mkbranch( scset[i], def_rule );
969 
970 			if ( spprdflt )
971 				add_action(
972 				"YY_FATAL_ERROR( \"flex scanner jammed\" )" );
973 			else
974 				add_action( "ECHO" );
975 
976 			add_action( ";\n\tYY_BREAK\n" );
977 			}
978 break;
979 case 2:
980 	{ /* initialize for processing rules */
981 
982 			/* Create default DFA start condition. */
983 			scinstal( "INITIAL", false );
984 			}
985 break;
986 case 6:
987 	{ synerr( _("unknown error processing section 1") ); }
988 break;
989 case 7:
990 	{
991 			check_options();
992 			scon_stk = allocate_integer_array( lastsc + 1 );
993 			scon_stk_ptr = 0;
994 			}
995 break;
996 case 8:
997 	{ xcluflg = false; }
998 break;
999 case 9:
1000 	{ xcluflg = true; }
1001 break;
1002 case 10:
1003 	{ scinstal( nmstr, xcluflg ); }
1004 break;
1005 case 11:
1006 	{ scinstal( nmstr, xcluflg ); }
1007 break;
1008 case 12:
1009 	{ synerr( _("bad start condition list") ); }
1010 break;
1011 case 16:
1012 	{
1013 			outfilename = copy_string( nmstr );
1014 			did_outfilename = 1;
1015 			}
1016 break;
1017 case 17:
1018 	{ extra_type = copy_string( nmstr ); }
1019 break;
1020 case 18:
1021 	{ prefix = copy_string( nmstr ); }
1022 break;
1023 case 19:
1024 	{ yyclass = copy_string( nmstr ); }
1025 break;
1026 case 20:
1027 	{ headerfilename = copy_string( nmstr ); }
1028 break;
1029 case 21:
1030 	{ tablesext = true; tablesfilename = copy_string( nmstr ); }
1031 break;
1032 case 22:
1033 	{ scon_stk_ptr = yystack.l_mark[-3]; }
1034 break;
1035 case 23:
1036 	{ scon_stk_ptr = yystack.l_mark[-3]; }
1037 break;
1038 case 25:
1039 	{
1040 			/* Initialize for a parse of one rule. */
1041 			trlcontxt = variable_trail_rule = varlength = false;
1042 			trailcnt = headcnt = rulelen = 0;
1043 			current_state_type = STATE_NORMAL;
1044 			previous_continued_action = continued_action;
1045 			in_rule = true;
1046 
1047 			new_rule();
1048 			}
1049 break;
1050 case 26:
1051 	{
1052 			pat = yystack.l_mark[0];
1053 			finish_rule( pat, variable_trail_rule,
1054 				headcnt, trailcnt , previous_continued_action);
1055 
1056 			if ( scon_stk_ptr > 0 )
1057 				{
1058 				for ( i = 1; i <= scon_stk_ptr; ++i )
1059 					scbol[scon_stk[i]] =
1060 						mkbranch( scbol[scon_stk[i]],
1061 								pat );
1062 				}
1063 
1064 			else
1065 				{
1066 				/* Add to all non-exclusive start conditions,
1067 				 * including the default (0) start condition.
1068 				 */
1069 
1070 				for ( i = 1; i <= lastsc; ++i )
1071 					if ( ! scxclu[i] )
1072 						scbol[i] = mkbranch( scbol[i],
1073 									pat );
1074 				}
1075 
1076 			if ( ! bol_needed )
1077 				{
1078 				bol_needed = true;
1079 
1080 				if ( performance_report > 1 )
1081 					pinpoint_message(
1082 			"'^' operator results in sub-optimal performance" );
1083 				}
1084 			}
1085 break;
1086 case 27:
1087 	{
1088 			pat = yystack.l_mark[0];
1089 			finish_rule( pat, variable_trail_rule,
1090 				headcnt, trailcnt , previous_continued_action);
1091 
1092 			if ( scon_stk_ptr > 0 )
1093 				{
1094 				for ( i = 1; i <= scon_stk_ptr; ++i )
1095 					scset[scon_stk[i]] =
1096 						mkbranch( scset[scon_stk[i]],
1097 								pat );
1098 				}
1099 
1100 			else
1101 				{
1102 				for ( i = 1; i <= lastsc; ++i )
1103 					if ( ! scxclu[i] )
1104 						scset[i] =
1105 							mkbranch( scset[i],
1106 								pat );
1107 				}
1108 			}
1109 break;
1110 case 28:
1111 	{
1112 			if ( scon_stk_ptr > 0 )
1113 				build_eof_action();
1114 
1115 			else
1116 				{
1117 				/* This EOF applies to all start conditions
1118 				 * which don't already have EOF actions.
1119 				 */
1120 				for ( i = 1; i <= lastsc; ++i )
1121 					if ( ! sceof[i] )
1122 						scon_stk[++scon_stk_ptr] = i;
1123 
1124 				if ( scon_stk_ptr == 0 )
1125 					lwarn(
1126 			"all start conditions already have <<EOF>> rules" );
1127 
1128 				else
1129 					build_eof_action();
1130 				}
1131 			}
1132 break;
1133 case 29:
1134 	{ synerr( _("unrecognized rule") ); }
1135 break;
1136 case 30:
1137 	{ yyval = scon_stk_ptr; }
1138 break;
1139 case 31:
1140 	{ yyval = yystack.l_mark[-2]; }
1141 break;
1142 case 32:
1143 	{
1144 			yyval = scon_stk_ptr;
1145 
1146 			for ( i = 1; i <= lastsc; ++i )
1147 				{
1148 				int j;
1149 
1150 				for ( j = 1; j <= scon_stk_ptr; ++j )
1151 					if ( scon_stk[j] == i )
1152 						break;
1153 
1154 				if ( j > scon_stk_ptr )
1155 					scon_stk[++scon_stk_ptr] = i;
1156 				}
1157 			}
1158 break;
1159 case 33:
1160 	{ yyval = scon_stk_ptr; }
1161 break;
1162 case 36:
1163 	{ synerr( _("bad start condition list") ); }
1164 break;
1165 case 37:
1166 	{
1167 			if ( (scnum = sclookup( nmstr )) == 0 )
1168 				format_pinpoint_message(
1169 					"undeclared start condition %s",
1170 					nmstr );
1171 			else
1172 				{
1173 				for ( i = 1; i <= scon_stk_ptr; ++i )
1174 					if ( scon_stk[i] == scnum )
1175 						{
1176 						format_warn(
1177 							"<%s> specified twice",
1178 							scname[scnum] );
1179 						break;
1180 						}
1181 
1182 				if ( i > scon_stk_ptr )
1183 					scon_stk[++scon_stk_ptr] = scnum;
1184 				}
1185 			}
1186 break;
1187 case 38:
1188 	{
1189 			if ( transchar[lastst[yystack.l_mark[0]]] != SYM_EPSILON )
1190 				/* Provide final transition \now/ so it
1191 				 * will be marked as a trailing context
1192 				 * state.
1193 				 */
1194 				yystack.l_mark[0] = link_machines( yystack.l_mark[0],
1195 						mkstate( SYM_EPSILON ) );
1196 
1197 			mark_beginning_as_normal( yystack.l_mark[0] );
1198 			current_state_type = STATE_NORMAL;
1199 
1200 			if ( previous_continued_action )
1201 				{
1202 				/* We need to treat this as variable trailing
1203 				 * context so that the backup does not happen
1204 				 * in the action but before the action switch
1205 				 * statement.  If the backup happens in the
1206 				 * action, then the rules "falling into" this
1207 				 * one's action will *also* do the backup,
1208 				 * erroneously.
1209 				 */
1210 				if ( ! varlength || headcnt != 0 )
1211 					lwarn(
1212 		"trailing context made variable due to preceding '|' action" );
1213 
1214 				/* Mark as variable. */
1215 				varlength = true;
1216 				headcnt = 0;
1217 
1218 				}
1219 
1220 			if ( lex_compat || (varlength && headcnt == 0) )
1221 				{ /* variable trailing context rule */
1222 				/* Mark the first part of the rule as the
1223 				 * accepting "head" part of a trailing
1224 				 * context rule.
1225 				 *
1226 				 * By the way, we didn't do this at the
1227 				 * beginning of this production because back
1228 				 * then current_state_type was set up for a
1229 				 * trail rule, and add_accept() can create
1230 				 * a new state ...
1231 				 */
1232 				add_accept( yystack.l_mark[-1],
1233 					num_rules | YY_TRAILING_HEAD_MASK );
1234 				variable_trail_rule = true;
1235 				}
1236 
1237 			else
1238 				trailcnt = rulelen;
1239 
1240 			yyval = link_machines( yystack.l_mark[-1], yystack.l_mark[0] );
1241 			}
1242 break;
1243 case 39:
1244 	{ synerr( _("trailing context used twice") ); }
1245 break;
1246 case 40:
1247 	{
1248 			headcnt = 0;
1249 			trailcnt = 1;
1250 			rulelen = 1;
1251 			varlength = false;
1252 
1253 			current_state_type = STATE_TRAILING_CONTEXT;
1254 
1255 			if ( trlcontxt )
1256 				{
1257 				synerr( _("trailing context used twice") );
1258 				yyval = mkstate( SYM_EPSILON );
1259 				}
1260 
1261 			else if ( previous_continued_action )
1262 				{
1263 				/* See the comment in the rule for "re2 re"
1264 				 * above.
1265 				 */
1266 				lwarn(
1267 		"trailing context made variable due to preceding '|' action" );
1268 
1269 				varlength = true;
1270 				}
1271 
1272 			if ( lex_compat || varlength )
1273 				{
1274 				/* Again, see the comment in the rule for
1275 				 * "re2 re" above.
1276 				 */
1277 				add_accept( yystack.l_mark[-1],
1278 					num_rules | YY_TRAILING_HEAD_MASK );
1279 				variable_trail_rule = true;
1280 				}
1281 
1282 			trlcontxt = true;
1283 
1284 			eps = mkstate( SYM_EPSILON );
1285 			yyval = link_machines( yystack.l_mark[-1],
1286 				link_machines( eps, mkstate( '\n' ) ) );
1287 			}
1288 break;
1289 case 41:
1290 	{
1291 			yyval = yystack.l_mark[0];
1292 
1293 			if ( trlcontxt )
1294 				{
1295 				if ( lex_compat || (varlength && headcnt == 0) )
1296 					/* Both head and trail are
1297 					 * variable-length.
1298 					 */
1299 					variable_trail_rule = true;
1300 				else
1301 					trailcnt = rulelen;
1302 				}
1303 			}
1304 break;
1305 case 42:
1306 	{
1307 			varlength = true;
1308 			yyval = mkor( yystack.l_mark[-2], yystack.l_mark[0] );
1309 			}
1310 break;
1311 case 43:
1312 	{ yyval = yystack.l_mark[0]; }
1313 break;
1314 case 44:
1315 	{
1316 			/* This rule is written separately so the
1317 			 * reduction will occur before the trailing
1318 			 * series is parsed.
1319 			 */
1320 
1321 			if ( trlcontxt )
1322 				synerr( _("trailing context used twice") );
1323 			else
1324 				trlcontxt = true;
1325 
1326 			if ( varlength )
1327 				/* We hope the trailing context is
1328 				 * fixed-length.
1329 				 */
1330 				varlength = false;
1331 			else
1332 				headcnt = rulelen;
1333 
1334 			rulelen = 0;
1335 
1336 			current_state_type = STATE_TRAILING_CONTEXT;
1337 			yyval = yystack.l_mark[-1];
1338 			}
1339 break;
1340 case 45:
1341 	{
1342 			/* This is where concatenation of adjacent patterns
1343 			 * gets done.
1344 			 */
1345 			yyval = link_machines( yystack.l_mark[-1], yystack.l_mark[0] );
1346 			}
1347 break;
1348 case 46:
1349 	{ yyval = yystack.l_mark[0]; }
1350 break;
1351 case 47:
1352 	{
1353 			varlength = true;
1354 
1355 			if ( yystack.l_mark[-3] > yystack.l_mark[-1] || yystack.l_mark[-3] < 0 )
1356 				{
1357 				synerr( _("bad iteration values") );
1358 				yyval = yystack.l_mark[-5];
1359 				}
1360 			else
1361 				{
1362 				if ( yystack.l_mark[-3] == 0 )
1363 					{
1364 					if ( yystack.l_mark[-1] <= 0 )
1365 						{
1366 						synerr(
1367 						_("bad iteration values") );
1368 						yyval = yystack.l_mark[-5];
1369 						}
1370 					else
1371 						yyval = mkopt(
1372 							mkrep( yystack.l_mark[-5], 1, yystack.l_mark[-1] ) );
1373 					}
1374 				else
1375 					yyval = mkrep( yystack.l_mark[-5], yystack.l_mark[-3], yystack.l_mark[-1] );
1376 				}
1377 			}
1378 break;
1379 case 48:
1380 	{
1381 			varlength = true;
1382 
1383 			if ( yystack.l_mark[-2] <= 0 )
1384 				{
1385 				synerr( _("iteration value must be positive") );
1386 				yyval = yystack.l_mark[-4];
1387 				}
1388 
1389 			else
1390 				yyval = mkrep( yystack.l_mark[-4], yystack.l_mark[-2], INFINITE_REPEAT );
1391 			}
1392 break;
1393 case 49:
1394 	{
1395 			/* The series could be something like "(foo)",
1396 			 * in which case we have no idea what its length
1397 			 * is, so we punt here.
1398 			 */
1399 			varlength = true;
1400 
1401 			if ( yystack.l_mark[-1] <= 0 )
1402 				{
1403 				  synerr( _("iteration value must be positive")
1404 					  );
1405 				yyval = yystack.l_mark[-3];
1406 				}
1407 
1408 			else
1409 				yyval = link_machines( yystack.l_mark[-3],
1410 						copysingl( yystack.l_mark[-3], yystack.l_mark[-1] - 1 ) );
1411 			}
1412 break;
1413 case 50:
1414 	{
1415 			varlength = true;
1416 
1417 			yyval = mkclos( yystack.l_mark[-1] );
1418 			}
1419 break;
1420 case 51:
1421 	{
1422 			varlength = true;
1423 			yyval = mkposcl( yystack.l_mark[-1] );
1424 			}
1425 break;
1426 case 52:
1427 	{
1428 			varlength = true;
1429 			yyval = mkopt( yystack.l_mark[-1] );
1430 			}
1431 break;
1432 case 53:
1433 	{
1434 			varlength = true;
1435 
1436 			if ( yystack.l_mark[-3] > yystack.l_mark[-1] || yystack.l_mark[-3] < 0 )
1437 				{
1438 				synerr( _("bad iteration values") );
1439 				yyval = yystack.l_mark[-5];
1440 				}
1441 			else
1442 				{
1443 				if ( yystack.l_mark[-3] == 0 )
1444 					{
1445 					if ( yystack.l_mark[-1] <= 0 )
1446 						{
1447 						synerr(
1448 						_("bad iteration values") );
1449 						yyval = yystack.l_mark[-5];
1450 						}
1451 					else
1452 						yyval = mkopt(
1453 							mkrep( yystack.l_mark[-5], 1, yystack.l_mark[-1] ) );
1454 					}
1455 				else
1456 					yyval = mkrep( yystack.l_mark[-5], yystack.l_mark[-3], yystack.l_mark[-1] );
1457 				}
1458 			}
1459 break;
1460 case 54:
1461 	{
1462 			varlength = true;
1463 
1464 			if ( yystack.l_mark[-2] <= 0 )
1465 				{
1466 				synerr( _("iteration value must be positive") );
1467 				yyval = yystack.l_mark[-4];
1468 				}
1469 
1470 			else
1471 				yyval = mkrep( yystack.l_mark[-4], yystack.l_mark[-2], INFINITE_REPEAT );
1472 			}
1473 break;
1474 case 55:
1475 	{
1476 			/* The singleton could be something like "(foo)",
1477 			 * in which case we have no idea what its length
1478 			 * is, so we punt here.
1479 			 */
1480 			varlength = true;
1481 
1482 			if ( yystack.l_mark[-1] <= 0 )
1483 				{
1484 				synerr( _("iteration value must be positive") );
1485 				yyval = yystack.l_mark[-3];
1486 				}
1487 
1488 			else
1489 				yyval = link_machines( yystack.l_mark[-3],
1490 						copysingl( yystack.l_mark[-3], yystack.l_mark[-1] - 1 ) );
1491 			}
1492 break;
1493 case 56:
1494 	{
1495 			if ( ! madeany )
1496 				{
1497 				/* Create the '.' character class. */
1498                     ccldot = cclinit();
1499                     ccladd( ccldot, '\n' );
1500                     cclnegate( ccldot );
1501 
1502                     if ( useecs )
1503                         mkeccl( ccltbl + cclmap[ccldot],
1504                             ccllen[ccldot], nextecm,
1505                             ecgroup, csize, csize );
1506 
1507 				/* Create the (?s:'.') character class. */
1508                     cclany = cclinit();
1509                     cclnegate( cclany );
1510 
1511                     if ( useecs )
1512                         mkeccl( ccltbl + cclmap[cclany],
1513                             ccllen[cclany], nextecm,
1514                             ecgroup, csize, csize );
1515 
1516 				madeany = true;
1517 				}
1518 
1519 			++rulelen;
1520 
1521             if (sf_dot_all())
1522                 yyval = mkstate( -cclany );
1523             else
1524                 yyval = mkstate( -ccldot );
1525 			}
1526 break;
1527 case 57:
1528 	{
1529 				/* Sort characters for fast searching.
1530 				 */
1531 				qsort( ccltbl + cclmap[yystack.l_mark[0]], ccllen[yystack.l_mark[0]], sizeof (*ccltbl), cclcmp );
1532 
1533 			if ( useecs )
1534 				mkeccl( ccltbl + cclmap[yystack.l_mark[0]], ccllen[yystack.l_mark[0]],
1535 					nextecm, ecgroup, csize, csize );
1536 
1537 			++rulelen;
1538 
1539 			if (ccl_has_nl[yystack.l_mark[0]])
1540 				rule_has_nl[num_rules] = true;
1541 
1542 			yyval = mkstate( -yystack.l_mark[0] );
1543 			}
1544 break;
1545 case 58:
1546 	{
1547 			++rulelen;
1548 
1549 			if (ccl_has_nl[yystack.l_mark[0]])
1550 				rule_has_nl[num_rules] = true;
1551 
1552 			yyval = mkstate( -yystack.l_mark[0] );
1553 			}
1554 break;
1555 case 59:
1556 	{ yyval = yystack.l_mark[-1]; }
1557 break;
1558 case 60:
1559 	{ yyval = yystack.l_mark[-1]; }
1560 break;
1561 case 61:
1562 	{
1563 			++rulelen;
1564 
1565 			if (yystack.l_mark[0] == nlch)
1566 				rule_has_nl[num_rules] = true;
1567 
1568             if (sf_case_ins() && has_case(yystack.l_mark[0]))
1569                 /* create an alternation, as in (a|A) */
1570                 yyval = mkor (mkstate(yystack.l_mark[0]), mkstate(reverse_case(yystack.l_mark[0])));
1571             else
1572                 yyval = mkstate( yystack.l_mark[0] );
1573 			}
1574 break;
1575 case 62:
1576 	{ yyval = ccl_set_diff  (yystack.l_mark[-2], yystack.l_mark[0]); }
1577 break;
1578 case 63:
1579 	{ yyval = ccl_set_union (yystack.l_mark[-2], yystack.l_mark[0]); }
1580 break;
1581 case 65:
1582 	{ yyval = yystack.l_mark[-1]; }
1583 break;
1584 case 66:
1585 	{
1586 			cclnegate( yystack.l_mark[-1] );
1587 			yyval = yystack.l_mark[-1];
1588 			}
1589 break;
1590 case 67:
1591 	{
1592 
1593 			if (sf_case_ins())
1594 			  {
1595 
1596 			    /* If one end of the range has case and the other
1597 			     * does not, or the cases are different, then we're not
1598 			     * sure what range the user is trying to express.
1599 			     * Examples: [@-z] or [S-t]
1600 			     */
1601 			    if (has_case (yystack.l_mark[-2]) != has_case (yystack.l_mark[0])
1602 				     || (has_case (yystack.l_mark[-2]) && (b_islower (yystack.l_mark[-2]) != b_islower (yystack.l_mark[0])))
1603 				     || (has_case (yystack.l_mark[-2]) && (b_isupper (yystack.l_mark[-2]) != b_isupper (yystack.l_mark[0]))))
1604 			      format_warn3 (
1605 			      _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1606 					    yystack.l_mark[-2], yystack.l_mark[0]);
1607 
1608 			    /* If the range spans uppercase characters but not
1609 			     * lowercase (or vice-versa), then should we automatically
1610 			     * include lowercase characters in the range?
1611 			     * Example: [@-_] spans [a-z] but not [A-Z]
1612 			     */
1613 			    else if (!has_case (yystack.l_mark[-2]) && !has_case (yystack.l_mark[0]) && !range_covers_case (yystack.l_mark[-2], yystack.l_mark[0]))
1614 			      format_warn3 (
1615 			      _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1616 					    yystack.l_mark[-2], yystack.l_mark[0]);
1617 			  }
1618 
1619 			if ( yystack.l_mark[-2] > yystack.l_mark[0] )
1620 				synerr( _("negative range in character class") );
1621 
1622 			else
1623 				{
1624 				for ( i = yystack.l_mark[-2]; i <= yystack.l_mark[0]; ++i )
1625 					ccladd( yystack.l_mark[-3], i );
1626 
1627 				/* Keep track if this ccl is staying in
1628 				 * alphabetical order.
1629 				 */
1630 				cclsorted = cclsorted && (yystack.l_mark[-2] > lastchar);
1631 				lastchar = yystack.l_mark[0];
1632 
1633                 /* Do it again for upper/lowercase */
1634                 if (sf_case_ins() && has_case(yystack.l_mark[-2]) && has_case(yystack.l_mark[0])){
1635                     yystack.l_mark[-2] = reverse_case (yystack.l_mark[-2]);
1636                     yystack.l_mark[0] = reverse_case (yystack.l_mark[0]);
1637 
1638                     for ( i = yystack.l_mark[-2]; i <= yystack.l_mark[0]; ++i )
1639                         ccladd( yystack.l_mark[-3], i );
1640 
1641                     cclsorted = cclsorted && (yystack.l_mark[-2] > lastchar);
1642                     lastchar = yystack.l_mark[0];
1643                 }
1644 
1645 				}
1646 
1647 			yyval = yystack.l_mark[-3];
1648 			}
1649 break;
1650 case 68:
1651 	{
1652 			ccladd( yystack.l_mark[-1], yystack.l_mark[0] );
1653 			cclsorted = cclsorted && (yystack.l_mark[0] > lastchar);
1654 			lastchar = yystack.l_mark[0];
1655 
1656             /* Do it again for upper/lowercase */
1657             if (sf_case_ins() && has_case(yystack.l_mark[0])){
1658                 yystack.l_mark[0] = reverse_case (yystack.l_mark[0]);
1659                 ccladd (yystack.l_mark[-1], yystack.l_mark[0]);
1660 
1661                 cclsorted = cclsorted && (yystack.l_mark[0] > lastchar);
1662                 lastchar = yystack.l_mark[0];
1663             }
1664 
1665 			yyval = yystack.l_mark[-1];
1666 			}
1667 break;
1668 case 69:
1669 	{
1670 			/* Too hard to properly maintain cclsorted. */
1671 			cclsorted = false;
1672 			yyval = yystack.l_mark[-1];
1673 			}
1674 break;
1675 case 70:
1676 	{
1677 			cclsorted = true;
1678 			lastchar = 0;
1679 			currccl = yyval = cclinit();
1680 			}
1681 break;
1682 case 71:
1683 	{ CCL_EXPR(isalnum); }
1684 break;
1685 case 72:
1686 	{ CCL_EXPR(isalpha); }
1687 break;
1688 case 73:
1689 	{ CCL_EXPR(IS_BLANK); }
1690 break;
1691 case 74:
1692 	{ CCL_EXPR(iscntrl); }
1693 break;
1694 case 75:
1695 	{ CCL_EXPR(isdigit); }
1696 break;
1697 case 76:
1698 	{ CCL_EXPR(isgraph); }
1699 break;
1700 case 77:
1701 	{
1702                           CCL_EXPR(islower);
1703                           if (sf_case_ins())
1704                               CCL_EXPR(isupper);
1705                         }
1706 break;
1707 case 78:
1708 	{ CCL_EXPR(isprint); }
1709 break;
1710 case 79:
1711 	{ CCL_EXPR(ispunct); }
1712 break;
1713 case 80:
1714 	{ CCL_EXPR(isspace); }
1715 break;
1716 case 81:
1717 	{ CCL_EXPR(isxdigit); }
1718 break;
1719 case 82:
1720 	{
1721                     CCL_EXPR(isupper);
1722                     if (sf_case_ins())
1723                         CCL_EXPR(islower);
1724 				}
1725 break;
1726 case 83:
1727 	{ CCL_NEG_EXPR(isalnum); }
1728 break;
1729 case 84:
1730 	{ CCL_NEG_EXPR(isalpha); }
1731 break;
1732 case 85:
1733 	{ CCL_NEG_EXPR(IS_BLANK); }
1734 break;
1735 case 86:
1736 	{ CCL_NEG_EXPR(iscntrl); }
1737 break;
1738 case 87:
1739 	{ CCL_NEG_EXPR(isdigit); }
1740 break;
1741 case 88:
1742 	{ CCL_NEG_EXPR(isgraph); }
1743 break;
1744 case 89:
1745 	{ CCL_NEG_EXPR(isprint); }
1746 break;
1747 case 90:
1748 	{ CCL_NEG_EXPR(ispunct); }
1749 break;
1750 case 91:
1751 	{ CCL_NEG_EXPR(isspace); }
1752 break;
1753 case 92:
1754 	{ CCL_NEG_EXPR(isxdigit); }
1755 break;
1756 case 93:
1757 	{
1758 				if ( sf_case_ins() )
1759 					lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
1760 				else
1761 					CCL_NEG_EXPR(islower);
1762 				}
1763 break;
1764 case 94:
1765 	{
1766 				if ( sf_case_ins() )
1767 					lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
1768 				else
1769 					CCL_NEG_EXPR(isupper);
1770 				}
1771 break;
1772 case 95:
1773 	{
1774 			if ( yystack.l_mark[0] == nlch )
1775 				rule_has_nl[num_rules] = true;
1776 
1777 			++rulelen;
1778 
1779             if (sf_case_ins() && has_case(yystack.l_mark[0]))
1780                 yyval = mkor (mkstate(yystack.l_mark[0]), mkstate(reverse_case(yystack.l_mark[0])));
1781             else
1782                 yyval = mkstate (yystack.l_mark[0]);
1783 
1784 			yyval = link_machines( yystack.l_mark[-1], yyval);
1785 			}
1786 break;
1787 case 96:
1788 	{ yyval = mkstate( SYM_EPSILON ); }
1789 break;
1790     }
1791     yystack.s_mark -= yym;
1792     yystate = *yystack.s_mark;
1793     yystack.l_mark -= yym;
1794     yym = yylhs[yyn];
1795     if (yystate == 0 && yym == 0)
1796     {
1797 #if YYDEBUG
1798         if (yydebug)
1799             printf("%sdebug: after reduction, shifting from state 0 to\
1800  state %d\n", YYPREFIX, YYFINAL);
1801 #endif
1802         yystate = YYFINAL;
1803         *++yystack.s_mark = YYFINAL;
1804         *++yystack.l_mark = yyval;
1805         if (yychar < 0)
1806         {
1807             if ((yychar = YYLEX) < 0) yychar = YYEOF;
1808 #if YYDEBUG
1809             if (yydebug)
1810             {
1811                 yys = yyname[YYTRANSLATE(yychar)];
1812                 printf("%sdebug: state %d, reading %d (%s)\n",
1813                         YYPREFIX, YYFINAL, yychar, yys);
1814             }
1815 #endif
1816         }
1817         if (yychar == YYEOF) goto yyaccept;
1818         goto yyloop;
1819     }
1820     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1821             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1822         yystate = yytable[yyn];
1823     else
1824         yystate = yydgoto[yym];
1825 #if YYDEBUG
1826     if (yydebug)
1827         printf("%sdebug: after reduction, shifting from state %d \
1828 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1829 #endif
1830     if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
1831     {
1832         goto yyoverflow;
1833     }
1834     *++yystack.s_mark = (YYINT) yystate;
1835     *++yystack.l_mark = yyval;
1836     goto yyloop;
1837 
1838 yyoverflow:
1839     YYERROR_CALL("yacc stack overflow");
1840 
1841 yyabort:
1842     yyfreestack(&yystack);
1843     return (1);
1844 
1845 yyaccept:
1846     yyfreestack(&yystack);
1847     return (0);
1848 }
1849