2 /* original parser id follows */
3 /* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
4 /* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
9 #define YYPATCH 20170430
12 #define yyclearin (yychar = YYEMPTY)
13 #define yyerrok (yyerrflag = 0)
14 #define YYRECOVERING() (yyerrflag != 0)
22 /* SPDX-License-Identifier: BSD-2-Clause */
24 /* Copyright (c) 1990 The Regents of the University of California. */
25 /* All rights reserved. */
27 /* This code is derived from software contributed to Berkeley by */
30 /* The United States Government has rights in this work pursuant */
31 /* to contract no. DE-AC03-76SF00098 between the United States */
32 /* Department of Energy and the University of California. */
34 /* This file is part of flex. */
36 /* Redistribution and use in source and binary forms, with or without */
37 /* modification, are permitted provided that the following conditions */
40 /* 1. Redistributions of source code must retain the above copyright */
41 /* notice, this list of conditions and the following disclaimer. */
42 /* 2. Redistributions in binary form must reproduce the above copyright */
43 /* notice, this list of conditions and the following disclaimer in the */
44 /* documentation and/or other materials provided with the distribution. */
46 /* Neither the name of the University nor the names of its contributors */
47 /* may be used to endorse or promote products derived from this software */
48 /* without specific prior written permission. */
50 /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
51 /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
52 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
58 int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen;
59 int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule;
64 static int madeany = false; /* whether we've made the '.' character class */
65 static int ccldot, cclany;
66 int previous_continued_action; /* whether the previous rule's action was '|' */
68 #define format_warn3(fmt, a1, a2) \
70 char fw3_msg[MAXLINE];\
71 snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
75 /* Expand a POSIX character class expression. */
76 #define CCL_EXPR(func) \
79 for ( c = 0; c < csize; ++c ) \
80 if ( isascii(c) && func(c) ) \
81 ccladd( currccl, c ); \
85 #define CCL_NEG_EXPR(func) \
88 for ( c = 0; c < csize; ++c ) \
90 ccladd( currccl, c ); \
93 /* While POSIX defines isblank(), it's not ANSI C. */
94 #define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
96 /* On some over-ambitious machines, such as DEC Alpha's, the default
97 * token type is "long" instead of "int"; this leads to problems with
98 * declaring yylval in flexdef.h. But so far, all the yacc's I've seen
99 * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
100 * following should ensure that the default token type is "int".
106 #if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
107 /* Default: YYSTYPE is the semantic value type. */
109 # define YYSTYPE_IS_DECLARED 1
112 /* compatibility with bison */
114 /* compatibility with FreeBSD */
115 # ifdef YYPARSE_PARAM_TYPE
116 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
118 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
121 # define YYPARSE_DECL() yyparse(void)
124 /* Parameters sent to lex. */
126 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
127 # define YYLEX yylex(YYLEX_PARAM)
129 # define YYLEX_DECL() yylex(void)
130 # define YYLEX yylex()
133 /* Parameters sent to yyerror. */
135 #define YYERROR_DECL() yyerror(const char *s)
138 #define YYERROR_CALL(msg) yyerror(msg)
141 extern int YYPARSE_DECL();
151 #define TOK_OPTION 265
152 #define TOK_OUTFILE 266
153 #define TOK_PREFIX 267
154 #define TOK_YYCLASS 268
155 #define TOK_HEADER_FILE 269
156 #define TOK_EXTRA_TYPE 270
157 #define TOK_TABLES_FILE 271
158 #define CCE_ALNUM 272
159 #define CCE_ALPHA 273
160 #define CCE_BLANK 274
161 #define CCE_CNTRL 275
162 #define CCE_DIGIT 276
163 #define CCE_GRAPH 277
164 #define CCE_LOWER 278
165 #define CCE_PRINT 279
166 #define CCE_PUNCT 280
167 #define CCE_SPACE 281
168 #define CCE_UPPER 282
169 #define CCE_XDIGIT 283
170 #define CCE_NEG_ALNUM 284
171 #define CCE_NEG_ALPHA 285
172 #define CCE_NEG_BLANK 286
173 #define CCE_NEG_CNTRL 287
174 #define CCE_NEG_DIGIT 288
175 #define CCE_NEG_GRAPH 289
176 #define CCE_NEG_LOWER 290
177 #define CCE_NEG_PRINT 291
178 #define CCE_NEG_PUNCT 292
179 #define CCE_NEG_SPACE 293
180 #define CCE_NEG_UPPER 294
181 #define CCE_NEG_XDIGIT 295
182 #define CCL_OP_DIFF 296
183 #define CCL_OP_UNION 297
184 #define BEGIN_REPEAT_POSIX 298
185 #define END_REPEAT_POSIX 299
186 #define BEGIN_REPEAT_FLEX 300
187 #define END_REPEAT_FLEX 301
188 #define YYERRCODE 256
190 static const YYINT yylhs[] = { -1,
191 0, 1, 2, 2, 2, 2, 3, 6, 6, 7,
192 7, 7, 8, 9, 9, 10, 10, 10, 10, 10,
193 10, 4, 4, 4, 5, 12, 12, 12, 12, 14,
194 11, 11, 11, 15, 15, 15, 16, 13, 13, 13,
195 13, 18, 18, 17, 19, 19, 19, 19, 19, 20,
196 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
197 20, 21, 21, 21, 23, 23, 24, 24, 24, 24,
198 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
199 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
200 25, 25, 25, 25, 22, 22,
202 static const YYINT yylen[] = { 2,
203 5, 0, 3, 2, 0, 1, 1, 1, 1, 2,
204 1, 1, 2, 2, 0, 3, 3, 3, 3, 3,
205 3, 5, 5, 0, 0, 2, 1, 1, 1, 0,
206 4, 3, 0, 3, 1, 1, 1, 2, 3, 2,
207 1, 3, 1, 2, 2, 1, 6, 5, 4, 2,
208 2, 2, 6, 5, 4, 1, 1, 1, 3, 3,
209 1, 3, 3, 1, 3, 4, 4, 2, 2, 0,
210 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
211 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
214 static const YYINT yydefred[] = { 2,
215 0, 0, 6, 0, 7, 8, 9, 15, 24, 0,
216 4, 0, 0, 12, 11, 0, 0, 0, 0, 0,
217 0, 0, 14, 0, 1, 0, 10, 0, 0, 0,
218 0, 0, 0, 0, 0, 24, 0, 16, 18, 19,
219 20, 17, 21, 32, 36, 37, 0, 35, 0, 29,
220 61, 58, 28, 0, 56, 96, 0, 0, 0, 27,
221 0, 0, 0, 0, 0, 64, 31, 0, 23, 26,
222 0, 0, 70, 0, 22, 0, 40, 0, 44, 0,
223 0, 0, 50, 51, 52, 0, 0, 34, 95, 59,
224 60, 0, 0, 71, 72, 73, 74, 75, 76, 77,
225 78, 79, 80, 82, 81, 83, 84, 85, 86, 87,
226 88, 93, 89, 90, 91, 94, 92, 65, 69, 39,
227 0, 0, 0, 62, 63, 66, 0, 49, 0, 55,
228 0, 67, 0, 48, 0, 54, 47, 53,
230 static const YYINT yydgoto[] = { 1,
231 2, 4, 9, 13, 25, 10, 16, 11, 12, 23,
232 26, 59, 60, 35, 47, 48, 61, 62, 63, 64,
235 static const YYINT yysindex[] = { 0,
236 0, -222, 0, -155, 0, 0, 0, 0, 0, -215,
237 0, -123, 6, 0, 0, -193, 10, 21, 26, 31,
238 35, 37, 0, 59, 0, -44, 0, -147, -145, -140,
239 -133, -132, -129, 75, -214, 0, -19, 0, 0, 0,
240 0, 0, 0, 0, 0, 0, 23, 0, -48, 0,
241 0, 0, 0, -17, 0, 0, -17, 27, 128, 0,
242 -17, -1, -30, -41, -189, 0, 0, -121, 0, 0,
243 -31, -34, 0, -87, 0, -25, 0, -17, 0, -109,
244 -41, -108, 0, 0, 0, 60, 60, 0, 0, 0,
245 0, 46, 107, 0, 0, 0, 0, 0, 0, 0,
246 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
247 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
248 -30, -36, -39, 0, 0, 0, -104, 0, -219, 0,
249 -238, 0, -144, 0, -143, 0, 0, 0,
251 static const YYINT yyrindex[] = { 0,
252 0, -141, 0, 0, 0, 0, 0, 0, 0, 0,
253 0, -134, 9, 0, 0, -125, 0, 0, 0, 0,
254 0, 0, 0, -178, 0, 22, 0, 0, 0, 0,
255 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
256 0, 0, 0, 0, 0, 0, 0, 0, -21, 0,
257 0, 0, 0, 0, 0, 0, 0, 85, 0, 0,
258 0, 144, 47, 4, -10, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 146, 0, 0, 0, 0,
260 18, 0, 0, 0, 0, 0, 0, 0, 0, 0,
261 0, 0, 124, 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 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
265 0, 0, 0, 0, 0, 0, 0, 0,
267 static const YYINT yygindex[] = { 0,
268 0, 0, 0, 121, 133, 0, 0, 0, 0, 0,
269 0, 0, 106, 0, 0, 93, 0, 32, 84, -45,
272 #define YYTABLESIZE 419
273 static const YYINT yytable[] = { 57,
274 83, 84, 90, 56, 131, 118, 91, 129, 25, 57,
275 120, 24, 33, 46, 56, 55, 56, 81, 33, 135,
276 57, 85, 57, 57, 33, 57, 55, 45, 55, 57,
277 57, 57, 57, 3, 77, 57, 57, 46, 133, 46,
278 14, 45, 33, 46, 46, 79, 15, 46, 33, 46,
279 46, 45, 57, 45, 33, 25, 43, 45, 45, 42,
280 58, 25, 136, 45, 45, 24, 68, 25, 27, 33,
281 28, 58, 33, 58, 54, 81, 69, 30, 36, 134,
282 57, 29, 43, 30, 67, 42, 30, 43, 72, 78,
283 42, 31, 76, 43, 46, 32, 42, 33, 78, 33,
284 34, 33, 33, 5, 6, 7, 86, 87, 45, 8,
285 124, 125, 25, 57, 38, 25, 39, 5, 5, 5,
286 73, 40, 78, 5, 13, 13, 13, 46, 41, 42,
287 13, 33, 43, 3, 3, 3, 44, 75, 126, 3,
288 46, 45, 17, 18, 19, 20, 21, 22, 122, 123,
289 58, 127, 132, 41, 137, 38, 49, 138, 37, 70,
290 88, 121, 92, 0, 0, 0, 0, 0, 0, 93,
291 43, 0, 0, 42, 0, 0, 0, 70, 0, 0,
292 0, 0, 0, 0, 94, 95, 96, 97, 98, 99,
293 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
294 110, 111, 112, 113, 114, 115, 116, 117, 0, 0,
295 0, 0, 0, 0, 0, 0, 68, 0, 0, 0,
296 0, 0, 0, 0, 0, 89, 51, 0, 0, 0,
297 0, 0, 52, 0, 33, 33, 50, 51, 0, 51,
298 0, 33, 33, 52, 53, 52, 57, 0, 0, 0,
299 0, 0, 57, 0, 0, 0, 0, 0, 82, 0,
300 46, 130, 128, 0, 33, 33, 46, 80, 0, 0,
301 0, 33, 33, 0, 45, 0, 0, 25, 25, 0,
302 45, 0, 0, 0, 25, 25, 0, 57, 0, 57,
303 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
304 0, 46, 93, 0, 0, 0, 0, 0, 0, 0,
305 0, 0, 0, 0, 0, 45, 0, 94, 95, 96,
306 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
307 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
308 117, 70, 0, 0, 0, 0, 0, 0, 0, 0,
309 0, 0, 0, 0, 0, 0, 70, 70, 70, 70,
310 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
311 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
312 68, 0, 0, 0, 0, 0, 0, 0, 0, 0,
313 0, 0, 0, 0, 0, 68, 68, 68, 68, 68,
314 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
315 68, 68, 68, 68, 68, 68, 68, 68, 68,
317 static const YYINT yycheck[] = { 10,
318 42, 43, 34, 34, 44, 93, 41, 44, 0, 40,
319 36, 60, 34, 10, 34, 46, 34, 63, 40, 258,
320 40, 63, 40, 34, 46, 36, 46, 10, 46, 40,
321 41, 42, 43, 256, 36, 46, 47, 34, 258, 36,
322 256, 256, 34, 40, 41, 47, 262, 262, 40, 46,
323 47, 34, 63, 36, 46, 34, 10, 40, 41, 10,
324 91, 40, 301, 46, 47, 60, 44, 46, 262, 91,
325 61, 91, 94, 91, 94, 121, 125, 256, 123, 299,
326 91, 61, 36, 262, 62, 36, 61, 41, 57, 124,
327 41, 61, 61, 47, 91, 61, 47, 61, 124, 91,
328 42, 123, 94, 259, 260, 261, 296, 297, 91, 265,
329 86, 87, 91, 124, 262, 94, 262, 259, 260, 261,
330 94, 262, 124, 265, 259, 260, 261, 124, 262, 262,
331 265, 123, 262, 259, 260, 261, 62, 10, 93, 265,
332 262, 124, 266, 267, 268, 269, 270, 271, 258, 258,
333 91, 45, 257, 10, 299, 10, 36, 301, 26, 54,
334 68, 78, 73, -1, -1, -1, -1, -1, -1, 257,
335 124, -1, -1, 124, -1, -1, -1, 93, -1, -1,
336 -1, -1, -1, -1, 272, 273, 274, 275, 276, 277,
337 278, 279, 280, 281, 282, 283, 284, 285, 286, 287,
338 288, 289, 290, 291, 292, 293, 294, 295, -1, -1,
339 -1, -1, -1, -1, -1, -1, 93, -1, -1, -1,
340 -1, -1, -1, -1, -1, 257, 257, -1, -1, -1,
341 -1, -1, 263, -1, 256, 257, 256, 257, -1, 257,
342 -1, 263, 264, 263, 264, 263, 257, -1, -1, -1,
343 -1, -1, 263, -1, -1, -1, -1, -1, 300, -1,
344 257, 301, 299, -1, 256, 257, 263, 298, -1, -1,
345 -1, 263, 264, -1, 257, -1, -1, 256, 257, -1,
346 263, -1, -1, -1, 263, 264, -1, 298, -1, 300,
347 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
348 -1, 298, 257, -1, -1, -1, -1, -1, -1, -1,
349 -1, -1, -1, -1, -1, 298, -1, 272, 273, 274,
350 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
351 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
352 295, 257, -1, -1, -1, -1, -1, -1, -1, -1,
353 -1, -1, -1, -1, -1, -1, 272, 273, 274, 275,
354 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
355 286, 287, 288, 289, 290, 291, 292, 293, 294, 295,
356 257, -1, -1, -1, -1, -1, -1, -1, -1, -1,
357 -1, -1, -1, -1, -1, 272, 273, 274, 275, 276,
358 277, 278, 279, 280, 281, 282, 283, 284, 285, 286,
359 287, 288, 289, 290, 291, 292, 293, 294, 295,
365 #define YYMAXTOKEN 301
366 #define YYUNDFTOKEN 329
367 #define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
369 static const char *const yyname[] = {
371 "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,
372 0,0,0,"'\"'",0,"'$'",0,0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,
373 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,
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,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,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,"CHAR","NUMBER","SECTEND",
379 "SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","TOK_OPTION","TOK_OUTFILE",
380 "TOK_PREFIX","TOK_YYCLASS","TOK_HEADER_FILE","TOK_EXTRA_TYPE","TOK_TABLES_FILE",
381 "CCE_ALNUM","CCE_ALPHA","CCE_BLANK","CCE_CNTRL","CCE_DIGIT","CCE_GRAPH",
382 "CCE_LOWER","CCE_PRINT","CCE_PUNCT","CCE_SPACE","CCE_UPPER","CCE_XDIGIT",
383 "CCE_NEG_ALNUM","CCE_NEG_ALPHA","CCE_NEG_BLANK","CCE_NEG_CNTRL","CCE_NEG_DIGIT",
384 "CCE_NEG_GRAPH","CCE_NEG_LOWER","CCE_NEG_PRINT","CCE_NEG_PUNCT","CCE_NEG_SPACE",
385 "CCE_NEG_UPPER","CCE_NEG_XDIGIT","CCL_OP_DIFF","CCL_OP_UNION",
386 "BEGIN_REPEAT_POSIX","END_REPEAT_POSIX","BEGIN_REPEAT_FLEX","END_REPEAT_FLEX",0,
387 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",
389 static const char *const yyrule[] = {
391 "goal : initlex sect1 sect1end sect2 initforrule",
393 "sect1 : sect1 startconddecl namelist1",
394 "sect1 : sect1 options",
397 "sect1end : SECTEND",
398 "startconddecl : SCDECL",
399 "startconddecl : XSCDECL",
400 "namelist1 : namelist1 NAME",
403 "options : TOK_OPTION optionlist",
404 "optionlist : optionlist option",
406 "option : TOK_OUTFILE '=' NAME",
407 "option : TOK_EXTRA_TYPE '=' NAME",
408 "option : TOK_PREFIX '=' NAME",
409 "option : TOK_YYCLASS '=' NAME",
410 "option : TOK_HEADER_FILE '=' NAME",
411 "option : TOK_TABLES_FILE '=' NAME",
412 "sect2 : sect2 scon initforrule flexrule '\\n'",
413 "sect2 : sect2 scon '{' sect2 '}'",
416 "flexrule : '^' rule",
421 "scon : '<' scon_stk_ptr namelist2 '>'",
422 "scon : '<' '*' '>'",
424 "namelist2 : namelist2 ',' sconname",
425 "namelist2 : sconname",
432 "re : re '|' series",
435 "series : series singleton",
436 "series : singleton",
437 "series : series BEGIN_REPEAT_POSIX NUMBER ',' NUMBER END_REPEAT_POSIX",
438 "series : series BEGIN_REPEAT_POSIX NUMBER ',' END_REPEAT_POSIX",
439 "series : series BEGIN_REPEAT_POSIX NUMBER END_REPEAT_POSIX",
440 "singleton : singleton '*'",
441 "singleton : singleton '+'",
442 "singleton : singleton '?'",
443 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' NUMBER END_REPEAT_FLEX",
444 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' END_REPEAT_FLEX",
445 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER END_REPEAT_FLEX",
447 "singleton : fullccl",
448 "singleton : PREVCCL",
449 "singleton : '\"' string '\"'",
450 "singleton : '(' re ')'",
452 "fullccl : fullccl CCL_OP_DIFF braceccl",
453 "fullccl : fullccl CCL_OP_UNION braceccl",
454 "fullccl : braceccl",
455 "braceccl : '[' ccl ']'",
456 "braceccl : '[' '^' ccl ']'",
457 "ccl : ccl CHAR '-' CHAR",
459 "ccl : ccl ccl_expr",
461 "ccl_expr : CCE_ALNUM",
462 "ccl_expr : CCE_ALPHA",
463 "ccl_expr : CCE_BLANK",
464 "ccl_expr : CCE_CNTRL",
465 "ccl_expr : CCE_DIGIT",
466 "ccl_expr : CCE_GRAPH",
467 "ccl_expr : CCE_LOWER",
468 "ccl_expr : CCE_PRINT",
469 "ccl_expr : CCE_PUNCT",
470 "ccl_expr : CCE_SPACE",
471 "ccl_expr : CCE_XDIGIT",
472 "ccl_expr : CCE_UPPER",
473 "ccl_expr : CCE_NEG_ALNUM",
474 "ccl_expr : CCE_NEG_ALPHA",
475 "ccl_expr : CCE_NEG_BLANK",
476 "ccl_expr : CCE_NEG_CNTRL",
477 "ccl_expr : CCE_NEG_DIGIT",
478 "ccl_expr : CCE_NEG_GRAPH",
479 "ccl_expr : CCE_NEG_PRINT",
480 "ccl_expr : CCE_NEG_PUNCT",
481 "ccl_expr : CCE_NEG_SPACE",
482 "ccl_expr : CCE_NEG_XDIGIT",
483 "ccl_expr : CCE_NEG_LOWER",
484 "ccl_expr : CCE_NEG_UPPER",
485 "string : string CHAR",
499 /* define the initial stack-sizes */
502 #define YYMAXDEPTH YYSTACKSIZE
505 #define YYSTACKSIZE YYMAXDEPTH
507 #define YYSTACKSIZE 10000
508 #define YYMAXDEPTH 10000
512 #define YYINITSTACKSIZE 200
522 /* variables for the parser stack */
523 static YYSTACKDATA yystack;
527 /* build_eof_action - build the "<<EOF>>" action for the active start
531 void build_eof_action(void)
534 char action_text[MAXLINE];
536 for ( i = 1; i <= scon_stk_ptr; ++i )
538 if ( sceof[scon_stk[i]] )
539 format_pinpoint_message(
540 "multiple <<EOF>> rules for start condition %s",
541 scname[scon_stk[i]] );
545 sceof[scon_stk[i]] = true;
547 if (previous_continued_action /* && previous action was regular */)
548 add_action("YY_RULE_SETUP\n");
550 snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n",
551 scname[scon_stk[i]] );
552 add_action( action_text );
556 line_directive_out(NULL, 1);
559 /* This isn't a normal rule after all - don't count it as
560 * such, so we don't have any holes in the rule numbering
561 * (which make generating "rule can never match" warnings
569 /* format_synerr - write out formatted syntax error */
571 void format_synerr( const char *msg, const char arg[] )
573 char errmsg[MAXLINE];
575 (void) snprintf( errmsg, sizeof(errmsg), msg, arg );
580 /* synerr - report a syntax error */
582 void synerr( const char *str )
585 pinpoint_message( str );
589 /* format_warn - write out formatted warning */
591 void format_warn( const char *msg, const char arg[] )
593 char warn_msg[MAXLINE];
595 snprintf( warn_msg, sizeof(warn_msg), msg, arg );
600 /* lwarn - report a warning, unless -w was given */
602 void lwarn( const char *str )
604 line_warning( str, linenum );
607 /* format_pinpoint_message - write out a message formatted with one string,
608 * pinpointing its location
611 void format_pinpoint_message( const char *msg, const char arg[] )
613 char errmsg[MAXLINE];
615 snprintf( errmsg, sizeof(errmsg), msg, arg );
616 pinpoint_message( errmsg );
620 /* pinpoint_message - write out a message, pinpointing its location */
622 void pinpoint_message( const char *str )
624 line_pinpoint( str, linenum );
628 /* line_warning - report a warning at a given line, unless -w was given */
630 void line_warning( const char *str, int line )
632 char warning[MAXLINE];
636 snprintf( warning, sizeof(warning), "warning, %s", str );
637 line_pinpoint( warning, line );
642 /* line_pinpoint - write out a message, pinpointing it at the given line */
644 void line_pinpoint( const char *str, int line )
646 fprintf( stderr, "%s:%d: %s\n", infilename, line, str );
650 /* yyerror - eat up an error message from the parser;
651 * currently, messages are ignore
654 void yyerror( const char *msg )
661 #include <stdio.h> /* needed for printf */
664 #include <stdlib.h> /* needed for malloc, etc */
665 #include <string.h> /* needed for memset */
667 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
668 static int yygrowstack(YYSTACKDATA *data)
675 if ((newsize = data->stacksize) == 0)
676 newsize = YYINITSTACKSIZE;
677 else if (newsize >= YYMAXDEPTH)
679 else if ((newsize *= 2) > YYMAXDEPTH)
680 newsize = YYMAXDEPTH;
682 i = (int) (data->s_mark - data->s_base);
683 newss = (YYINT *)realloc(data->s_base, newsize * sizeof(*newss));
687 data->s_base = newss;
688 data->s_mark = newss + i;
690 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
694 data->l_base = newvs;
695 data->l_mark = newvs + i;
697 data->stacksize = newsize;
698 data->s_last = data->s_base + newsize - 1;
702 #if YYPURE || defined(YY_NO_LEAKS)
703 static void yyfreestack(YYSTACKDATA *data)
707 memset(data, 0, sizeof(*data));
710 #define yyfreestack(data) /* nothing */
713 #define YYABORT goto yyabort
714 #define YYREJECT goto yyabort
715 #define YYACCEPT goto yyaccept
716 #define YYERROR goto yyerrlab
721 int yym, yyn, yystate;
725 if ((yys = getenv("YYDEBUG")) != NULL)
728 if (yyn >= '0' && yyn <= '9')
741 memset(&yystack, 0, sizeof(yystack));
744 if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
745 yystack.s_mark = yystack.s_base;
746 yystack.l_mark = yystack.l_base;
751 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
755 if (yychar < 0) yychar = YYEOF;
759 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
760 printf("%sdebug: state %d, reading %d (%s)\n",
761 YYPREFIX, yystate, yychar, yys);
765 if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
766 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
770 printf("%sdebug: state %d, shifting to state %d\n",
771 YYPREFIX, yystate, yytable[yyn]);
773 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
774 yystate = yytable[yyn];
775 *++yystack.s_mark = yytable[yyn];
776 *++yystack.l_mark = yylval;
778 if (yyerrflag > 0) --yyerrflag;
781 if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
782 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
787 if (yyerrflag != 0) goto yyinrecovery;
789 YYERROR_CALL("syntax error");
791 goto yyerrlab; /* redundant goto avoids 'unused label' warning */
801 if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
802 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
806 printf("%sdebug: state %d, error recovery shifting\
807 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
809 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
810 yystate = yytable[yyn];
811 *++yystack.s_mark = yytable[yyn];
812 *++yystack.l_mark = yylval;
819 printf("%sdebug: error recovery discarding state %d\n",
820 YYPREFIX, *yystack.s_mark);
822 if (yystack.s_mark <= yystack.s_base) goto yyabort;
830 if (yychar == YYEOF) goto yyabort;
834 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
835 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
836 YYPREFIX, yystate, yychar, yys);
846 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
847 YYPREFIX, yystate, yyn, yyrule[yyn]);
851 yyval = yystack.l_mark[1-yym];
853 memset(&yyval, 0, sizeof yyval);
859 { /* add default rule */
865 def_rule = mkstate( -pat );
867 /* Remember the number of the default rule so we
868 * don't generate "can't match" warnings for it.
870 default_rule = num_rules;
872 finish_rule( def_rule, false, 0, 0, 0);
874 for ( i = 1; i <= lastsc; ++i )
875 scset[i] = mkbranch( scset[i], def_rule );
879 "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
881 add_action( "ECHO" );
883 add_action( ";\n\tYY_BREAK]]\n" );
888 { /* initialize for processing rules */
890 /* Create default DFA start condition. */
891 scinstal( "INITIAL", false );
896 { synerr( _("unknown error processing section 1") ); }
902 scon_stk = allocate_integer_array( lastsc + 1 );
916 { scinstal( nmstr, xcluflg ); }
920 { scinstal( nmstr, xcluflg ); }
924 { synerr( _("bad start condition list") ); }
929 outfilename = xstrdup(nmstr);
935 { extra_type = xstrdup(nmstr); }
939 { prefix = xstrdup(nmstr);
940 if (strchr(prefix, '[') || strchr(prefix, ']'))
941 flexerror(_("Prefix must not contain [ or ]")); }
945 { yyclass = xstrdup(nmstr); }
949 { headerfilename = xstrdup(nmstr); }
953 { tablesext = true; tablesfilename = xstrdup(nmstr); }
957 { scon_stk_ptr = yystack.l_mark[-3]; }
961 { scon_stk_ptr = yystack.l_mark[-3]; }
966 /* Initialize for a parse of one rule. */
967 trlcontxt = variable_trail_rule = varlength = false;
968 trailcnt = headcnt = rulelen = 0;
969 current_state_type = STATE_NORMAL;
970 previous_continued_action = continued_action;
979 pat = yystack.l_mark[0];
980 finish_rule( pat, variable_trail_rule,
981 headcnt, trailcnt , previous_continued_action);
983 if ( scon_stk_ptr > 0 )
985 for ( i = 1; i <= scon_stk_ptr; ++i )
987 mkbranch( scbol[scon_stk[i]],
993 /* Add to all non-exclusive start conditions,
994 * including the default (0) start condition.
997 for ( i = 1; i <= lastsc; ++i )
999 scbol[i] = mkbranch( scbol[i],
1007 if ( performance_report > 1 )
1009 "'^' operator results in sub-optimal performance" );
1016 pat = yystack.l_mark[0];
1017 finish_rule( pat, variable_trail_rule,
1018 headcnt, trailcnt , previous_continued_action);
1020 if ( scon_stk_ptr > 0 )
1022 for ( i = 1; i <= scon_stk_ptr; ++i )
1023 scset[scon_stk[i]] =
1024 mkbranch( scset[scon_stk[i]],
1030 for ( i = 1; i <= lastsc; ++i )
1041 if ( scon_stk_ptr > 0 )
1046 /* This EOF applies to all start conditions
1047 * which don't already have EOF actions.
1049 for ( i = 1; i <= lastsc; ++i )
1051 scon_stk[++scon_stk_ptr] = i;
1053 if ( scon_stk_ptr == 0 )
1055 "all start conditions already have <<EOF>> rules" );
1064 { synerr( _("unrecognized rule") ); }
1068 { yyval = scon_stk_ptr; }
1072 { yyval = yystack.l_mark[-2]; }
1077 yyval = scon_stk_ptr;
1079 for ( i = 1; i <= lastsc; ++i )
1083 for ( j = 1; j <= scon_stk_ptr; ++j )
1084 if ( scon_stk[j] == i )
1087 if ( j > scon_stk_ptr )
1088 scon_stk[++scon_stk_ptr] = i;
1094 { yyval = scon_stk_ptr; }
1098 { synerr( _("bad start condition list") ); }
1103 if ( (scnum = sclookup( nmstr )) == 0 )
1104 format_pinpoint_message(
1105 "undeclared start condition %s",
1109 for ( i = 1; i <= scon_stk_ptr; ++i )
1110 if ( scon_stk[i] == scnum )
1113 "<%s> specified twice",
1118 if ( i > scon_stk_ptr )
1119 scon_stk[++scon_stk_ptr] = scnum;
1126 if ( transchar[lastst[yystack.l_mark[0]]] != SYM_EPSILON )
1127 /* Provide final transition \now/ so it
1128 * will be marked as a trailing context
1131 yystack.l_mark[0] = link_machines( yystack.l_mark[0],
1132 mkstate( SYM_EPSILON ) );
1134 mark_beginning_as_normal( yystack.l_mark[0] );
1135 current_state_type = STATE_NORMAL;
1137 if ( previous_continued_action )
1139 /* We need to treat this as variable trailing
1140 * context so that the backup does not happen
1141 * in the action but before the action switch
1142 * statement. If the backup happens in the
1143 * action, then the rules "falling into" this
1144 * one's action will *also* do the backup,
1147 if ( ! varlength || headcnt != 0 )
1149 "trailing context made variable due to preceding '|' action" );
1151 /* Mark as variable. */
1157 if ( lex_compat || (varlength && headcnt == 0) )
1158 { /* variable trailing context rule */
1159 /* Mark the first part of the rule as the
1160 * accepting "head" part of a trailing
1163 * By the way, we didn't do this at the
1164 * beginning of this production because back
1165 * then current_state_type was set up for a
1166 * trail rule, and add_accept() can create
1169 add_accept( yystack.l_mark[-1],
1170 num_rules | YY_TRAILING_HEAD_MASK );
1171 variable_trail_rule = true;
1177 yyval = link_machines( yystack.l_mark[-1], yystack.l_mark[0] );
1182 { synerr( _("trailing context used twice") ); }
1192 current_state_type = STATE_TRAILING_CONTEXT;
1196 synerr( _("trailing context used twice") );
1197 yyval = mkstate( SYM_EPSILON );
1200 else if ( previous_continued_action )
1202 /* See the comment in the rule for "re2 re"
1206 "trailing context made variable due to preceding '|' action" );
1211 if ( lex_compat || varlength )
1213 /* Again, see the comment in the rule for
1216 add_accept( yystack.l_mark[-1],
1217 num_rules | YY_TRAILING_HEAD_MASK );
1218 variable_trail_rule = true;
1223 eps = mkstate( SYM_EPSILON );
1224 yyval = link_machines( yystack.l_mark[-1],
1225 link_machines( eps, mkstate( '\n' ) ) );
1231 yyval = yystack.l_mark[0];
1235 if ( lex_compat || (varlength && headcnt == 0) )
1236 /* Both head and trail are
1239 variable_trail_rule = true;
1249 yyval = mkor( yystack.l_mark[-2], yystack.l_mark[0] );
1254 { yyval = yystack.l_mark[0]; }
1259 /* This rule is written separately so the
1260 * reduction will occur before the trailing
1265 synerr( _("trailing context used twice") );
1270 /* We hope the trailing context is
1279 current_state_type = STATE_TRAILING_CONTEXT;
1280 yyval = yystack.l_mark[-1];
1286 /* This is where concatenation of adjacent patterns
1289 yyval = link_machines( yystack.l_mark[-1], yystack.l_mark[0] );
1294 { yyval = yystack.l_mark[0]; }
1301 if ( yystack.l_mark[-3] > yystack.l_mark[-1] || yystack.l_mark[-3] < 0 )
1303 synerr( _("bad iteration values") );
1304 yyval = yystack.l_mark[-5];
1308 if ( yystack.l_mark[-3] == 0 )
1310 if ( yystack.l_mark[-1] <= 0 )
1313 _("bad iteration values") );
1314 yyval = yystack.l_mark[-5];
1318 mkrep( yystack.l_mark[-5], 1, yystack.l_mark[-1] ) );
1321 yyval = mkrep( yystack.l_mark[-5], yystack.l_mark[-3], yystack.l_mark[-1] );
1330 if ( yystack.l_mark[-2] <= 0 )
1332 synerr( _("iteration value must be positive") );
1333 yyval = yystack.l_mark[-4];
1337 yyval = mkrep( yystack.l_mark[-4], yystack.l_mark[-2], INFINITE_REPEAT );
1343 /* The series could be something like "(foo)",
1344 * in which case we have no idea what its length
1345 * is, so we punt here.
1349 if ( yystack.l_mark[-1] <= 0 )
1351 synerr( _("iteration value must be positive")
1353 yyval = yystack.l_mark[-3];
1357 yyval = link_machines( yystack.l_mark[-3],
1358 copysingl( yystack.l_mark[-3], yystack.l_mark[-1] - 1 ) );
1366 yyval = mkclos( yystack.l_mark[-1] );
1373 yyval = mkposcl( yystack.l_mark[-1] );
1380 yyval = mkopt( yystack.l_mark[-1] );
1388 if ( yystack.l_mark[-3] > yystack.l_mark[-1] || yystack.l_mark[-3] < 0 )
1390 synerr( _("bad iteration values") );
1391 yyval = yystack.l_mark[-5];
1395 if ( yystack.l_mark[-3] == 0 )
1397 if ( yystack.l_mark[-1] <= 0 )
1400 _("bad iteration values") );
1401 yyval = yystack.l_mark[-5];
1405 mkrep( yystack.l_mark[-5], 1, yystack.l_mark[-1] ) );
1408 yyval = mkrep( yystack.l_mark[-5], yystack.l_mark[-3], yystack.l_mark[-1] );
1417 if ( yystack.l_mark[-2] <= 0 )
1419 synerr( _("iteration value must be positive") );
1420 yyval = yystack.l_mark[-4];
1424 yyval = mkrep( yystack.l_mark[-4], yystack.l_mark[-2], INFINITE_REPEAT );
1430 /* The singleton could be something like "(foo)",
1431 * in which case we have no idea what its length
1432 * is, so we punt here.
1436 if ( yystack.l_mark[-1] <= 0 )
1438 synerr( _("iteration value must be positive") );
1439 yyval = yystack.l_mark[-3];
1443 yyval = link_machines( yystack.l_mark[-3],
1444 copysingl( yystack.l_mark[-3], yystack.l_mark[-1] - 1 ) );
1452 /* Create the '.' character class. */
1454 ccladd( ccldot, '\n' );
1455 cclnegate( ccldot );
1458 mkeccl( ccltbl + cclmap[ccldot],
1459 ccllen[ccldot], nextecm,
1460 ecgroup, csize, csize );
1462 /* Create the (?s:'.') character class. */
1464 cclnegate( cclany );
1467 mkeccl( ccltbl + cclmap[cclany],
1468 ccllen[cclany], nextecm,
1469 ecgroup, csize, csize );
1477 yyval = mkstate( -cclany );
1479 yyval = mkstate( -ccldot );
1485 /* Sort characters for fast searching.
1487 qsort( ccltbl + cclmap[yystack.l_mark[0]], (size_t) ccllen[yystack.l_mark[0]], sizeof (*ccltbl), cclcmp );
1490 mkeccl( ccltbl + cclmap[yystack.l_mark[0]], ccllen[yystack.l_mark[0]],
1491 nextecm, ecgroup, csize, csize );
1495 if (ccl_has_nl[yystack.l_mark[0]])
1496 rule_has_nl[num_rules] = true;
1498 yyval = mkstate( -yystack.l_mark[0] );
1506 if (ccl_has_nl[yystack.l_mark[0]])
1507 rule_has_nl[num_rules] = true;
1509 yyval = mkstate( -yystack.l_mark[0] );
1514 { yyval = yystack.l_mark[-1]; }
1518 { yyval = yystack.l_mark[-1]; }
1525 if (yystack.l_mark[0] == nlch)
1526 rule_has_nl[num_rules] = true;
1528 if (sf_case_ins() && has_case(yystack.l_mark[0]))
1529 /* create an alternation, as in (a|A) */
1530 yyval = mkor (mkstate(yystack.l_mark[0]), mkstate(reverse_case(yystack.l_mark[0])));
1532 yyval = mkstate( yystack.l_mark[0] );
1537 { yyval = ccl_set_diff (yystack.l_mark[-2], yystack.l_mark[0]); }
1541 { yyval = ccl_set_union (yystack.l_mark[-2], yystack.l_mark[0]); }
1545 { yyval = yystack.l_mark[-1]; }
1550 cclnegate( yystack.l_mark[-1] );
1551 yyval = yystack.l_mark[-1];
1561 /* If one end of the range has case and the other
1562 * does not, or the cases are different, then we're not
1563 * sure what range the user is trying to express.
1564 * Examples: [@-z] or [S-t]
1566 if (has_case (yystack.l_mark[-2]) != has_case (yystack.l_mark[0])
1567 || (has_case (yystack.l_mark[-2]) && (b_islower (yystack.l_mark[-2]) != b_islower (yystack.l_mark[0])))
1568 || (has_case (yystack.l_mark[-2]) && (b_isupper (yystack.l_mark[-2]) != b_isupper (yystack.l_mark[0]))))
1570 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1571 yystack.l_mark[-2], yystack.l_mark[0]);
1573 /* If the range spans uppercase characters but not
1574 * lowercase (or vice-versa), then should we automatically
1575 * include lowercase characters in the range?
1576 * Example: [@-_] spans [a-z] but not [A-Z]
1578 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]))
1580 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1581 yystack.l_mark[-2], yystack.l_mark[0]);
1584 if ( yystack.l_mark[-2] > yystack.l_mark[0] )
1585 synerr( _("negative range in character class") );
1589 for ( i = yystack.l_mark[-2]; i <= yystack.l_mark[0]; ++i )
1590 ccladd( yystack.l_mark[-3], i );
1592 /* Keep track if this ccl is staying in
1593 * alphabetical order.
1595 cclsorted = cclsorted && (yystack.l_mark[-2] > lastchar);
1596 lastchar = yystack.l_mark[0];
1598 /* Do it again for upper/lowercase */
1599 if (sf_case_ins() && has_case(yystack.l_mark[-2]) && has_case(yystack.l_mark[0])){
1600 yystack.l_mark[-2] = reverse_case (yystack.l_mark[-2]);
1601 yystack.l_mark[0] = reverse_case (yystack.l_mark[0]);
1603 for ( i = yystack.l_mark[-2]; i <= yystack.l_mark[0]; ++i )
1604 ccladd( yystack.l_mark[-3], i );
1606 cclsorted = cclsorted && (yystack.l_mark[-2] > lastchar);
1607 lastchar = yystack.l_mark[0];
1612 yyval = yystack.l_mark[-3];
1618 ccladd( yystack.l_mark[-1], yystack.l_mark[0] );
1619 cclsorted = cclsorted && (yystack.l_mark[0] > lastchar);
1620 lastchar = yystack.l_mark[0];
1622 /* Do it again for upper/lowercase */
1623 if (sf_case_ins() && has_case(yystack.l_mark[0])){
1624 yystack.l_mark[0] = reverse_case (yystack.l_mark[0]);
1625 ccladd (yystack.l_mark[-1], yystack.l_mark[0]);
1627 cclsorted = cclsorted && (yystack.l_mark[0] > lastchar);
1628 lastchar = yystack.l_mark[0];
1631 yyval = yystack.l_mark[-1];
1637 /* Too hard to properly maintain cclsorted. */
1639 yyval = yystack.l_mark[-1];
1647 currccl = yyval = cclinit();
1652 { CCL_EXPR(isalnum); }
1656 { CCL_EXPR(isalpha); }
1660 { CCL_EXPR(IS_BLANK); }
1664 { CCL_EXPR(iscntrl); }
1668 { CCL_EXPR(isdigit); }
1672 { CCL_EXPR(isgraph); }
1684 { CCL_EXPR(isprint); }
1688 { CCL_EXPR(ispunct); }
1692 { CCL_EXPR(isspace); }
1696 { CCL_EXPR(isxdigit); }
1708 { CCL_NEG_EXPR(isalnum); }
1712 { CCL_NEG_EXPR(isalpha); }
1716 { CCL_NEG_EXPR(IS_BLANK); }
1720 { CCL_NEG_EXPR(iscntrl); }
1724 { CCL_NEG_EXPR(isdigit); }
1728 { CCL_NEG_EXPR(isgraph); }
1732 { CCL_NEG_EXPR(isprint); }
1736 { CCL_NEG_EXPR(ispunct); }
1740 { CCL_NEG_EXPR(isspace); }
1744 { CCL_NEG_EXPR(isxdigit); }
1749 if ( sf_case_ins() )
1750 lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
1752 CCL_NEG_EXPR(islower);
1758 if ( sf_case_ins() )
1759 lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
1761 CCL_NEG_EXPR(isupper);
1767 if ( yystack.l_mark[0] == nlch )
1768 rule_has_nl[num_rules] = true;
1772 if (sf_case_ins() && has_case(yystack.l_mark[0]))
1773 yyval = mkor (mkstate(yystack.l_mark[0]), mkstate(reverse_case(yystack.l_mark[0])));
1775 yyval = mkstate (yystack.l_mark[0]);
1777 yyval = link_machines( yystack.l_mark[-1], yyval);
1782 { yyval = mkstate( SYM_EPSILON ); }
1784 #line 1782 "parse.c"
1786 yystack.s_mark -= yym;
1787 yystate = *yystack.s_mark;
1788 yystack.l_mark -= yym;
1790 if (yystate == 0 && yym == 0)
1794 printf("%sdebug: after reduction, shifting from state 0 to\
1795 state %d\n", YYPREFIX, YYFINAL);
1798 *++yystack.s_mark = YYFINAL;
1799 *++yystack.l_mark = yyval;
1803 if (yychar < 0) yychar = YYEOF;
1807 if ((yys = yyname[YYTRANSLATE(yychar)]) == NULL) yys = yyname[YYUNDFTOKEN];
1808 printf("%sdebug: state %d, reading %d (%s)\n",
1809 YYPREFIX, YYFINAL, yychar, yys);
1813 if (yychar == YYEOF) goto yyaccept;
1816 if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
1817 yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
1818 yystate = yytable[yyn];
1820 yystate = yydgoto[yym];
1823 printf("%sdebug: after reduction, shifting from state %d \
1824 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1826 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
1827 *++yystack.s_mark = (YYINT) yystate;
1828 *++yystack.l_mark = yyval;
1832 YYERROR_CALL("yacc stack overflow");
1835 yyfreestack(&yystack);
1839 yyfreestack(&yystack);