2 static const char yysccsid
[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
16 #define yyclearin (yychar = YYEMPTY)
17 #define yyerrok (yyerrflag = 0)
18 #define YYRECOVERING() (yyerrflag != 0)
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".
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 /* Parameters sent to yyerror. */
132 #define YYERROR_DECL() yyerror(const char *s)
135 #define YYERROR_CALL(msg) yyerror(msg)
138 extern int YYPARSE_DECL();
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 static const short yylhs
[] = { -1,
188 0, 1, 2, 2, 2, 2, 3, 6, 6, 7,
189 7, 7, 8, 9, 9, 10, 10, 10, 10, 10,
190 10, 4, 4, 4, 5, 12, 12, 12, 12, 14,
191 11, 11, 11, 15, 15, 15, 16, 13, 13, 13,
192 13, 18, 18, 17, 19, 19, 19, 19, 19, 20,
193 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
194 20, 21, 21, 21, 23, 23, 24, 24, 24, 24,
195 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
196 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
197 25, 25, 25, 25, 22, 22,
199 static const short yylen
[] = { 2,
200 5, 0, 3, 2, 0, 1, 1, 1, 1, 2,
201 1, 1, 2, 2, 0, 3, 3, 3, 3, 3,
202 3, 5, 5, 0, 0, 2, 1, 1, 1, 0,
203 4, 3, 0, 3, 1, 1, 1, 2, 3, 2,
204 1, 3, 1, 2, 2, 1, 6, 5, 4, 2,
205 2, 2, 6, 5, 4, 1, 1, 1, 3, 3,
206 1, 3, 3, 1, 3, 4, 4, 2, 2, 0,
207 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
208 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
211 static const short yydefred
[] = { 2,
212 0, 0, 6, 0, 7, 8, 9, 15, 24, 0,
213 4, 0, 0, 12, 11, 0, 0, 0, 0, 0,
214 0, 0, 14, 0, 1, 0, 10, 0, 0, 0,
215 0, 0, 0, 0, 0, 24, 0, 16, 18, 19,
216 20, 17, 21, 32, 36, 37, 0, 35, 0, 29,
217 61, 58, 28, 0, 56, 96, 0, 0, 0, 27,
218 0, 0, 0, 0, 0, 64, 31, 0, 23, 26,
219 0, 0, 70, 0, 22, 0, 40, 0, 44, 0,
220 0, 0, 50, 51, 52, 0, 0, 34, 95, 59,
221 60, 0, 0, 71, 72, 73, 74, 75, 76, 77,
222 78, 79, 80, 82, 81, 83, 84, 85, 86, 87,
223 88, 93, 89, 90, 91, 94, 92, 65, 69, 39,
224 0, 0, 0, 62, 63, 66, 0, 49, 0, 55,
225 0, 67, 0, 48, 0, 54, 47, 53,
227 static const short yydgoto
[] = { 1,
228 2, 4, 9, 13, 25, 10, 16, 11, 12, 23,
229 26, 59, 60, 35, 47, 48, 61, 62, 63, 64,
232 static const short yysindex
[] = { 0,
233 0, -222, 0, -155, 0, 0, 0, 0, 0, -215,
234 0, -123, 6, 0, 0, -193, 10, 21, 26, 31,
235 35, 37, 0, 59, 0, -44, 0, -147, -145, -140,
236 -133, -132, -129, 75, -214, 0, -19, 0, 0, 0,
237 0, 0, 0, 0, 0, 0, 23, 0, -48, 0,
238 0, 0, 0, -17, 0, 0, -17, 27, 128, 0,
239 -17, -1, -30, -41, -189, 0, 0, -121, 0, 0,
240 -31, -34, 0, -87, 0, -25, 0, -17, 0, -109,
241 -41, -108, 0, 0, 0, 60, 60, 0, 0, 0,
242 0, 46, 107, 0, 0, 0, 0, 0, 0, 0,
243 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
244 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
245 -30, -36, -39, 0, 0, 0, -104, 0, -219, 0,
246 -238, 0, -144, 0, -143, 0, 0, 0,
248 static const short yyrindex
[] = { 0,
249 0, -141, 0, 0, 0, 0, 0, 0, 0, 0,
250 0, -134, 9, 0, 0, -125, 0, 0, 0, 0,
251 0, 0, 0, -178, 0, 22, 0, 0, 0, 0,
252 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
253 0, 0, 0, 0, 0, 0, 0, 0, -21, 0,
254 0, 0, 0, 0, 0, 0, 0, 85, 0, 0,
255 0, 144, 47, 4, -10, 0, 0, 0, 0, 0,
256 0, 0, 0, 0, 0, 146, 0, 0, 0, 0,
257 18, 0, 0, 0, 0, 0, 0, 0, 0, 0,
258 0, 0, 124, 0, 0, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
260 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
261 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
262 0, 0, 0, 0, 0, 0, 0, 0,
264 static const short yygindex
[] = { 0,
265 0, 0, 0, 121, 133, 0, 0, 0, 0, 0,
266 0, 0, 106, 0, 0, 93, 0, 32, 84, -45,
269 #define YYTABLESIZE 419
270 static const short yytable
[] = { 57,
271 83, 84, 90, 56, 131, 118, 91, 129, 25, 57,
272 120, 24, 33, 46, 56, 55, 56, 81, 33, 135,
273 57, 85, 57, 57, 33, 57, 55, 45, 55, 57,
274 57, 57, 57, 3, 77, 57, 57, 46, 133, 46,
275 14, 45, 33, 46, 46, 79, 15, 46, 33, 46,
276 46, 45, 57, 45, 33, 25, 43, 45, 45, 42,
277 58, 25, 136, 45, 45, 24, 68, 25, 27, 33,
278 28, 58, 33, 58, 54, 81, 69, 30, 36, 134,
279 57, 29, 43, 30, 67, 42, 30, 43, 72, 78,
280 42, 31, 76, 43, 46, 32, 42, 33, 78, 33,
281 34, 33, 33, 5, 6, 7, 86, 87, 45, 8,
282 124, 125, 25, 57, 38, 25, 39, 5, 5, 5,
283 73, 40, 78, 5, 13, 13, 13, 46, 41, 42,
284 13, 33, 43, 3, 3, 3, 44, 75, 126, 3,
285 46, 45, 17, 18, 19, 20, 21, 22, 122, 123,
286 58, 127, 132, 41, 137, 38, 49, 138, 37, 70,
287 88, 121, 92, 0, 0, 0, 0, 0, 0, 93,
288 43, 0, 0, 42, 0, 0, 0, 70, 0, 0,
289 0, 0, 0, 0, 94, 95, 96, 97, 98, 99,
290 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
291 110, 111, 112, 113, 114, 115, 116, 117, 0, 0,
292 0, 0, 0, 0, 0, 0, 68, 0, 0, 0,
293 0, 0, 0, 0, 0, 89, 51, 0, 0, 0,
294 0, 0, 52, 0, 33, 33, 50, 51, 0, 51,
295 0, 33, 33, 52, 53, 52, 57, 0, 0, 0,
296 0, 0, 57, 0, 0, 0, 0, 0, 82, 0,
297 46, 130, 128, 0, 33, 33, 46, 80, 0, 0,
298 0, 33, 33, 0, 45, 0, 0, 25, 25, 0,
299 45, 0, 0, 0, 25, 25, 0, 57, 0, 57,
300 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
301 0, 46, 93, 0, 0, 0, 0, 0, 0, 0,
302 0, 0, 0, 0, 0, 45, 0, 94, 95, 96,
303 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
304 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
305 117, 70, 0, 0, 0, 0, 0, 0, 0, 0,
306 0, 0, 0, 0, 0, 0, 70, 70, 70, 70,
307 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
308 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
309 68, 0, 0, 0, 0, 0, 0, 0, 0, 0,
310 0, 0, 0, 0, 0, 68, 68, 68, 68, 68,
311 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
312 68, 68, 68, 68, 68, 68, 68, 68, 68,
314 static const short yycheck
[] = { 10,
315 42, 43, 34, 34, 44, 93, 41, 44, 0, 40,
316 36, 60, 34, 10, 34, 46, 34, 63, 40, 258,
317 40, 63, 40, 34, 46, 36, 46, 10, 46, 40,
318 41, 42, 43, 256, 36, 46, 47, 34, 258, 36,
319 256, 256, 34, 40, 41, 47, 262, 262, 40, 46,
320 47, 34, 63, 36, 46, 34, 10, 40, 41, 10,
321 91, 40, 301, 46, 47, 60, 44, 46, 262, 91,
322 61, 91, 94, 91, 94, 121, 125, 256, 123, 299,
323 91, 61, 36, 262, 62, 36, 61, 41, 57, 124,
324 41, 61, 61, 47, 91, 61, 47, 61, 124, 91,
325 42, 123, 94, 259, 260, 261, 296, 297, 91, 265,
326 86, 87, 91, 124, 262, 94, 262, 259, 260, 261,
327 94, 262, 124, 265, 259, 260, 261, 124, 262, 262,
328 265, 123, 262, 259, 260, 261, 62, 10, 93, 265,
329 262, 124, 266, 267, 268, 269, 270, 271, 258, 258,
330 91, 45, 257, 10, 299, 10, 36, 301, 26, 54,
331 68, 78, 73, -1, -1, -1, -1, -1, -1, 257,
332 124, -1, -1, 124, -1, -1, -1, 93, -1, -1,
333 -1, -1, -1, -1, 272, 273, 274, 275, 276, 277,
334 278, 279, 280, 281, 282, 283, 284, 285, 286, 287,
335 288, 289, 290, 291, 292, 293, 294, 295, -1, -1,
336 -1, -1, -1, -1, -1, -1, 93, -1, -1, -1,
337 -1, -1, -1, -1, -1, 257, 257, -1, -1, -1,
338 -1, -1, 263, -1, 256, 257, 256, 257, -1, 257,
339 -1, 263, 264, 263, 264, 263, 257, -1, -1, -1,
340 -1, -1, 263, -1, -1, -1, -1, -1, 300, -1,
341 257, 301, 299, -1, 256, 257, 263, 298, -1, -1,
342 -1, 263, 264, -1, 257, -1, -1, 256, 257, -1,
343 263, -1, -1, -1, 263, 264, -1, 298, -1, 300,
344 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
345 -1, 298, 257, -1, -1, -1, -1, -1, -1, -1,
346 -1, -1, -1, -1, -1, 298, -1, 272, 273, 274,
347 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
348 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
349 295, 257, -1, -1, -1, -1, -1, -1, -1, -1,
350 -1, -1, -1, -1, -1, -1, 272, 273, 274, 275,
351 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
352 286, 287, 288, 289, 290, 291, 292, 293, 294, 295,
353 257, -1, -1, -1, -1, -1, -1, -1, -1, -1,
354 -1, -1, -1, -1, -1, 272, 273, 274, 275, 276,
355 277, 278, 279, 280, 281, 282, 283, 284, 285, 286,
356 287, 288, 289, 290, 291, 292, 293, 294, 295,
362 #define YYMAXTOKEN 301
364 static const char *yyname
[] = {
366 "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,
367 0,0,0,"'\"'",0,"'$'",0,0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,
368 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,
369 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,
370 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,
371 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,
372 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,
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,"CHAR","NUMBER","SECTEND",
374 "SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","OPTION_OP","OPT_OUTFILE",
375 "OPT_PREFIX","OPT_YYCLASS","OPT_HEADER","OPT_EXTRA_TYPE","OPT_TABLES",
376 "CCE_ALNUM","CCE_ALPHA","CCE_BLANK","CCE_CNTRL","CCE_DIGIT","CCE_GRAPH",
377 "CCE_LOWER","CCE_PRINT","CCE_PUNCT","CCE_SPACE","CCE_UPPER","CCE_XDIGIT",
378 "CCE_NEG_ALNUM","CCE_NEG_ALPHA","CCE_NEG_BLANK","CCE_NEG_CNTRL","CCE_NEG_DIGIT",
379 "CCE_NEG_GRAPH","CCE_NEG_LOWER","CCE_NEG_PRINT","CCE_NEG_PUNCT","CCE_NEG_SPACE",
380 "CCE_NEG_UPPER","CCE_NEG_XDIGIT","CCL_OP_DIFF","CCL_OP_UNION",
381 "BEGIN_REPEAT_POSIX","END_REPEAT_POSIX","BEGIN_REPEAT_FLEX","END_REPEAT_FLEX",
383 static const char *yyrule
[] = {
385 "goal : initlex sect1 sect1end sect2 initforrule",
387 "sect1 : sect1 startconddecl namelist1",
388 "sect1 : sect1 options",
391 "sect1end : SECTEND",
392 "startconddecl : SCDECL",
393 "startconddecl : XSCDECL",
394 "namelist1 : namelist1 NAME",
397 "options : OPTION_OP optionlist",
398 "optionlist : optionlist option",
400 "option : OPT_OUTFILE '=' NAME",
401 "option : OPT_EXTRA_TYPE '=' NAME",
402 "option : OPT_PREFIX '=' NAME",
403 "option : OPT_YYCLASS '=' NAME",
404 "option : OPT_HEADER '=' NAME",
405 "option : OPT_TABLES '=' NAME",
406 "sect2 : sect2 scon initforrule flexrule '\\n'",
407 "sect2 : sect2 scon '{' sect2 '}'",
410 "flexrule : '^' rule",
415 "scon : '<' scon_stk_ptr namelist2 '>'",
416 "scon : '<' '*' '>'",
418 "namelist2 : namelist2 ',' sconname",
419 "namelist2 : sconname",
426 "re : re '|' series",
429 "series : series singleton",
430 "series : singleton",
431 "series : series BEGIN_REPEAT_POSIX NUMBER ',' NUMBER END_REPEAT_POSIX",
432 "series : series BEGIN_REPEAT_POSIX NUMBER ',' END_REPEAT_POSIX",
433 "series : series BEGIN_REPEAT_POSIX NUMBER END_REPEAT_POSIX",
434 "singleton : singleton '*'",
435 "singleton : singleton '+'",
436 "singleton : singleton '?'",
437 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' NUMBER END_REPEAT_FLEX",
438 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' END_REPEAT_FLEX",
439 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER END_REPEAT_FLEX",
441 "singleton : fullccl",
442 "singleton : PREVCCL",
443 "singleton : '\"' string '\"'",
444 "singleton : '(' re ')'",
446 "fullccl : fullccl CCL_OP_DIFF braceccl",
447 "fullccl : fullccl CCL_OP_UNION braceccl",
448 "fullccl : braceccl",
449 "braceccl : '[' ccl ']'",
450 "braceccl : '[' '^' ccl ']'",
451 "ccl : ccl CHAR '-' CHAR",
453 "ccl : ccl ccl_expr",
455 "ccl_expr : CCE_ALNUM",
456 "ccl_expr : CCE_ALPHA",
457 "ccl_expr : CCE_BLANK",
458 "ccl_expr : CCE_CNTRL",
459 "ccl_expr : CCE_DIGIT",
460 "ccl_expr : CCE_GRAPH",
461 "ccl_expr : CCE_LOWER",
462 "ccl_expr : CCE_PRINT",
463 "ccl_expr : CCE_PUNCT",
464 "ccl_expr : CCE_SPACE",
465 "ccl_expr : CCE_XDIGIT",
466 "ccl_expr : CCE_UPPER",
467 "ccl_expr : CCE_NEG_ALNUM",
468 "ccl_expr : CCE_NEG_ALPHA",
469 "ccl_expr : CCE_NEG_BLANK",
470 "ccl_expr : CCE_NEG_CNTRL",
471 "ccl_expr : CCE_NEG_DIGIT",
472 "ccl_expr : CCE_NEG_GRAPH",
473 "ccl_expr : CCE_NEG_PRINT",
474 "ccl_expr : CCE_NEG_PUNCT",
475 "ccl_expr : CCE_NEG_SPACE",
476 "ccl_expr : CCE_NEG_XDIGIT",
477 "ccl_expr : CCE_NEG_LOWER",
478 "ccl_expr : CCE_NEG_UPPER",
479 "string : string CHAR",
493 /* define the initial stack-sizes */
496 #define YYMAXDEPTH YYSTACKSIZE
499 #define YYSTACKSIZE YYMAXDEPTH
501 #define YYSTACKSIZE 500
502 #define YYMAXDEPTH 500
506 #define YYINITSTACKSIZE 500
516 /* variables for the parser stack */
517 static YYSTACKDATA yystack
;
520 /* build_eof_action - build the "<<EOF>>" action for the active start
524 void build_eof_action()
527 char action_text
[MAXLINE
];
529 for ( i
= 1; i
<= scon_stk_ptr
; ++i
)
531 if ( sceof
[scon_stk
[i
]] )
532 format_pinpoint_message(
533 "multiple <<EOF>> rules for start condition %s",
534 scname
[scon_stk
[i
]] );
538 sceof
[scon_stk
[i
]] = true;
540 if (previous_continued_action
/* && previous action was regular */)
541 add_action("YY_RULE_SETUP\n");
543 snprintf( action_text
, sizeof(action_text
), "case YY_STATE_EOF(%s):\n",
544 scname
[scon_stk
[i
]] );
545 add_action( action_text
);
549 line_directive_out( (FILE *) 0, 1 );
551 /* This isn't a normal rule after all - don't count it as
552 * such, so we don't have any holes in the rule numbering
553 * (which make generating "rule can never match" warnings
561 /* format_synerr - write out formatted syntax error */
563 void format_synerr( msg
, arg
)
564 const char *msg
, arg
[];
566 char errmsg
[MAXLINE
];
568 (void) snprintf( errmsg
, sizeof(errmsg
), msg
, arg
);
573 /* synerr - report a syntax error */
579 pinpoint_message( str
);
583 /* format_warn - write out formatted warning */
585 void format_warn( msg
, arg
)
586 const char *msg
, arg
[];
588 char warn_msg
[MAXLINE
];
590 snprintf( warn_msg
, sizeof(warn_msg
), msg
, arg
);
595 /* lwarn - report a warning, unless -w was given */
600 line_warning( str
, linenum
);
603 /* format_pinpoint_message - write out a message formatted with one string,
604 * pinpointing its location
607 void format_pinpoint_message( msg
, arg
)
608 const char *msg
, arg
[];
610 char errmsg
[MAXLINE
];
612 snprintf( errmsg
, sizeof(errmsg
), msg
, arg
);
613 pinpoint_message( errmsg
);
617 /* pinpoint_message - write out a message, pinpointing its location */
619 void pinpoint_message( str
)
622 line_pinpoint( str
, linenum
);
626 /* line_warning - report a warning at a given line, unless -w was given */
628 void line_warning( str
, 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( str
, line
)
648 fprintf( stderr
, "%s:%d: %s\n", infilename
, line
, str
);
652 /* yyerror - eat up an error message from the parser;
653 * currently, messages are ignore
662 #include <stdio.h> /* needed for printf */
665 #include <stdlib.h> /* needed for malloc, etc */
666 #include <string.h> /* needed for memset */
668 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
669 static int yygrowstack(YYSTACKDATA
*data
)
676 if ((newsize
= data
->stacksize
) == 0)
677 newsize
= YYINITSTACKSIZE
;
678 else if (newsize
>= YYMAXDEPTH
)
680 else if ((newsize
*= 2) > YYMAXDEPTH
)
681 newsize
= YYMAXDEPTH
;
683 i
= (int) (data
->s_mark
- data
->s_base
);
684 newss
= (short *)realloc(data
->s_base
, newsize
* sizeof(*newss
));
688 data
->s_base
= newss
;
689 data
->s_mark
= newss
+ i
;
691 newvs
= (YYSTYPE
*)realloc(data
->l_base
, newsize
* sizeof(*newvs
));
695 data
->l_base
= newvs
;
696 data
->l_mark
= newvs
+ i
;
698 data
->stacksize
= newsize
;
699 data
->s_last
= data
->s_base
+ newsize
- 1;
703 #if YYPURE || defined(YY_NO_LEAKS)
704 static void yyfreestack(YYSTACKDATA
*data
)
708 memset(data
, 0, sizeof(*data
));
711 #define yyfreestack(data) /* nothing */
714 #define YYABORT goto yyabort
715 #define YYREJECT goto yyabort
716 #define YYACCEPT goto yyaccept
717 #define YYERROR goto yyerrlab
722 int yym
, yyn
, yystate
;
726 if ((yys
= getenv("YYDEBUG")) != 0)
729 if (yyn
>= '0' && yyn
<= '9')
740 memset(&yystack
, 0, sizeof(yystack
));
743 if (yystack
.s_base
== NULL
&& yygrowstack(&yystack
)) goto yyoverflow
;
744 yystack
.s_mark
= yystack
.s_base
;
745 yystack
.l_mark
= yystack
.l_base
;
750 if ((yyn
= yydefred
[yystate
]) != 0) goto yyreduce
;
753 if ((yychar
= YYLEX
) < 0) yychar
= 0;
758 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
759 if (!yys
) yys
= "illegal-symbol";
760 printf("%sdebug: state %d, reading %d (%s)\n",
761 YYPREFIX
, yystate
, yychar
, yys
);
765 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
766 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == 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
))
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
]) && (yyn
+= yychar
) >= 0 &&
785 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
790 if (yyerrflag
) goto yyinrecovery
;
792 yyerror("syntax error");
805 if ((yyn
= yysindex
[*yystack
.s_mark
]) && (yyn
+= YYERRCODE
) >= 0 &&
806 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
810 printf("%sdebug: state %d, error recovery shifting\
811 to state %d\n", YYPREFIX
, *yystack
.s_mark
, yytable
[yyn
]);
813 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
817 yystate
= yytable
[yyn
];
818 *++yystack
.s_mark
= yytable
[yyn
];
819 *++yystack
.l_mark
= yylval
;
826 printf("%sdebug: error recovery discarding state %d\n",
827 YYPREFIX
, *yystack
.s_mark
);
829 if (yystack
.s_mark
<= yystack
.s_base
) goto yyabort
;
837 if (yychar
== 0) goto yyabort
;
842 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
843 if (!yys
) yys
= "illegal-symbol";
844 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
845 YYPREFIX
, yystate
, yychar
, yys
);
855 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
856 YYPREFIX
, yystate
, yyn
, yyrule
[yyn
]);
860 yyval
= yystack
.l_mark
[1-yym
];
862 memset(&yyval
, 0, sizeof yyval
);
866 { /* add default rule */
872 def_rule
= mkstate( -pat
);
874 /* Remember the number of the default rule so we
875 * don't generate "can't match" warnings for it.
877 default_rule
= num_rules
;
879 finish_rule( def_rule
, false, 0, 0, 0);
881 for ( i
= 1; i
<= lastsc
; ++i
)
882 scset
[i
] = mkbranch( scset
[i
], def_rule
);
886 "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
888 add_action( "ECHO" );
890 add_action( ";\n\tYY_BREAK\n" );
894 { /* initialize for processing rules */
896 /* Create default DFA start condition. */
897 scinstal( "INITIAL", false );
901 { synerr( _("unknown error processing section 1") ); }
906 scon_stk
= allocate_integer_array( lastsc
+ 1 );
917 { scinstal( nmstr
, xcluflg
); }
920 { scinstal( nmstr
, xcluflg
); }
923 { synerr( _("bad start condition list") ); }
927 outfilename
= copy_string( nmstr
);
932 { extra_type
= copy_string( nmstr
); }
935 { prefix
= copy_string( nmstr
); }
938 { yyclass
= copy_string( nmstr
); }
941 { headerfilename
= copy_string( nmstr
); }
944 { tablesext
= true; tablesfilename
= copy_string( nmstr
); }
947 { scon_stk_ptr
= yystack
.l_mark
[-3]; }
950 { scon_stk_ptr
= yystack
.l_mark
[-3]; }
954 /* Initialize for a parse of one rule. */
955 trlcontxt
= variable_trail_rule
= varlength
= false;
956 trailcnt
= headcnt
= rulelen
= 0;
957 current_state_type
= STATE_NORMAL
;
958 previous_continued_action
= continued_action
;
966 pat
= yystack
.l_mark
[0];
967 finish_rule( pat
, variable_trail_rule
,
968 headcnt
, trailcnt
, previous_continued_action
);
970 if ( scon_stk_ptr
> 0 )
972 for ( i
= 1; i
<= scon_stk_ptr
; ++i
)
974 mkbranch( scbol
[scon_stk
[i
]],
980 /* Add to all non-exclusive start conditions,
981 * including the default (0) start condition.
984 for ( i
= 1; i
<= lastsc
; ++i
)
986 scbol
[i
] = mkbranch( scbol
[i
],
994 if ( performance_report
> 1 )
996 "'^' operator results in sub-optimal performance" );
1002 pat
= yystack
.l_mark
[0];
1003 finish_rule( pat
, variable_trail_rule
,
1004 headcnt
, trailcnt
, previous_continued_action
);
1006 if ( scon_stk_ptr
> 0 )
1008 for ( i
= 1; i
<= scon_stk_ptr
; ++i
)
1009 scset
[scon_stk
[i
]] =
1010 mkbranch( scset
[scon_stk
[i
]],
1016 for ( i
= 1; i
<= lastsc
; ++i
)
1026 if ( scon_stk_ptr
> 0 )
1031 /* This EOF applies to all start conditions
1032 * which don't already have EOF actions.
1034 for ( i
= 1; i
<= lastsc
; ++i
)
1036 scon_stk
[++scon_stk_ptr
] = i
;
1038 if ( scon_stk_ptr
== 0 )
1040 "all start conditions already have <<EOF>> rules" );
1048 { synerr( _("unrecognized rule") ); }
1051 { yyval
= scon_stk_ptr
; }
1054 { yyval
= yystack
.l_mark
[-2]; }
1058 yyval
= scon_stk_ptr
;
1060 for ( i
= 1; i
<= lastsc
; ++i
)
1064 for ( j
= 1; j
<= scon_stk_ptr
; ++j
)
1065 if ( scon_stk
[j
] == i
)
1068 if ( j
> scon_stk_ptr
)
1069 scon_stk
[++scon_stk_ptr
] = i
;
1074 { yyval
= scon_stk_ptr
; }
1077 { synerr( _("bad start condition list") ); }
1081 if ( (scnum
= sclookup( nmstr
)) == 0 )
1082 format_pinpoint_message(
1083 "undeclared start condition %s",
1087 for ( i
= 1; i
<= scon_stk_ptr
; ++i
)
1088 if ( scon_stk
[i
] == scnum
)
1091 "<%s> specified twice",
1096 if ( i
> scon_stk_ptr
)
1097 scon_stk
[++scon_stk_ptr
] = scnum
;
1103 if ( transchar
[lastst
[yystack
.l_mark
[0]]] != SYM_EPSILON
)
1104 /* Provide final transition \now/ so it
1105 * will be marked as a trailing context
1108 yystack
.l_mark
[0] = link_machines( yystack
.l_mark
[0],
1109 mkstate( SYM_EPSILON
) );
1111 mark_beginning_as_normal( yystack
.l_mark
[0] );
1112 current_state_type
= STATE_NORMAL
;
1114 if ( previous_continued_action
)
1116 /* We need to treat this as variable trailing
1117 * context so that the backup does not happen
1118 * in the action but before the action switch
1119 * statement. If the backup happens in the
1120 * action, then the rules "falling into" this
1121 * one's action will *also* do the backup,
1124 if ( ! varlength
|| headcnt
!= 0 )
1126 "trailing context made variable due to preceding '|' action" );
1128 /* Mark as variable. */
1134 if ( lex_compat
|| (varlength
&& headcnt
== 0) )
1135 { /* variable trailing context rule */
1136 /* Mark the first part of the rule as the
1137 * accepting "head" part of a trailing
1140 * By the way, we didn't do this at the
1141 * beginning of this production because back
1142 * then current_state_type was set up for a
1143 * trail rule, and add_accept() can create
1146 add_accept( yystack
.l_mark
[-1],
1147 num_rules
| YY_TRAILING_HEAD_MASK
);
1148 variable_trail_rule
= true;
1154 yyval
= link_machines( yystack
.l_mark
[-1], yystack
.l_mark
[0] );
1158 { synerr( _("trailing context used twice") ); }
1167 current_state_type
= STATE_TRAILING_CONTEXT
;
1171 synerr( _("trailing context used twice") );
1172 yyval
= mkstate( SYM_EPSILON
);
1175 else if ( previous_continued_action
)
1177 /* See the comment in the rule for "re2 re"
1181 "trailing context made variable due to preceding '|' action" );
1186 if ( lex_compat
|| varlength
)
1188 /* Again, see the comment in the rule for
1191 add_accept( yystack
.l_mark
[-1],
1192 num_rules
| YY_TRAILING_HEAD_MASK
);
1193 variable_trail_rule
= true;
1198 eps
= mkstate( SYM_EPSILON
);
1199 yyval
= link_machines( yystack
.l_mark
[-1],
1200 link_machines( eps
, mkstate( '\n' ) ) );
1205 yyval
= yystack
.l_mark
[0];
1209 if ( lex_compat
|| (varlength
&& headcnt
== 0) )
1210 /* Both head and trail are
1213 variable_trail_rule
= true;
1222 yyval
= mkor( yystack
.l_mark
[-2], yystack
.l_mark
[0] );
1226 { yyval
= yystack
.l_mark
[0]; }
1230 /* This rule is written separately so the
1231 * reduction will occur before the trailing
1236 synerr( _("trailing context used twice") );
1241 /* We hope the trailing context is
1250 current_state_type
= STATE_TRAILING_CONTEXT
;
1251 yyval
= yystack
.l_mark
[-1];
1256 /* This is where concatenation of adjacent patterns
1259 yyval
= link_machines( yystack
.l_mark
[-1], yystack
.l_mark
[0] );
1263 { yyval
= yystack
.l_mark
[0]; }
1269 if ( yystack
.l_mark
[-3] > yystack
.l_mark
[-1] || yystack
.l_mark
[-3] < 0 )
1271 synerr( _("bad iteration values") );
1272 yyval
= yystack
.l_mark
[-5];
1276 if ( yystack
.l_mark
[-3] == 0 )
1278 if ( yystack
.l_mark
[-1] <= 0 )
1281 _("bad iteration values") );
1282 yyval
= yystack
.l_mark
[-5];
1286 mkrep( yystack
.l_mark
[-5], 1, yystack
.l_mark
[-1] ) );
1289 yyval
= mkrep( yystack
.l_mark
[-5], yystack
.l_mark
[-3], yystack
.l_mark
[-1] );
1297 if ( yystack
.l_mark
[-2] <= 0 )
1299 synerr( _("iteration value must be positive") );
1300 yyval
= yystack
.l_mark
[-4];
1304 yyval
= mkrep( yystack
.l_mark
[-4], yystack
.l_mark
[-2], INFINITE_REPEAT
);
1309 /* The series could be something like "(foo)",
1310 * in which case we have no idea what its length
1311 * is, so we punt here.
1315 if ( yystack
.l_mark
[-1] <= 0 )
1317 synerr( _("iteration value must be positive")
1319 yyval
= yystack
.l_mark
[-3];
1323 yyval
= link_machines( yystack
.l_mark
[-3],
1324 copysingl( yystack
.l_mark
[-3], yystack
.l_mark
[-1] - 1 ) );
1331 yyval
= mkclos( yystack
.l_mark
[-1] );
1337 yyval
= mkposcl( yystack
.l_mark
[-1] );
1343 yyval
= mkopt( yystack
.l_mark
[-1] );
1350 if ( yystack
.l_mark
[-3] > yystack
.l_mark
[-1] || yystack
.l_mark
[-3] < 0 )
1352 synerr( _("bad iteration values") );
1353 yyval
= yystack
.l_mark
[-5];
1357 if ( yystack
.l_mark
[-3] == 0 )
1359 if ( yystack
.l_mark
[-1] <= 0 )
1362 _("bad iteration values") );
1363 yyval
= yystack
.l_mark
[-5];
1367 mkrep( yystack
.l_mark
[-5], 1, yystack
.l_mark
[-1] ) );
1370 yyval
= mkrep( yystack
.l_mark
[-5], yystack
.l_mark
[-3], yystack
.l_mark
[-1] );
1378 if ( yystack
.l_mark
[-2] <= 0 )
1380 synerr( _("iteration value must be positive") );
1381 yyval
= yystack
.l_mark
[-4];
1385 yyval
= mkrep( yystack
.l_mark
[-4], yystack
.l_mark
[-2], INFINITE_REPEAT
);
1390 /* The singleton could be something like "(foo)",
1391 * in which case we have no idea what its length
1392 * is, so we punt here.
1396 if ( yystack
.l_mark
[-1] <= 0 )
1398 synerr( _("iteration value must be positive") );
1399 yyval
= yystack
.l_mark
[-3];
1403 yyval
= link_machines( yystack
.l_mark
[-3],
1404 copysingl( yystack
.l_mark
[-3], yystack
.l_mark
[-1] - 1 ) );
1411 /* Create the '.' character class. */
1413 ccladd( ccldot
, '\n' );
1414 cclnegate( ccldot
);
1417 mkeccl( ccltbl
+ cclmap
[ccldot
],
1418 ccllen
[ccldot
], nextecm
,
1419 ecgroup
, csize
, csize
);
1421 /* Create the (?s:'.') character class. */
1423 cclnegate( cclany
);
1426 mkeccl( ccltbl
+ cclmap
[cclany
],
1427 ccllen
[cclany
], nextecm
,
1428 ecgroup
, csize
, csize
);
1436 yyval
= mkstate( -cclany
);
1438 yyval
= mkstate( -ccldot
);
1443 /* Sort characters for fast searching.
1445 qsort( ccltbl
+ cclmap
[yystack
.l_mark
[0]], ccllen
[yystack
.l_mark
[0]], sizeof (*ccltbl
), cclcmp
);
1448 mkeccl( ccltbl
+ cclmap
[yystack
.l_mark
[0]], ccllen
[yystack
.l_mark
[0]],
1449 nextecm
, ecgroup
, csize
, csize
);
1453 if (ccl_has_nl
[yystack
.l_mark
[0]])
1454 rule_has_nl
[num_rules
] = true;
1456 yyval
= mkstate( -yystack
.l_mark
[0] );
1463 if (ccl_has_nl
[yystack
.l_mark
[0]])
1464 rule_has_nl
[num_rules
] = true;
1466 yyval
= mkstate( -yystack
.l_mark
[0] );
1470 { yyval
= yystack
.l_mark
[-1]; }
1473 { yyval
= yystack
.l_mark
[-1]; }
1479 if (yystack
.l_mark
[0] == nlch
)
1480 rule_has_nl
[num_rules
] = true;
1482 if (sf_case_ins() && has_case(yystack
.l_mark
[0]))
1483 /* create an alternation, as in (a|A) */
1484 yyval
= mkor (mkstate(yystack
.l_mark
[0]), mkstate(reverse_case(yystack
.l_mark
[0])));
1486 yyval
= mkstate( yystack
.l_mark
[0] );
1490 { yyval
= ccl_set_diff (yystack
.l_mark
[-2], yystack
.l_mark
[0]); }
1493 { yyval
= ccl_set_union (yystack
.l_mark
[-2], yystack
.l_mark
[0]); }
1496 { yyval
= yystack
.l_mark
[-1]; }
1500 cclnegate( yystack
.l_mark
[-1] );
1501 yyval
= yystack
.l_mark
[-1];
1510 /* If one end of the range has case and the other
1511 * does not, or the cases are different, then we're not
1512 * sure what range the user is trying to express.
1513 * Examples: [@-z] or [S-t]
1515 if (has_case (yystack
.l_mark
[-2]) != has_case (yystack
.l_mark
[0])
1516 || (has_case (yystack
.l_mark
[-2]) && (b_islower (yystack
.l_mark
[-2]) != b_islower (yystack
.l_mark
[0])))
1517 || (has_case (yystack
.l_mark
[-2]) && (b_isupper (yystack
.l_mark
[-2]) != b_isupper (yystack
.l_mark
[0]))))
1519 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1520 yystack
.l_mark
[-2], yystack
.l_mark
[0]);
1522 /* If the range spans uppercase characters but not
1523 * lowercase (or vice-versa), then should we automatically
1524 * include lowercase characters in the range?
1525 * Example: [@-_] spans [a-z] but not [A-Z]
1527 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]))
1529 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1530 yystack
.l_mark
[-2], yystack
.l_mark
[0]);
1533 if ( yystack
.l_mark
[-2] > yystack
.l_mark
[0] )
1534 synerr( _("negative range in character class") );
1538 for ( i
= yystack
.l_mark
[-2]; i
<= yystack
.l_mark
[0]; ++i
)
1539 ccladd( yystack
.l_mark
[-3], i
);
1541 /* Keep track if this ccl is staying in
1542 * alphabetical order.
1544 cclsorted
= cclsorted
&& (yystack
.l_mark
[-2] > lastchar
);
1545 lastchar
= yystack
.l_mark
[0];
1547 /* Do it again for upper/lowercase */
1548 if (sf_case_ins() && has_case(yystack
.l_mark
[-2]) && has_case(yystack
.l_mark
[0])){
1549 yystack
.l_mark
[-2] = reverse_case (yystack
.l_mark
[-2]);
1550 yystack
.l_mark
[0] = reverse_case (yystack
.l_mark
[0]);
1552 for ( i
= yystack
.l_mark
[-2]; i
<= yystack
.l_mark
[0]; ++i
)
1553 ccladd( yystack
.l_mark
[-3], i
);
1555 cclsorted
= cclsorted
&& (yystack
.l_mark
[-2] > lastchar
);
1556 lastchar
= yystack
.l_mark
[0];
1561 yyval
= yystack
.l_mark
[-3];
1566 ccladd( yystack
.l_mark
[-1], yystack
.l_mark
[0] );
1567 cclsorted
= cclsorted
&& (yystack
.l_mark
[0] > lastchar
);
1568 lastchar
= yystack
.l_mark
[0];
1570 /* Do it again for upper/lowercase */
1571 if (sf_case_ins() && has_case(yystack
.l_mark
[0])){
1572 yystack
.l_mark
[0] = reverse_case (yystack
.l_mark
[0]);
1573 ccladd (yystack
.l_mark
[-1], yystack
.l_mark
[0]);
1575 cclsorted
= cclsorted
&& (yystack
.l_mark
[0] > lastchar
);
1576 lastchar
= yystack
.l_mark
[0];
1579 yyval
= yystack
.l_mark
[-1];
1584 /* Too hard to properly maintain cclsorted. */
1586 yyval
= yystack
.l_mark
[-1];
1593 currccl
= yyval
= cclinit();
1597 { CCL_EXPR(isalnum
); }
1600 { CCL_EXPR(isalpha
); }
1603 { CCL_EXPR(IS_BLANK
); }
1606 { CCL_EXPR(iscntrl
); }
1609 { CCL_EXPR(isdigit
); }
1612 { CCL_EXPR(isgraph
); }
1622 { CCL_EXPR(isprint
); }
1625 { CCL_EXPR(ispunct
); }
1628 { CCL_EXPR(isspace
); }
1631 { CCL_EXPR(isxdigit
); }
1641 { CCL_NEG_EXPR(isalnum
); }
1644 { CCL_NEG_EXPR(isalpha
); }
1647 { CCL_NEG_EXPR(IS_BLANK
); }
1650 { CCL_NEG_EXPR(iscntrl
); }
1653 { CCL_NEG_EXPR(isdigit
); }
1656 { CCL_NEG_EXPR(isgraph
); }
1659 { CCL_NEG_EXPR(isprint
); }
1662 { CCL_NEG_EXPR(ispunct
); }
1665 { CCL_NEG_EXPR(isspace
); }
1668 { CCL_NEG_EXPR(isxdigit
); }
1672 if ( sf_case_ins() )
1673 lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
1675 CCL_NEG_EXPR(islower
);
1680 if ( sf_case_ins() )
1681 lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
1683 CCL_NEG_EXPR(isupper
);
1688 if ( yystack
.l_mark
[0] == nlch
)
1689 rule_has_nl
[num_rules
] = true;
1693 if (sf_case_ins() && has_case(yystack
.l_mark
[0]))
1694 yyval
= mkor (mkstate(yystack
.l_mark
[0]), mkstate(reverse_case(yystack
.l_mark
[0])));
1696 yyval
= mkstate (yystack
.l_mark
[0]);
1698 yyval
= link_machines( yystack
.l_mark
[-1], yyval
);
1702 { yyval
= mkstate( SYM_EPSILON
); }
1705 yystack
.s_mark
-= yym
;
1706 yystate
= *yystack
.s_mark
;
1707 yystack
.l_mark
-= yym
;
1709 if (yystate
== 0 && yym
== 0)
1713 printf("%sdebug: after reduction, shifting from state 0 to\
1714 state %d\n", YYPREFIX
, YYFINAL
);
1717 *++yystack
.s_mark
= YYFINAL
;
1718 *++yystack
.l_mark
= yyval
;
1721 if ((yychar
= YYLEX
) < 0) yychar
= 0;
1726 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
1727 if (!yys
) yys
= "illegal-symbol";
1728 printf("%sdebug: state %d, reading %d (%s)\n",
1729 YYPREFIX
, YYFINAL
, yychar
, yys
);
1733 if (yychar
== 0) goto yyaccept
;
1736 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
1737 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
1738 yystate
= yytable
[yyn
];
1740 yystate
= yydgoto
[yym
];
1743 printf("%sdebug: after reduction, shifting from state %d \
1744 to state %d\n", YYPREFIX
, *yystack
.s_mark
, yystate
);
1746 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
1750 *++yystack
.s_mark
= (short) yystate
;
1751 *++yystack
.l_mark
= yyval
;
1755 yyerror("yacc stack overflow");
1758 yyfreestack(&yystack
);
1762 yyfreestack(&yystack
);