1 /* original parser id follows */
2 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
3 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
8 #define YYPATCH 20200330
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
21 /* Copyright (c) 1990 The Regents of the University of California. */
22 /* All rights reserved. */
24 /* This code is derived from software contributed to Berkeley by */
27 /* The United States Government has rights in this work pursuant */
28 /* to contract no. DE-AC03-76SF00098 between the United States */
29 /* Department of Energy and the University of California. */
31 /* This file is part of flex. */
33 /* Redistribution and use in source and binary forms, with or without */
34 /* modification, are permitted provided that the following conditions */
37 /* 1. Redistributions of source code must retain the above copyright */
38 /* notice, this list of conditions and the following disclaimer. */
39 /* 2. Redistributions in binary form must reproduce the above copyright */
40 /* notice, this list of conditions and the following disclaimer in the */
41 /* documentation and/or other materials provided with the distribution. */
43 /* Neither the name of the University nor the names of its contributors */
44 /* may be used to endorse or promote products derived from this software */
45 /* without specific prior written permission. */
47 /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
48 /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
49 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
55 int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen;
56 int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule;
61 static int madeany = false; /* whether we've made the '.' character class */
62 static int ccldot, cclany;
63 int previous_continued_action; /* whether the previous rule's action was '|' */
65 #define format_warn3(fmt, a1, a2) \
67 char fw3_msg[MAXLINE];\
68 snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
72 /* Expand a POSIX character class expression. */
73 #define CCL_EXPR(func) \
76 for ( c = 0; c < csize; ++c ) \
77 if ( isascii(c) && func(c) ) \
78 ccladd( currccl, c ); \
82 #define CCL_NEG_EXPR(func) \
85 for ( c = 0; c < csize; ++c ) \
87 ccladd( currccl, c ); \
90 /* While POSIX defines isblank(), it's not ANSI C. */
91 #define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
93 /* On some over-ambitious machines, such as DEC Alpha's, the default
94 * token type is "long" instead of "int"; this leads to problems with
95 * declaring yylval in flexdef.h. But so far, all the yacc's I've seen
96 * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
97 * following should ensure that the default token type is "int".
103 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
104 /* Default: YYSTYPE is the semantic value type. */
106 # define YYSTYPE_IS_DECLARED 1
109 /* compatibility with bison */
111 /* compatibility with FreeBSD */
112 # ifdef YYPARSE_PARAM_TYPE
113 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
115 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
118 # define YYPARSE_DECL() yyparse(void)
121 /* Parameters sent to lex. */
123 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
124 # define YYLEX yylex(YYLEX_PARAM)
126 # define YYLEX_DECL() yylex(void)
127 # define YYLEX yylex()
130 #if !(defined(yylex) || defined(YYSTATE))
134 /* Parameters sent to yyerror. */
136 #define YYERROR_DECL() yyerror(const char *s)
139 #define YYERROR_CALL(msg) yyerror(msg)
142 extern int YYPARSE_DECL();
152 #define TOK_OPTION 265
153 #define TOK_OUTFILE 266
154 #define TOK_PREFIX 267
155 #define TOK_YYCLASS 268
156 #define TOK_HEADER_FILE 269
157 #define TOK_EXTRA_TYPE 270
158 #define TOK_TABLES_FILE 271
159 #define CCE_ALNUM 272
160 #define CCE_ALPHA 273
161 #define CCE_BLANK 274
162 #define CCE_CNTRL 275
163 #define CCE_DIGIT 276
164 #define CCE_GRAPH 277
165 #define CCE_LOWER 278
166 #define CCE_PRINT 279
167 #define CCE_PUNCT 280
168 #define CCE_SPACE 281
169 #define CCE_UPPER 282
170 #define CCE_XDIGIT 283
171 #define CCE_NEG_ALNUM 284
172 #define CCE_NEG_ALPHA 285
173 #define CCE_NEG_BLANK 286
174 #define CCE_NEG_CNTRL 287
175 #define CCE_NEG_DIGIT 288
176 #define CCE_NEG_GRAPH 289
177 #define CCE_NEG_LOWER 290
178 #define CCE_NEG_PRINT 291
179 #define CCE_NEG_PUNCT 292
180 #define CCE_NEG_SPACE 293
181 #define CCE_NEG_UPPER 294
182 #define CCE_NEG_XDIGIT 295
183 #define CCL_OP_DIFF 296
184 #define CCL_OP_UNION 297
185 #define BEGIN_REPEAT_POSIX 298
186 #define END_REPEAT_POSIX 299
187 #define BEGIN_REPEAT_FLEX 300
188 #define END_REPEAT_FLEX 301
189 #define YYERRCODE 256
191 static const YYINT yylhs[] = { -1,
192 0, 1, 2, 2, 2, 2, 3, 6, 6, 7,
193 7, 7, 8, 9, 9, 10, 10, 10, 10, 10,
194 10, 4, 4, 4, 5, 12, 12, 12, 12, 14,
195 11, 11, 11, 15, 15, 15, 16, 13, 13, 13,
196 13, 18, 18, 17, 19, 19, 19, 19, 19, 20,
197 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
198 20, 21, 21, 21, 23, 23, 24, 24, 24, 24,
199 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
200 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
201 25, 25, 25, 25, 22, 22,
203 static const YYINT yylen[] = { 2,
204 5, 0, 3, 2, 0, 1, 1, 1, 1, 2,
205 1, 1, 2, 2, 0, 3, 3, 3, 3, 3,
206 3, 5, 5, 0, 0, 2, 1, 1, 1, 0,
207 4, 3, 0, 3, 1, 1, 1, 2, 3, 2,
208 1, 3, 1, 2, 2, 1, 6, 5, 4, 2,
209 2, 2, 6, 5, 4, 1, 1, 1, 3, 3,
210 1, 3, 3, 1, 3, 4, 4, 2, 2, 0,
211 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
212 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
215 static const YYINT yydefred[] = { 2,
216 0, 0, 6, 0, 7, 8, 9, 15, 24, 0,
217 4, 0, 0, 12, 11, 0, 0, 0, 0, 0,
218 0, 0, 14, 0, 1, 0, 10, 0, 0, 0,
219 0, 0, 0, 0, 0, 24, 0, 16, 18, 19,
220 20, 17, 21, 32, 36, 37, 0, 35, 0, 29,
221 61, 58, 28, 0, 56, 96, 0, 0, 0, 27,
222 0, 0, 0, 0, 0, 64, 31, 0, 23, 26,
223 0, 0, 70, 0, 22, 0, 40, 0, 44, 0,
224 0, 0, 50, 51, 52, 0, 0, 34, 95, 59,
225 60, 0, 0, 71, 72, 73, 74, 75, 76, 77,
226 78, 79, 80, 82, 81, 83, 84, 85, 86, 87,
227 88, 93, 89, 90, 91, 94, 92, 65, 69, 39,
228 0, 0, 0, 62, 63, 66, 0, 49, 0, 55,
229 0, 67, 0, 48, 0, 54, 47, 53,
231 static const YYINT yydgoto[] = { 1,
232 2, 4, 9, 13, 25, 10, 16, 11, 12, 23,
233 26, 59, 60, 35, 47, 48, 61, 62, 63, 64,
236 static const YYINT yysindex[] = { 0,
237 0, -222, 0, -155, 0, 0, 0, 0, 0, -215,
238 0, -123, 6, 0, 0, -193, 10, 21, 26, 31,
239 35, 37, 0, 59, 0, -44, 0, -147, -145, -140,
240 -133, -132, -129, 75, -214, 0, -19, 0, 0, 0,
241 0, 0, 0, 0, 0, 0, 23, 0, -48, 0,
242 0, 0, 0, -17, 0, 0, -17, 27, 128, 0,
243 -17, -1, -30, -41, -189, 0, 0, -121, 0, 0,
244 -31, -34, 0, -87, 0, -25, 0, -17, 0, -109,
245 -41, -108, 0, 0, 0, 60, 60, 0, 0, 0,
246 0, 46, 107, 0, 0, 0, 0, 0, 0, 0,
247 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
249 -30, -36, -39, 0, 0, 0, -104, 0, -219, 0,
250 -238, 0, -144, 0, -143, 0, 0, 0,
252 static const YYINT yyrindex[] = { 0,
253 0, -141, 0, 0, 0, 0, 0, 0, 0, 0,
254 0, -134, 9, 0, 0, -125, 0, 0, 0, 0,
255 0, 0, 0, -178, 0, 22, 0, 0, 0, 0,
256 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
257 0, 0, 0, 0, 0, 0, 0, 0, -21, 0,
258 0, 0, 0, 0, 0, 0, 0, 85, 0, 0,
259 0, 144, 47, 4, -10, 0, 0, 0, 0, 0,
260 0, 0, 0, 0, 0, 146, 0, 0, 0, 0,
261 18, 0, 0, 0, 0, 0, 0, 0, 0, 0,
262 0, 0, 124, 0, 0, 0, 0, 0, 0, 0,
263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
265 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266 0, 0, 0, 0, 0, 0, 0, 0,
268 static const YYINT yygindex[] = { 0,
269 0, 0, 0, 121, 133, 0, 0, 0, 0, 0,
270 0, 0, 106, 0, 0, 93, 0, 32, 84, -45,
273 #define YYTABLESIZE 419
274 static const YYINT yytable[] = { 57,
275 83, 84, 90, 56, 131, 118, 91, 129, 25, 57,
276 120, 24, 33, 46, 56, 55, 56, 81, 33, 135,
277 57, 85, 57, 57, 33, 57, 55, 45, 55, 57,
278 57, 57, 57, 3, 77, 57, 57, 46, 133, 46,
279 14, 45, 33, 46, 46, 79, 15, 46, 33, 46,
280 46, 45, 57, 45, 33, 25, 43, 45, 45, 42,
281 58, 25, 136, 45, 45, 24, 68, 25, 27, 33,
282 28, 58, 33, 58, 54, 81, 69, 30, 36, 134,
283 57, 29, 43, 30, 67, 42, 30, 43, 72, 78,
284 42, 31, 76, 43, 46, 32, 42, 33, 78, 33,
285 34, 33, 33, 5, 6, 7, 86, 87, 45, 8,
286 124, 125, 25, 57, 38, 25, 39, 5, 5, 5,
287 73, 40, 78, 5, 13, 13, 13, 46, 41, 42,
288 13, 33, 43, 3, 3, 3, 44, 75, 126, 3,
289 46, 45, 17, 18, 19, 20, 21, 22, 122, 123,
290 58, 127, 132, 41, 137, 38, 49, 138, 37, 70,
291 88, 121, 92, 0, 0, 0, 0, 0, 0, 93,
292 43, 0, 0, 42, 0, 0, 0, 70, 0, 0,
293 0, 0, 0, 0, 94, 95, 96, 97, 98, 99,
294 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
295 110, 111, 112, 113, 114, 115, 116, 117, 0, 0,
296 0, 0, 0, 0, 0, 0, 68, 0, 0, 0,
297 0, 0, 0, 0, 0, 89, 51, 0, 0, 0,
298 0, 0, 52, 0, 33, 33, 50, 51, 0, 51,
299 0, 33, 33, 52, 53, 52, 57, 0, 0, 0,
300 0, 0, 57, 0, 0, 0, 0, 0, 82, 0,
301 46, 130, 128, 0, 33, 33, 46, 80, 0, 0,
302 0, 33, 33, 0, 45, 0, 0, 25, 25, 0,
303 45, 0, 0, 0, 25, 25, 0, 57, 0, 57,
304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
305 0, 46, 93, 0, 0, 0, 0, 0, 0, 0,
306 0, 0, 0, 0, 0, 45, 0, 94, 95, 96,
307 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
308 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
309 117, 70, 0, 0, 0, 0, 0, 0, 0, 0,
310 0, 0, 0, 0, 0, 0, 70, 70, 70, 70,
311 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
312 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
313 68, 0, 0, 0, 0, 0, 0, 0, 0, 0,
314 0, 0, 0, 0, 0, 68, 68, 68, 68, 68,
315 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
316 68, 68, 68, 68, 68, 68, 68, 68, 68,
318 static const YYINT yycheck[] = { 10,
319 42, 43, 34, 34, 44, 93, 41, 44, 0, 40,
320 36, 60, 34, 10, 34, 46, 34, 63, 40, 258,
321 40, 63, 40, 34, 46, 36, 46, 10, 46, 40,
322 41, 42, 43, 256, 36, 46, 47, 34, 258, 36,
323 256, 256, 34, 40, 41, 47, 262, 262, 40, 46,
324 47, 34, 63, 36, 46, 34, 10, 40, 41, 10,
325 91, 40, 301, 46, 47, 60, 44, 46, 262, 91,
326 61, 91, 94, 91, 94, 121, 125, 256, 123, 299,
327 91, 61, 36, 262, 62, 36, 61, 41, 57, 124,
328 41, 61, 61, 47, 91, 61, 47, 61, 124, 91,
329 42, 123, 94, 259, 260, 261, 296, 297, 91, 265,
330 86, 87, 91, 124, 262, 94, 262, 259, 260, 261,
331 94, 262, 124, 265, 259, 260, 261, 124, 262, 262,
332 265, 123, 262, 259, 260, 261, 62, 10, 93, 265,
333 262, 124, 266, 267, 268, 269, 270, 271, 258, 258,
334 91, 45, 257, 10, 299, 10, 36, 301, 26, 54,
335 68, 78, 73, -1, -1, -1, -1, -1, -1, 257,
336 124, -1, -1, 124, -1, -1, -1, 93, -1, -1,
337 -1, -1, -1, -1, 272, 273, 274, 275, 276, 277,
338 278, 279, 280, 281, 282, 283, 284, 285, 286, 287,
339 288, 289, 290, 291, 292, 293, 294, 295, -1, -1,
340 -1, -1, -1, -1, -1, -1, 93, -1, -1, -1,
341 -1, -1, -1, -1, -1, 257, 257, -1, -1, -1,
342 -1, -1, 263, -1, 256, 257, 256, 257, -1, 257,
343 -1, 263, 264, 263, 264, 263, 257, -1, -1, -1,
344 -1, -1, 263, -1, -1, -1, -1, -1, 300, -1,
345 257, 301, 299, -1, 256, 257, 263, 298, -1, -1,
346 -1, 263, 264, -1, 257, -1, -1, 256, 257, -1,
347 263, -1, -1, -1, 263, 264, -1, 298, -1, 300,
348 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
349 -1, 298, 257, -1, -1, -1, -1, -1, -1, -1,
350 -1, -1, -1, -1, -1, 298, -1, 272, 273, 274,
351 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
352 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
353 295, 257, -1, -1, -1, -1, -1, -1, -1, -1,
354 -1, -1, -1, -1, -1, -1, 272, 273, 274, 275,
355 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
356 286, 287, 288, 289, 290, 291, 292, 293, 294, 295,
357 257, -1, -1, -1, -1, -1, -1, -1, -1, -1,
358 -1, -1, -1, -1, -1, 272, 273, 274, 275, 276,
359 277, 278, 279, 280, 281, 282, 283, 284, 285, 286,
360 287, 288, 289, 290, 291, 292, 293, 294, 295,
366 #define YYMAXTOKEN 301
367 #define YYUNDFTOKEN 329
368 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
370 static const char *const yyname[] = {
372 "end-of-file",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,
373 0,0,0,"'\"'",0,"'$'",0,0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,
374 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,
375 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,
376 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,
377 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,
378 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,
379 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,"CHAR","NUMBER","SECTEND",
380 "SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","TOK_OPTION","TOK_OUTFILE",
381 "TOK_PREFIX","TOK_YYCLASS","TOK_HEADER_FILE","TOK_EXTRA_TYPE","TOK_TABLES_FILE",
382 "CCE_ALNUM","CCE_ALPHA","CCE_BLANK","CCE_CNTRL","CCE_DIGIT","CCE_GRAPH",
383 "CCE_LOWER","CCE_PRINT","CCE_PUNCT","CCE_SPACE","CCE_UPPER","CCE_XDIGIT",
384 "CCE_NEG_ALNUM","CCE_NEG_ALPHA","CCE_NEG_BLANK","CCE_NEG_CNTRL","CCE_NEG_DIGIT",
385 "CCE_NEG_GRAPH","CCE_NEG_LOWER","CCE_NEG_PRINT","CCE_NEG_PUNCT","CCE_NEG_SPACE",
386 "CCE_NEG_UPPER","CCE_NEG_XDIGIT","CCL_OP_DIFF","CCL_OP_UNION",
387 "BEGIN_REPEAT_POSIX","END_REPEAT_POSIX","BEGIN_REPEAT_FLEX","END_REPEAT_FLEX",0,
388 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,"illegal-symbol",
390 static const char *const yyrule[] = {
392 "goal : initlex sect1 sect1end sect2 initforrule",
394 "sect1 : sect1 startconddecl namelist1",
395 "sect1 : sect1 options",
398 "sect1end : SECTEND",
399 "startconddecl : SCDECL",
400 "startconddecl : XSCDECL",
401 "namelist1 : namelist1 NAME",
404 "options : TOK_OPTION optionlist",
405 "optionlist : optionlist option",
407 "option : TOK_OUTFILE '=' NAME",
408 "option : TOK_EXTRA_TYPE '=' NAME",
409 "option : TOK_PREFIX '=' NAME",
410 "option : TOK_YYCLASS '=' NAME",
411 "option : TOK_HEADER_FILE '=' NAME",
412 "option : TOK_TABLES_FILE '=' NAME",
413 "sect2 : sect2 scon initforrule flexrule '\\n'",
414 "sect2 : sect2 scon '{' sect2 '}'",
417 "flexrule : '^' rule",
422 "scon : '<' scon_stk_ptr namelist2 '>'",
423 "scon : '<' '*' '>'",
425 "namelist2 : namelist2 ',' sconname",
426 "namelist2 : sconname",
433 "re : re '|' series",
436 "series : series singleton",
437 "series : singleton",
438 "series : series BEGIN_REPEAT_POSIX NUMBER ',' NUMBER END_REPEAT_POSIX",
439 "series : series BEGIN_REPEAT_POSIX NUMBER ',' END_REPEAT_POSIX",
440 "series : series BEGIN_REPEAT_POSIX NUMBER END_REPEAT_POSIX",
441 "singleton : singleton '*'",
442 "singleton : singleton '+'",
443 "singleton : singleton '?'",
444 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' NUMBER END_REPEAT_FLEX",
445 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' END_REPEAT_FLEX",
446 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER END_REPEAT_FLEX",
448 "singleton : fullccl",
449 "singleton : PREVCCL",
450 "singleton : '\"' string '\"'",
451 "singleton : '(' re ')'",
453 "fullccl : fullccl CCL_OP_DIFF braceccl",
454 "fullccl : fullccl CCL_OP_UNION braceccl",
455 "fullccl : braceccl",
456 "braceccl : '[' ccl ']'",
457 "braceccl : '[' '^' ccl ']'",
458 "ccl : ccl CHAR '-' CHAR",
460 "ccl : ccl ccl_expr",
462 "ccl_expr : CCE_ALNUM",
463 "ccl_expr : CCE_ALPHA",
464 "ccl_expr : CCE_BLANK",
465 "ccl_expr : CCE_CNTRL",
466 "ccl_expr : CCE_DIGIT",
467 "ccl_expr : CCE_GRAPH",
468 "ccl_expr : CCE_LOWER",
469 "ccl_expr : CCE_PRINT",
470 "ccl_expr : CCE_PUNCT",
471 "ccl_expr : CCE_SPACE",
472 "ccl_expr : CCE_XDIGIT",
473 "ccl_expr : CCE_UPPER",
474 "ccl_expr : CCE_NEG_ALNUM",
475 "ccl_expr : CCE_NEG_ALPHA",
476 "ccl_expr : CCE_NEG_BLANK",
477 "ccl_expr : CCE_NEG_CNTRL",
478 "ccl_expr : CCE_NEG_DIGIT",
479 "ccl_expr : CCE_NEG_GRAPH",
480 "ccl_expr : CCE_NEG_PRINT",
481 "ccl_expr : CCE_NEG_PUNCT",
482 "ccl_expr : CCE_NEG_SPACE",
483 "ccl_expr : CCE_NEG_XDIGIT",
484 "ccl_expr : CCE_NEG_LOWER",
485 "ccl_expr : CCE_NEG_UPPER",
486 "string : string CHAR",
502 /* define the initial stack-sizes */
505 #define YYMAXDEPTH YYSTACKSIZE
508 #define YYSTACKSIZE YYMAXDEPTH
510 #define YYSTACKSIZE 10000
511 #define YYMAXDEPTH 10000
515 #define YYINITSTACKSIZE 200
525 /* variables for the parser stack */
526 static YYSTACKDATA yystack;
530 /* build_eof_action - build the "<<EOF>>" action for the active start
534 void build_eof_action(void)
537 char action_text[MAXLINE];
539 for ( i = 1; i <= scon_stk_ptr; ++i )
541 if ( sceof[scon_stk[i]] )
542 format_pinpoint_message(
543 "multiple <<EOF>> rules for start condition %s",
544 scname[scon_stk[i]] );
548 sceof[scon_stk[i]] = true;
550 if (previous_continued_action /* && previous action was regular */)
551 add_action("YY_RULE_SETUP\n");
553 snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n",
554 scname[scon_stk[i]] );
555 add_action( action_text );
559 line_directive_out(NULL, 1);
562 /* This isn't a normal rule after all - don't count it as
563 * such, so we don't have any holes in the rule numbering
564 * (which make generating "rule can never match" warnings
572 /* format_synerr - write out formatted syntax error */
574 void format_synerr( const char *msg, const char arg[] )
576 char errmsg[MAXLINE];
578 (void) snprintf( errmsg, sizeof(errmsg), msg, arg );
583 /* synerr - report a syntax error */
585 void synerr( const char *str )
588 pinpoint_message( str );
592 /* format_warn - write out formatted warning */
594 void format_warn( const char *msg, const char arg[] )
596 char warn_msg[MAXLINE];
598 snprintf( warn_msg, sizeof(warn_msg), msg, arg );
603 /* lwarn - report a warning, unless -w was given */
605 void lwarn( const char *str )
607 line_warning( str, linenum );
610 /* format_pinpoint_message - write out a message formatted with one string,
611 * pinpointing its location
614 void format_pinpoint_message( const char *msg, const char arg[] )
616 char errmsg[MAXLINE];
618 snprintf( errmsg, sizeof(errmsg), msg, arg );
619 pinpoint_message( errmsg );
623 /* pinpoint_message - write out a message, pinpointing its location */
625 void pinpoint_message( const char *str )
627 line_pinpoint( str, linenum );
631 /* line_warning - report a warning at a given line, unless -w was given */
633 void line_warning( const char *str, int line )
635 char warning[MAXLINE];
639 snprintf( warning, sizeof(warning), "warning, %s", str );
640 line_pinpoint( warning, line );
645 /* line_pinpoint - write out a message, pinpointing it at the given line */
647 void line_pinpoint( const char *str, int line )
649 fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
653 /* yyerror - eat up an error message from the parser;
654 * currently, messages are ignore
657 void yyerror( const char *msg )
664 #include <stdio.h> /* needed for printf */
667 #include <stdlib.h> /* needed for malloc, etc */
668 #include <string.h> /* needed for memset */
670 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
671 static int yygrowstack(YYSTACKDATA *data)
678 if ((newsize = data->stacksize) == 0)
679 newsize = YYINITSTACKSIZE;
680 else if (newsize >= YYMAXDEPTH)
682 else if ((newsize *= 2) > YYMAXDEPTH)
683 newsize = YYMAXDEPTH;
685 i = (int) (data->s_mark - data->s_base);
686 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
690 data->s_base = newss;
691 data->s_mark = newss + i;
693 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
697 data->l_base = newvs;
698 data->l_mark = newvs + i;
700 data->stacksize = newsize;
701 data->s_last = data->s_base + newsize - 1;
705 #if YYPURE || defined(YY_NO_LEAKS)
706 static void yyfreestack(YYSTACKDATA *data)
710 memset(data, 0, sizeof(*data));
713 #define yyfreestack(data) /* nothing */
716 #define YYABORT goto yyabort
717 #define YYREJECT goto yyabort
718 #define YYACCEPT goto yyaccept
719 #define YYERROR goto yyerrlab
724 int yym, yyn, yystate;
728 if ((yys = getenv("YYDEBUG")) != NULL)
731 if (yyn >= '0' && yyn <= '9')
744 memset(&yystack, 0, sizeof(yystack));
747 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
748 yystack.s_mark = yystack.s_base;
749 yystack.l_mark = yystack.l_base;
754 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
758 if (yychar < 0) yychar = YYEOF;
762 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
763 printf("%sdebug: state %d, reading %d (%s)\n",
764 YYPREFIX, yystate, yychar, yys);
768 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
769 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
773 printf("%sdebug: state %d, shifting to state %d\n",
774 YYPREFIX, yystate, yytable[yyn]);
776 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
777 yystate = yytable[yyn];
778 *++yystack.s_mark = yytable[yyn];
779 *++yystack.l_mark = yylval;
781 if (yyerrflag > 0) --yyerrflag;
784 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
785 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
790 if (yyerrflag != 0) goto yyinrecovery;
792 YYERROR_CALL("syntax error");
794 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
804 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
805 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
809 printf("%sdebug: state %d, error recovery shifting\
810 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
812 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
813 yystate = yytable[yyn];
814 *++yystack.s_mark = yytable[yyn];
815 *++yystack.l_mark = yylval;
822 printf("%sdebug: error recovery discarding state %d\n",
823 YYPREFIX, *yystack.s_mark);
825 if (yystack.s_mark <= yystack.s_base) goto yyabort;
833 if (yychar == YYEOF) goto yyabort;
837 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
838 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
839 YYPREFIX, yystate, yychar, yys);
849 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
850 YYPREFIX, yystate, yyn, yyrule[yyn]);
854 yyval = yystack.l_mark[1-yym];
856 memset(&yyval, 0, sizeof yyval);
862 { /* add default rule */
868 def_rule = mkstate( -pat );
870 /* Remember the number of the default rule so we
871 * don't generate "can't match" warnings for it.
873 default_rule = num_rules;
875 finish_rule( def_rule, false, 0, 0, 0);
877 for ( i = 1; i <= lastsc; ++i )
878 scset[i] = mkbranch( scset[i], def_rule );
882 "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
884 add_action( "ECHO" );
886 add_action( ";\n\tYY_BREAK]]\n" );
891 { /* initialize for processing rules */
893 /* Create default DFA start condition. */
894 scinstal( "INITIAL", false );
899 { synerr( _("unknown error processing section 1") ); }
905 scon_stk = allocate_integer_array( lastsc + 1 );
919 { scinstal( nmstr, xcluflg ); }
923 { scinstal( nmstr, xcluflg ); }
927 { synerr( _("bad start condition list") ); }
932 outfilename = xstrdup(nmstr);
938 { extra_type = xstrdup(nmstr); }
942 { prefix = xstrdup(nmstr);
943 if (strchr(prefix, '[') || strchr(prefix, ']'))
944 flexerror(_("Prefix must not contain [ or ]")); }
948 { yyclass = xstrdup(nmstr); }
952 { headerfilename = xstrdup(nmstr); }
956 { tablesext = true; tablesfilename = xstrdup(nmstr); }
960 { scon_stk_ptr = yystack.l_mark[-3]; }
964 { scon_stk_ptr = yystack.l_mark[-3]; }
969 /* Initialize for a parse of one rule. */
970 trlcontxt = variable_trail_rule = varlength = false;
971 trailcnt = headcnt = rulelen = 0;
972 current_state_type = STATE_NORMAL;
973 previous_continued_action = continued_action;
982 pat = yystack.l_mark[0];
983 finish_rule( pat, variable_trail_rule,
984 headcnt, trailcnt , previous_continued_action);
986 if ( scon_stk_ptr > 0 )
988 for ( i = 1; i <= scon_stk_ptr; ++i )
990 mkbranch( scbol[scon_stk[i]],
996 /* Add to all non-exclusive start conditions,
997 * including the default (0) start condition.
1000 for ( i = 1; i <= lastsc; ++i )
1002 scbol[i] = mkbranch( scbol[i],
1010 if ( performance_report > 1 )
1012 "'^' operator results in sub-optimal performance" );
1019 pat = yystack.l_mark[0];
1020 finish_rule( pat, variable_trail_rule,
1021 headcnt, trailcnt , previous_continued_action);
1023 if ( scon_stk_ptr > 0 )
1025 for ( i = 1; i <= scon_stk_ptr; ++i )
1026 scset[scon_stk[i]] =
1027 mkbranch( scset[scon_stk[i]],
1033 for ( i = 1; i <= lastsc; ++i )
1044 if ( scon_stk_ptr > 0 )
1049 /* This EOF applies to all start conditions
1050 * which don't already have EOF actions.
1052 for ( i = 1; i <= lastsc; ++i )
1054 scon_stk[++scon_stk_ptr] = i;
1056 if ( scon_stk_ptr == 0 )
1058 "all start conditions already have <<EOF>> rules" );
1067 { synerr( _("unrecognized rule") ); }
1071 { yyval = scon_stk_ptr; }
1075 { yyval = yystack.l_mark[-2]; }
1080 yyval = scon_stk_ptr;
1082 for ( i = 1; i <= lastsc; ++i )
1086 for ( j = 1; j <= scon_stk_ptr; ++j )
1087 if ( scon_stk[j] == i )
1090 if ( j > scon_stk_ptr )
1091 scon_stk[++scon_stk_ptr] = i;
1097 { yyval = scon_stk_ptr; }
1101 { synerr( _("bad start condition list") ); }
1106 if ( (scnum = sclookup( nmstr )) == 0 )
1107 format_pinpoint_message(
1108 "undeclared start condition %s",
1112 for ( i = 1; i <= scon_stk_ptr; ++i )
1113 if ( scon_stk[i] == scnum )
1116 "<%s> specified twice",
1121 if ( i > scon_stk_ptr )
1122 scon_stk[++scon_stk_ptr] = scnum;
1129 if ( transchar[lastst[yystack.l_mark[0]]] != SYM_EPSILON )
1130 /* Provide final transition \now/ so it
1131 * will be marked as a trailing context
1134 yystack.l_mark[0] = link_machines( yystack.l_mark[0],
1135 mkstate( SYM_EPSILON ) );
1137 mark_beginning_as_normal( yystack.l_mark[0] );
1138 current_state_type = STATE_NORMAL;
1140 if ( previous_continued_action )
1142 /* We need to treat this as variable trailing
1143 * context so that the backup does not happen
1144 * in the action but before the action switch
1145 * statement. If the backup happens in the
1146 * action, then the rules "falling into" this
1147 * one's action will *also* do the backup,
1150 if ( ! varlength || headcnt != 0 )
1152 "trailing context made variable due to preceding '|' action" );
1154 /* Mark as variable. */
1160 if ( lex_compat || (varlength && headcnt == 0) )
1161 { /* variable trailing context rule */
1162 /* Mark the first part of the rule as the
1163 * accepting "head" part of a trailing
1166 * By the way, we didn't do this at the
1167 * beginning of this production because back
1168 * then current_state_type was set up for a
1169 * trail rule, and add_accept() can create
1172 add_accept( yystack.l_mark[-1],
1173 num_rules | YY_TRAILING_HEAD_MASK );
1174 variable_trail_rule = true;
1180 yyval = link_machines( yystack.l_mark[-1], yystack.l_mark[0] );
1185 { synerr( _("trailing context used twice") ); }
1195 current_state_type = STATE_TRAILING_CONTEXT;
1199 synerr( _("trailing context used twice") );
1200 yyval = mkstate( SYM_EPSILON );
1203 else if ( previous_continued_action )
1205 /* See the comment in the rule for "re2 re"
1209 "trailing context made variable due to preceding '|' action" );
1214 if ( lex_compat || varlength )
1216 /* Again, see the comment in the rule for
1219 add_accept( yystack.l_mark[-1],
1220 num_rules | YY_TRAILING_HEAD_MASK );
1221 variable_trail_rule = true;
1226 eps = mkstate( SYM_EPSILON );
1227 yyval = link_machines( yystack.l_mark[-1],
1228 link_machines( eps, mkstate( '\n' ) ) );
1234 yyval = yystack.l_mark[0];
1238 if ( lex_compat || (varlength && headcnt == 0) )
1239 /* Both head and trail are
1242 variable_trail_rule = true;
1252 yyval = mkor( yystack.l_mark[-2], yystack.l_mark[0] );
1257 { yyval = yystack.l_mark[0]; }
1262 /* This rule is written separately so the
1263 * reduction will occur before the trailing
1268 synerr( _("trailing context used twice") );
1273 /* We hope the trailing context is
1282 current_state_type = STATE_TRAILING_CONTEXT;
1283 yyval = yystack.l_mark[-1];
1289 /* This is where concatenation of adjacent patterns
1292 yyval = link_machines( yystack.l_mark[-1], yystack.l_mark[0] );
1297 { yyval = yystack.l_mark[0]; }
1304 if ( yystack.l_mark[-3] > yystack.l_mark[-1] || yystack.l_mark[-3] < 0 )
1306 synerr( _("bad iteration values") );
1307 yyval = yystack.l_mark[-5];
1311 if ( yystack.l_mark[-3] == 0 )
1313 if ( yystack.l_mark[-1] <= 0 )
1316 _("bad iteration values") );
1317 yyval = yystack.l_mark[-5];
1321 mkrep( yystack.l_mark[-5], 1, yystack.l_mark[-1] ) );
1324 yyval = mkrep( yystack.l_mark[-5], yystack.l_mark[-3], yystack.l_mark[-1] );
1333 if ( yystack.l_mark[-2] <= 0 )
1335 synerr( _("iteration value must be positive") );
1336 yyval = yystack.l_mark[-4];
1340 yyval = mkrep( yystack.l_mark[-4], yystack.l_mark[-2], INFINITE_REPEAT );
1346 /* The series could be something like "(foo)",
1347 * in which case we have no idea what its length
1348 * is, so we punt here.
1352 if ( yystack.l_mark[-1] <= 0 )
1354 synerr( _("iteration value must be positive")
1356 yyval = yystack.l_mark[-3];
1360 yyval = link_machines( yystack.l_mark[-3],
1361 copysingl( yystack.l_mark[-3], yystack.l_mark[-1] - 1 ) );
1369 yyval = mkclos( yystack.l_mark[-1] );
1376 yyval = mkposcl( yystack.l_mark[-1] );
1383 yyval = mkopt( yystack.l_mark[-1] );
1391 if ( yystack.l_mark[-3] > yystack.l_mark[-1] || yystack.l_mark[-3] < 0 )
1393 synerr( _("bad iteration values") );
1394 yyval = yystack.l_mark[-5];
1398 if ( yystack.l_mark[-3] == 0 )
1400 if ( yystack.l_mark[-1] <= 0 )
1403 _("bad iteration values") );
1404 yyval = yystack.l_mark[-5];
1408 mkrep( yystack.l_mark[-5], 1, yystack.l_mark[-1] ) );
1411 yyval = mkrep( yystack.l_mark[-5], yystack.l_mark[-3], yystack.l_mark[-1] );
1420 if ( yystack.l_mark[-2] <= 0 )
1422 synerr( _("iteration value must be positive") );
1423 yyval = yystack.l_mark[-4];
1427 yyval = mkrep( yystack.l_mark[-4], yystack.l_mark[-2], INFINITE_REPEAT );
1433 /* The singleton could be something like "(foo)",
1434 * in which case we have no idea what its length
1435 * is, so we punt here.
1439 if ( yystack.l_mark[-1] <= 0 )
1441 synerr( _("iteration value must be positive") );
1442 yyval = yystack.l_mark[-3];
1446 yyval = link_machines( yystack.l_mark[-3],
1447 copysingl( yystack.l_mark[-3], yystack.l_mark[-1] - 1 ) );
1455 /* Create the '.' character class. */
1457 ccladd( ccldot, '\n' );
1458 cclnegate( ccldot );
1461 mkeccl( ccltbl + cclmap[ccldot],
1462 ccllen[ccldot], nextecm,
1463 ecgroup, csize, csize );
1465 /* Create the (?s:'.') character class. */
1467 cclnegate( cclany );
1470 mkeccl( ccltbl + cclmap[cclany],
1471 ccllen[cclany], nextecm,
1472 ecgroup, csize, csize );
1480 yyval = mkstate( -cclany );
1482 yyval = mkstate( -ccldot );
1488 /* Sort characters for fast searching.
1490 qsort( ccltbl + cclmap[yystack.l_mark[0]], (size_t) ccllen[yystack.l_mark[0]], sizeof (*ccltbl), cclcmp );
1493 mkeccl( ccltbl + cclmap[yystack.l_mark[0]], ccllen[yystack.l_mark[0]],
1494 nextecm, ecgroup, csize, csize );
1498 if (ccl_has_nl[yystack.l_mark[0]])
1499 rule_has_nl[num_rules] = true;
1501 yyval = mkstate( -yystack.l_mark[0] );
1509 if (ccl_has_nl[yystack.l_mark[0]])
1510 rule_has_nl[num_rules] = true;
1512 yyval = mkstate( -yystack.l_mark[0] );
1517 { yyval = yystack.l_mark[-1]; }
1521 { yyval = yystack.l_mark[-1]; }
1528 if (yystack.l_mark[0] == nlch)
1529 rule_has_nl[num_rules] = true;
1531 if (sf_case_ins() && has_case(yystack.l_mark[0]))
1532 /* create an alternation, as in (a|A) */
1533 yyval = mkor (mkstate(yystack.l_mark[0]), mkstate(reverse_case(yystack.l_mark[0])));
1535 yyval = mkstate( yystack.l_mark[0] );
1540 { yyval = ccl_set_diff (yystack.l_mark[-2], yystack.l_mark[0]); }
1544 { yyval = ccl_set_union (yystack.l_mark[-2], yystack.l_mark[0]); }
1548 { yyval = yystack.l_mark[-1]; }
1553 cclnegate( yystack.l_mark[-1] );
1554 yyval = yystack.l_mark[-1];
1564 /* If one end of the range has case and the other
1565 * does not, or the cases are different, then we're not
1566 * sure what range the user is trying to express.
1567 * Examples: [@-z] or [S-t]
1569 if (has_case (yystack.l_mark[-2]) != has_case (yystack.l_mark[0])
1570 || (has_case (yystack.l_mark[-2]) && (b_islower (yystack.l_mark[-2]) != b_islower (yystack.l_mark[0])))
1571 || (has_case (yystack.l_mark[-2]) && (b_isupper (yystack.l_mark[-2]) != b_isupper (yystack.l_mark[0]))))
1573 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1574 yystack.l_mark[-2], yystack.l_mark[0]);
1576 /* If the range spans uppercase characters but not
1577 * lowercase (or vice-versa), then should we automatically
1578 * include lowercase characters in the range?
1579 * Example: [@-_] spans [a-z] but not [A-Z]
1581 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]))
1583 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1584 yystack.l_mark[-2], yystack.l_mark[0]);
1587 if ( yystack.l_mark[-2] > yystack.l_mark[0] )
1588 synerr( _("negative range in character class") );
1592 for ( i = yystack.l_mark[-2]; i <= yystack.l_mark[0]; ++i )
1593 ccladd( yystack.l_mark[-3], i );
1595 /* Keep track if this ccl is staying in
1596 * alphabetical order.
1598 cclsorted = cclsorted && (yystack.l_mark[-2] > lastchar);
1599 lastchar = yystack.l_mark[0];
1601 /* Do it again for upper/lowercase */
1602 if (sf_case_ins() && has_case(yystack.l_mark[-2]) && has_case(yystack.l_mark[0])){
1603 yystack.l_mark[-2] = reverse_case (yystack.l_mark[-2]);
1604 yystack.l_mark[0] = reverse_case (yystack.l_mark[0]);
1606 for ( i = yystack.l_mark[-2]; i <= yystack.l_mark[0]; ++i )
1607 ccladd( yystack.l_mark[-3], i );
1609 cclsorted = cclsorted && (yystack.l_mark[-2] > lastchar);
1610 lastchar = yystack.l_mark[0];
1615 yyval = yystack.l_mark[-3];
1621 ccladd( yystack.l_mark[-1], yystack.l_mark[0] );
1622 cclsorted = cclsorted && (yystack.l_mark[0] > lastchar);
1623 lastchar = yystack.l_mark[0];
1625 /* Do it again for upper/lowercase */
1626 if (sf_case_ins() && has_case(yystack.l_mark[0])){
1627 yystack.l_mark[0] = reverse_case (yystack.l_mark[0]);
1628 ccladd (yystack.l_mark[-1], yystack.l_mark[0]);
1630 cclsorted = cclsorted && (yystack.l_mark[0] > lastchar);
1631 lastchar = yystack.l_mark[0];
1634 yyval = yystack.l_mark[-1];
1640 /* Too hard to properly maintain cclsorted. */
1642 yyval = yystack.l_mark[-1];
1650 currccl = yyval = cclinit();
1655 { CCL_EXPR(isalnum); }
1659 { CCL_EXPR(isalpha); }
1663 { CCL_EXPR(IS_BLANK); }
1667 { CCL_EXPR(iscntrl); }
1671 { CCL_EXPR(isdigit); }
1675 { CCL_EXPR(isgraph); }
1687 { CCL_EXPR(isprint); }
1691 { CCL_EXPR(ispunct); }
1695 { CCL_EXPR(isspace); }
1699 { CCL_EXPR(isxdigit); }
1711 { CCL_NEG_EXPR(isalnum); }
1715 { CCL_NEG_EXPR(isalpha); }
1719 { CCL_NEG_EXPR(IS_BLANK); }
1723 { CCL_NEG_EXPR(iscntrl); }
1727 { CCL_NEG_EXPR(isdigit); }
1731 { CCL_NEG_EXPR(isgraph); }
1735 { CCL_NEG_EXPR(isprint); }
1739 { CCL_NEG_EXPR(ispunct); }
1743 { CCL_NEG_EXPR(isspace); }
1747 { CCL_NEG_EXPR(isxdigit); }
1752 if ( sf_case_ins() )
1753 lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
1755 CCL_NEG_EXPR(islower);
1761 if ( sf_case_ins() )
1762 lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
1764 CCL_NEG_EXPR(isupper);
1770 if ( yystack.l_mark[0] == nlch )
1771 rule_has_nl[num_rules] = true;
1775 if (sf_case_ins() && has_case(yystack.l_mark[0]))
1776 yyval = mkor (mkstate(yystack.l_mark[0]), mkstate(reverse_case(yystack.l_mark[0])));
1778 yyval = mkstate (yystack.l_mark[0]);
1780 yyval = link_machines( yystack.l_mark[-1], yyval);
1785 { yyval = mkstate( SYM_EPSILON ); }
1787 #line 1788 "parse.c"
1789 yystack.s_mark -= yym;
1790 yystate = *yystack.s_mark;
1791 yystack.l_mark -= yym;
1793 if (yystate == 0 && yym == 0)
1797 printf("%sdebug: after reduction, shifting from state 0 to\
1798 state %d\n", YYPREFIX, YYFINAL);
1801 *++yystack.s_mark = YYFINAL;
1802 *++yystack.l_mark = yyval;
1806 if (yychar < 0) yychar = YYEOF;
1810 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1811 printf("%sdebug: state %d, reading %d (%s)\n",
1812 YYPREFIX, YYFINAL, yychar, yys);
1816 if (yychar == YYEOF) goto yyaccept;
1819 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1820 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1821 yystate = yytable[yyn];
1823 yystate = yydgoto[yym];
1826 printf("%sdebug: after reduction, shifting from state %d \
1827 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1829 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1830 *++yystack.s_mark = (YYINT) yystate;
1831 *++yystack.l_mark = yyval;
1835 YYERROR_CALL("yacc stack overflow");
1838 yyfreestack(&yystack);
1842 yyfreestack(&yystack);