1 /* $NetBSD: initparse.c,v 1.5 2014/10/30 18:44:05 christos Exp $ */
4 __RCSID("$NetBSD: initparse.c,v 1.5 2014/10/30 18:44:05 christos Exp $");
7 static const char yysccsid
[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
11 #include "namespace.h"
21 #define yyclearin (yychar = YYEMPTY)
22 #define yyerrok (yyerrflag = 0)
23 #define YYRECOVERING() (yyerrflag != 0)
29 /* Copyright (c) 1990 The Regents of the University of California. */
30 /* All rights reserved. */
32 /* This code is derived from software contributed to Berkeley by */
35 /* The United States Government has rights in this work pursuant */
36 /* to contract no. DE-AC03-76SF00098 between the United States */
37 /* Department of Energy and the University of California. */
39 /* This file is part of flex. */
41 /* Redistribution and use in source and binary forms, with or without */
42 /* modification, are permitted provided that the following conditions */
45 /* 1. Redistributions of source code must retain the above copyright */
46 /* notice, this list of conditions and the following disclaimer. */
47 /* 2. Redistributions in binary form must reproduce the above copyright */
48 /* notice, this list of conditions and the following disclaimer in the */
49 /* documentation and/or other materials provided with the distribution. */
51 /* Neither the name of the University nor the names of its contributors */
52 /* may be used to endorse or promote products derived from this software */
53 /* without specific prior written permission. */
55 /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
56 /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
57 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
62 int pat
, scnum
, eps
, headcnt
, trailcnt
, lastchar
, i
, rulelen
;
63 int trlcontxt
, xcluflg
, currccl
, cclsorted
, varlength
, variable_trail_rule
;
68 static int madeany
= false; /* whether we've made the '.' character class */
69 static int ccldot
, cclany
;
70 int previous_continued_action
; /* whether the previous rule's action was '|' */
72 #define format_warn3(fmt, a1, a2) \
74 char fw3_msg[MAXLINE];\
75 snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\
79 /* Expand a POSIX character class expression. */
80 #define CCL_EXPR(func) \
83 for ( c = 0; c < csize; ++c ) \
84 if ( isascii(c) && func(c) ) \
85 ccladd( currccl, c ); \
89 #define CCL_NEG_EXPR(func) \
92 for ( c = 0; c < csize; ++c ) \
94 ccladd( currccl, c ); \
97 /* While POSIX defines isblank(), it's not ANSI C. */
98 #define IS_BLANK(c) ((c) == ' ' || (c) == '\t')
100 /* On some over-ambitious machines, such as DEC Alpha's, the default
101 * token type is "long" instead of "int"; this leads to problems with
102 * declaring yylval in flexdef.h. But so far, all the yacc's I've seen
103 * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the
104 * following should ensure that the default token type is "int".
113 /* compatibility with bison */
115 /* compatibility with FreeBSD */
116 # ifdef YYPARSE_PARAM_TYPE
117 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
119 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
122 # define YYPARSE_DECL() yyparse(void)
125 /* Parameters sent to lex. */
127 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
128 # define YYLEX yylex(YYLEX_PARAM)
130 # define YYLEX_DECL() yylex(void)
131 # define YYLEX yylex()
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();
153 #define OPTION_OP 265
154 #define OPT_OUTFILE 266
155 #define OPT_PREFIX 267
156 #define OPT_YYCLASS 268
157 #define OPT_HEADER 269
158 #define OPT_EXTRA_TYPE 270
159 #define OPT_TABLES 271
160 #define CCE_ALNUM 272
161 #define CCE_ALPHA 273
162 #define CCE_BLANK 274
163 #define CCE_CNTRL 275
164 #define CCE_DIGIT 276
165 #define CCE_GRAPH 277
166 #define CCE_LOWER 278
167 #define CCE_PRINT 279
168 #define CCE_PUNCT 280
169 #define CCE_SPACE 281
170 #define CCE_UPPER 282
171 #define CCE_XDIGIT 283
172 #define CCE_NEG_ALNUM 284
173 #define CCE_NEG_ALPHA 285
174 #define CCE_NEG_BLANK 286
175 #define CCE_NEG_CNTRL 287
176 #define CCE_NEG_DIGIT 288
177 #define CCE_NEG_GRAPH 289
178 #define CCE_NEG_LOWER 290
179 #define CCE_NEG_PRINT 291
180 #define CCE_NEG_PUNCT 292
181 #define CCE_NEG_SPACE 293
182 #define CCE_NEG_UPPER 294
183 #define CCE_NEG_XDIGIT 295
184 #define CCL_OP_DIFF 296
185 #define CCL_OP_UNION 297
186 #define BEGIN_REPEAT_POSIX 298
187 #define END_REPEAT_POSIX 299
188 #define BEGIN_REPEAT_FLEX 300
189 #define END_REPEAT_FLEX 301
190 #define YYERRCODE 256
191 static const short 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 short 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 short 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 short 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 short 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 short 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 short 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 short 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 short 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
368 static const char *yyname
[] = {
370 "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,
371 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,
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,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,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,"CHAR","NUMBER","SECTEND",
378 "SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","OPTION_OP","OPT_OUTFILE",
379 "OPT_PREFIX","OPT_YYCLASS","OPT_HEADER","OPT_EXTRA_TYPE","OPT_TABLES",
380 "CCE_ALNUM","CCE_ALPHA","CCE_BLANK","CCE_CNTRL","CCE_DIGIT","CCE_GRAPH",
381 "CCE_LOWER","CCE_PRINT","CCE_PUNCT","CCE_SPACE","CCE_UPPER","CCE_XDIGIT",
382 "CCE_NEG_ALNUM","CCE_NEG_ALPHA","CCE_NEG_BLANK","CCE_NEG_CNTRL","CCE_NEG_DIGIT",
383 "CCE_NEG_GRAPH","CCE_NEG_LOWER","CCE_NEG_PRINT","CCE_NEG_PUNCT","CCE_NEG_SPACE",
384 "CCE_NEG_UPPER","CCE_NEG_XDIGIT","CCL_OP_DIFF","CCL_OP_UNION",
385 "BEGIN_REPEAT_POSIX","END_REPEAT_POSIX","BEGIN_REPEAT_FLEX","END_REPEAT_FLEX",
387 static const char *yyrule
[] = {
389 "goal : initlex sect1 sect1end sect2 initforrule",
391 "sect1 : sect1 startconddecl namelist1",
392 "sect1 : sect1 options",
395 "sect1end : SECTEND",
396 "startconddecl : SCDECL",
397 "startconddecl : XSCDECL",
398 "namelist1 : namelist1 NAME",
401 "options : OPTION_OP optionlist",
402 "optionlist : optionlist option",
404 "option : OPT_OUTFILE '=' NAME",
405 "option : OPT_EXTRA_TYPE '=' NAME",
406 "option : OPT_PREFIX '=' NAME",
407 "option : OPT_YYCLASS '=' NAME",
408 "option : OPT_HEADER '=' NAME",
409 "option : OPT_TABLES '=' NAME",
410 "sect2 : sect2 scon initforrule flexrule '\\n'",
411 "sect2 : sect2 scon '{' sect2 '}'",
414 "flexrule : '^' rule",
419 "scon : '<' scon_stk_ptr namelist2 '>'",
420 "scon : '<' '*' '>'",
422 "namelist2 : namelist2 ',' sconname",
423 "namelist2 : sconname",
430 "re : re '|' series",
433 "series : series singleton",
434 "series : singleton",
435 "series : series BEGIN_REPEAT_POSIX NUMBER ',' NUMBER END_REPEAT_POSIX",
436 "series : series BEGIN_REPEAT_POSIX NUMBER ',' END_REPEAT_POSIX",
437 "series : series BEGIN_REPEAT_POSIX NUMBER END_REPEAT_POSIX",
438 "singleton : singleton '*'",
439 "singleton : singleton '+'",
440 "singleton : singleton '?'",
441 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' NUMBER END_REPEAT_FLEX",
442 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' END_REPEAT_FLEX",
443 "singleton : singleton BEGIN_REPEAT_FLEX NUMBER END_REPEAT_FLEX",
445 "singleton : fullccl",
446 "singleton : PREVCCL",
447 "singleton : '\"' string '\"'",
448 "singleton : '(' re ')'",
450 "fullccl : fullccl CCL_OP_DIFF braceccl",
451 "fullccl : fullccl CCL_OP_UNION braceccl",
452 "fullccl : braceccl",
453 "braceccl : '[' ccl ']'",
454 "braceccl : '[' '^' ccl ']'",
455 "ccl : ccl CHAR '-' CHAR",
457 "ccl : ccl ccl_expr",
459 "ccl_expr : CCE_ALNUM",
460 "ccl_expr : CCE_ALPHA",
461 "ccl_expr : CCE_BLANK",
462 "ccl_expr : CCE_CNTRL",
463 "ccl_expr : CCE_DIGIT",
464 "ccl_expr : CCE_GRAPH",
465 "ccl_expr : CCE_LOWER",
466 "ccl_expr : CCE_PRINT",
467 "ccl_expr : CCE_PUNCT",
468 "ccl_expr : CCE_SPACE",
469 "ccl_expr : CCE_XDIGIT",
470 "ccl_expr : CCE_UPPER",
471 "ccl_expr : CCE_NEG_ALNUM",
472 "ccl_expr : CCE_NEG_ALPHA",
473 "ccl_expr : CCE_NEG_BLANK",
474 "ccl_expr : CCE_NEG_CNTRL",
475 "ccl_expr : CCE_NEG_DIGIT",
476 "ccl_expr : CCE_NEG_GRAPH",
477 "ccl_expr : CCE_NEG_PRINT",
478 "ccl_expr : CCE_NEG_PUNCT",
479 "ccl_expr : CCE_NEG_SPACE",
480 "ccl_expr : CCE_NEG_XDIGIT",
481 "ccl_expr : CCE_NEG_LOWER",
482 "ccl_expr : CCE_NEG_UPPER",
483 "string : string CHAR",
497 /* define the initial stack-sizes */
500 #define YYMAXDEPTH YYSTACKSIZE
503 #define YYSTACKSIZE YYMAXDEPTH
505 #define YYSTACKSIZE 500
506 #define YYMAXDEPTH 500
510 #define YYINITSTACKSIZE 500
520 /* variables for the parser stack */
521 static YYSTACKDATA yystack
;
524 /* build_eof_action - build the "<<EOF>>" action for the active start
528 void build_eof_action()
531 char action_text
[MAXLINE
];
533 for ( i
= 1; i
<= scon_stk_ptr
; ++i
)
535 if ( sceof
[scon_stk
[i
]] )
536 format_pinpoint_message(
537 "multiple <<EOF>> rules for start condition %s",
538 scname
[scon_stk
[i
]] );
542 sceof
[scon_stk
[i
]] = true;
544 if (previous_continued_action
/* && previous action was regular */)
545 add_action("YY_RULE_SETUP\n");
547 snprintf( action_text
, sizeof(action_text
), "case YY_STATE_EOF(%s):\n",
548 scname
[scon_stk
[i
]] );
549 add_action( action_text
);
553 line_directive_out( (FILE *) 0, 1 );
555 /* This isn't a normal rule after all - don't count it as
556 * such, so we don't have any holes in the rule numbering
557 * (which make generating "rule can never match" warnings
565 /* format_synerr - write out formatted syntax error */
567 void format_synerr( msg
, arg
)
568 const char *msg
, arg
[];
570 char errmsg
[MAXLINE
];
572 (void) snprintf( errmsg
, sizeof(errmsg
), msg
, arg
);
577 /* synerr - report a syntax error */
583 pinpoint_message( str
);
587 /* format_warn - write out formatted warning */
589 void format_warn( msg
, arg
)
590 const char *msg
, arg
[];
592 char warn_msg
[MAXLINE
];
594 snprintf( warn_msg
, sizeof(warn_msg
), msg
, arg
);
599 /* lwarn - report a warning, unless -w was given */
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( msg
, arg
)
612 const char *msg
, arg
[];
614 char errmsg
[MAXLINE
];
616 snprintf( errmsg
, sizeof(errmsg
), msg
, arg
);
617 pinpoint_message( errmsg
);
621 /* pinpoint_message - write out a message, pinpointing its location */
623 void pinpoint_message( str
)
626 line_pinpoint( str
, linenum
);
630 /* line_warning - report a warning at a given line, unless -w was given */
632 void line_warning( str
, line
)
636 char warning
[MAXLINE
];
640 snprintf( warning
, sizeof(warning
), "warning, %s", str
);
641 line_pinpoint( warning
, line
);
646 /* line_pinpoint - write out a message, pinpointing it at the given line */
648 void line_pinpoint( str
, line
)
652 fprintf( stderr
, "%s:%d: %s\n", infilename
, line
, str
);
656 /* yyerror - eat up an error message from the parser;
657 * currently, messages are ignore
666 #include <stdio.h> /* needed for printf */
669 #include <stdlib.h> /* needed for malloc, etc */
670 #include <string.h> /* needed for memset */
672 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
673 static int yygrowstack(YYSTACKDATA
*data
)
680 if ((newsize
= data
->stacksize
) == 0)
681 newsize
= YYINITSTACKSIZE
;
682 else if (newsize
>= YYMAXDEPTH
)
684 else if ((newsize
*= 2) > YYMAXDEPTH
)
685 newsize
= YYMAXDEPTH
;
687 i
= (int) (data
->s_mark
- data
->s_base
);
688 newss
= (short *)realloc(data
->s_base
, newsize
* sizeof(*newss
));
692 data
->s_base
= newss
;
693 data
->s_mark
= newss
+ i
;
695 newvs
= (YYSTYPE
*)realloc(data
->l_base
, newsize
* sizeof(*newvs
));
699 data
->l_base
= newvs
;
700 data
->l_mark
= newvs
+ i
;
702 data
->stacksize
= newsize
;
703 data
->s_last
= data
->s_base
+ newsize
- 1;
707 #if YYPURE || defined(YY_NO_LEAKS)
708 static void yyfreestack(YYSTACKDATA
*data
)
712 memset(data
, 0, sizeof(*data
));
715 #define yyfreestack(data) /* nothing */
718 #define YYABORT goto yyabort
719 #define YYREJECT goto yyabort
720 #define YYACCEPT goto yyaccept
721 #define YYERROR goto yyerrlab
726 int yym
, yyn
, yystate
;
730 if ((yys
= getenv("YYDEBUG")) != 0)
733 if (yyn
>= '0' && yyn
<= '9')
744 memset(&yystack
, 0, sizeof(yystack
));
747 if (yystack
.s_base
== NULL
&& yygrowstack(&yystack
)) goto yyoverflow
;
748 yystack
.s_mark
= yystack
.s_base
;
749 yystack
.l_mark
= yystack
.l_base
;
754 if ((yyn
= yydefred
[yystate
]) != 0) goto yyreduce
;
757 if ((yychar
= YYLEX
) < 0) yychar
= 0;
762 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
763 if (!yys
) yys
= "illegal-symbol";
764 printf("%sdebug: state %d, reading %d (%s)\n",
765 YYPREFIX
, yystate
, yychar
, yys
);
769 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
770 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
774 printf("%sdebug: state %d, shifting to state %d\n",
775 YYPREFIX
, yystate
, yytable
[yyn
]);
777 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
781 yystate
= yytable
[yyn
];
782 *++yystack
.s_mark
= yytable
[yyn
];
783 *++yystack
.l_mark
= yylval
;
785 if (yyerrflag
> 0) --yyerrflag
;
788 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
789 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
794 if (yyerrflag
) goto yyinrecovery
;
796 yyerror("syntax error");
809 if ((yyn
= yysindex
[*yystack
.s_mark
]) && (yyn
+= YYERRCODE
) >= 0 &&
810 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
814 printf("%sdebug: state %d, error recovery shifting\
815 to state %d\n", YYPREFIX
, *yystack
.s_mark
, yytable
[yyn
]);
817 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
821 yystate
= yytable
[yyn
];
822 *++yystack
.s_mark
= yytable
[yyn
];
823 *++yystack
.l_mark
= yylval
;
830 printf("%sdebug: error recovery discarding state %d\n",
831 YYPREFIX
, *yystack
.s_mark
);
833 if (yystack
.s_mark
<= yystack
.s_base
) goto yyabort
;
841 if (yychar
== 0) goto yyabort
;
846 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
847 if (!yys
) yys
= "illegal-symbol";
848 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
849 YYPREFIX
, yystate
, yychar
, yys
);
859 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
860 YYPREFIX
, yystate
, yyn
, yyrule
[yyn
]);
864 yyval
= yystack
.l_mark
[1-yym
];
866 memset(&yyval
, 0, sizeof yyval
);
870 { /* add default rule */
876 def_rule
= mkstate( -pat
);
878 /* Remember the number of the default rule so we
879 * don't generate "can't match" warnings for it.
881 default_rule
= num_rules
;
883 finish_rule( def_rule
, false, 0, 0, 0);
885 for ( i
= 1; i
<= lastsc
; ++i
)
886 scset
[i
] = mkbranch( scset
[i
], def_rule
);
890 "YY_FATAL_ERROR( \"flex scanner jammed\" )" );
892 add_action( "ECHO" );
894 add_action( ";\n\tYY_BREAK\n" );
898 { /* initialize for processing rules */
900 /* Create default DFA start condition. */
901 scinstal( "INITIAL", false );
905 { synerr( _("unknown error processing section 1") ); }
910 scon_stk
= allocate_integer_array( lastsc
+ 1 );
921 { scinstal( nmstr
, xcluflg
); }
924 { scinstal( nmstr
, xcluflg
); }
927 { synerr( _("bad start condition list") ); }
931 outfilename
= copy_string( nmstr
);
936 { extra_type
= copy_string( nmstr
); }
939 { prefix
= copy_string( nmstr
); }
942 { yyclass
= copy_string( nmstr
); }
945 { headerfilename
= copy_string( nmstr
); }
948 { tablesext
= true; tablesfilename
= copy_string( nmstr
); }
951 { scon_stk_ptr
= yystack
.l_mark
[-3]; }
954 { scon_stk_ptr
= yystack
.l_mark
[-3]; }
958 /* Initialize for a parse of one rule. */
959 trlcontxt
= variable_trail_rule
= varlength
= false;
960 trailcnt
= headcnt
= rulelen
= 0;
961 current_state_type
= STATE_NORMAL
;
962 previous_continued_action
= continued_action
;
970 pat
= yystack
.l_mark
[0];
971 finish_rule( pat
, variable_trail_rule
,
972 headcnt
, trailcnt
, previous_continued_action
);
974 if ( scon_stk_ptr
> 0 )
976 for ( i
= 1; i
<= scon_stk_ptr
; ++i
)
978 mkbranch( scbol
[scon_stk
[i
]],
984 /* Add to all non-exclusive start conditions,
985 * including the default (0) start condition.
988 for ( i
= 1; i
<= lastsc
; ++i
)
990 scbol
[i
] = mkbranch( scbol
[i
],
998 if ( performance_report
> 1 )
1000 "'^' operator results in sub-optimal performance" );
1006 pat
= yystack
.l_mark
[0];
1007 finish_rule( pat
, variable_trail_rule
,
1008 headcnt
, trailcnt
, previous_continued_action
);
1010 if ( scon_stk_ptr
> 0 )
1012 for ( i
= 1; i
<= scon_stk_ptr
; ++i
)
1013 scset
[scon_stk
[i
]] =
1014 mkbranch( scset
[scon_stk
[i
]],
1020 for ( i
= 1; i
<= lastsc
; ++i
)
1030 if ( scon_stk_ptr
> 0 )
1035 /* This EOF applies to all start conditions
1036 * which don't already have EOF actions.
1038 for ( i
= 1; i
<= lastsc
; ++i
)
1040 scon_stk
[++scon_stk_ptr
] = i
;
1042 if ( scon_stk_ptr
== 0 )
1044 "all start conditions already have <<EOF>> rules" );
1052 { synerr( _("unrecognized rule") ); }
1055 { yyval
= scon_stk_ptr
; }
1058 { yyval
= yystack
.l_mark
[-2]; }
1062 yyval
= scon_stk_ptr
;
1064 for ( i
= 1; i
<= lastsc
; ++i
)
1068 for ( j
= 1; j
<= scon_stk_ptr
; ++j
)
1069 if ( scon_stk
[j
] == i
)
1072 if ( j
> scon_stk_ptr
)
1073 scon_stk
[++scon_stk_ptr
] = i
;
1078 { yyval
= scon_stk_ptr
; }
1081 { synerr( _("bad start condition list") ); }
1085 if ( (scnum
= sclookup( nmstr
)) == 0 )
1086 format_pinpoint_message(
1087 "undeclared start condition %s",
1091 for ( i
= 1; i
<= scon_stk_ptr
; ++i
)
1092 if ( scon_stk
[i
] == scnum
)
1095 "<%s> specified twice",
1100 if ( i
> scon_stk_ptr
)
1101 scon_stk
[++scon_stk_ptr
] = scnum
;
1107 if ( transchar
[lastst
[yystack
.l_mark
[0]]] != SYM_EPSILON
)
1108 /* Provide final transition \now/ so it
1109 * will be marked as a trailing context
1112 yystack
.l_mark
[0] = link_machines( yystack
.l_mark
[0],
1113 mkstate( SYM_EPSILON
) );
1115 mark_beginning_as_normal( yystack
.l_mark
[0] );
1116 current_state_type
= STATE_NORMAL
;
1118 if ( previous_continued_action
)
1120 /* We need to treat this as variable trailing
1121 * context so that the backup does not happen
1122 * in the action but before the action switch
1123 * statement. If the backup happens in the
1124 * action, then the rules "falling into" this
1125 * one's action will *also* do the backup,
1128 if ( ! varlength
|| headcnt
!= 0 )
1130 "trailing context made variable due to preceding '|' action" );
1132 /* Mark as variable. */
1138 if ( lex_compat
|| (varlength
&& headcnt
== 0) )
1139 { /* variable trailing context rule */
1140 /* Mark the first part of the rule as the
1141 * accepting "head" part of a trailing
1144 * By the way, we didn't do this at the
1145 * beginning of this production because back
1146 * then current_state_type was set up for a
1147 * trail rule, and add_accept() can create
1150 add_accept( yystack
.l_mark
[-1],
1151 num_rules
| YY_TRAILING_HEAD_MASK
);
1152 variable_trail_rule
= true;
1158 yyval
= link_machines( yystack
.l_mark
[-1], yystack
.l_mark
[0] );
1162 { synerr( _("trailing context used twice") ); }
1171 current_state_type
= STATE_TRAILING_CONTEXT
;
1175 synerr( _("trailing context used twice") );
1176 yyval
= mkstate( SYM_EPSILON
);
1179 else if ( previous_continued_action
)
1181 /* See the comment in the rule for "re2 re"
1185 "trailing context made variable due to preceding '|' action" );
1190 if ( lex_compat
|| varlength
)
1192 /* Again, see the comment in the rule for
1195 add_accept( yystack
.l_mark
[-1],
1196 num_rules
| YY_TRAILING_HEAD_MASK
);
1197 variable_trail_rule
= true;
1202 eps
= mkstate( SYM_EPSILON
);
1203 yyval
= link_machines( yystack
.l_mark
[-1],
1204 link_machines( eps
, mkstate( '\n' ) ) );
1209 yyval
= yystack
.l_mark
[0];
1213 if ( lex_compat
|| (varlength
&& headcnt
== 0) )
1214 /* Both head and trail are
1217 variable_trail_rule
= true;
1226 yyval
= mkor( yystack
.l_mark
[-2], yystack
.l_mark
[0] );
1230 { yyval
= yystack
.l_mark
[0]; }
1234 /* This rule is written separately so the
1235 * reduction will occur before the trailing
1240 synerr( _("trailing context used twice") );
1245 /* We hope the trailing context is
1254 current_state_type
= STATE_TRAILING_CONTEXT
;
1255 yyval
= yystack
.l_mark
[-1];
1260 /* This is where concatenation of adjacent patterns
1263 yyval
= link_machines( yystack
.l_mark
[-1], yystack
.l_mark
[0] );
1267 { yyval
= yystack
.l_mark
[0]; }
1273 if ( yystack
.l_mark
[-3] > yystack
.l_mark
[-1] || yystack
.l_mark
[-3] < 0 )
1275 synerr( _("bad iteration values") );
1276 yyval
= yystack
.l_mark
[-5];
1280 if ( yystack
.l_mark
[-3] == 0 )
1282 if ( yystack
.l_mark
[-1] <= 0 )
1285 _("bad iteration values") );
1286 yyval
= yystack
.l_mark
[-5];
1290 mkrep( yystack
.l_mark
[-5], 1, yystack
.l_mark
[-1] ) );
1293 yyval
= mkrep( yystack
.l_mark
[-5], yystack
.l_mark
[-3], yystack
.l_mark
[-1] );
1301 if ( yystack
.l_mark
[-2] <= 0 )
1303 synerr( _("iteration value must be positive") );
1304 yyval
= yystack
.l_mark
[-4];
1308 yyval
= mkrep( yystack
.l_mark
[-4], yystack
.l_mark
[-2], INFINITE_REPEAT
);
1313 /* The series could be something like "(foo)",
1314 * in which case we have no idea what its length
1315 * is, so we punt here.
1319 if ( yystack
.l_mark
[-1] <= 0 )
1321 synerr( _("iteration value must be positive")
1323 yyval
= yystack
.l_mark
[-3];
1327 yyval
= link_machines( yystack
.l_mark
[-3],
1328 copysingl( yystack
.l_mark
[-3], yystack
.l_mark
[-1] - 1 ) );
1335 yyval
= mkclos( yystack
.l_mark
[-1] );
1341 yyval
= mkposcl( yystack
.l_mark
[-1] );
1347 yyval
= mkopt( yystack
.l_mark
[-1] );
1354 if ( yystack
.l_mark
[-3] > yystack
.l_mark
[-1] || yystack
.l_mark
[-3] < 0 )
1356 synerr( _("bad iteration values") );
1357 yyval
= yystack
.l_mark
[-5];
1361 if ( yystack
.l_mark
[-3] == 0 )
1363 if ( yystack
.l_mark
[-1] <= 0 )
1366 _("bad iteration values") );
1367 yyval
= yystack
.l_mark
[-5];
1371 mkrep( yystack
.l_mark
[-5], 1, yystack
.l_mark
[-1] ) );
1374 yyval
= mkrep( yystack
.l_mark
[-5], yystack
.l_mark
[-3], yystack
.l_mark
[-1] );
1382 if ( yystack
.l_mark
[-2] <= 0 )
1384 synerr( _("iteration value must be positive") );
1385 yyval
= yystack
.l_mark
[-4];
1389 yyval
= mkrep( yystack
.l_mark
[-4], yystack
.l_mark
[-2], INFINITE_REPEAT
);
1394 /* The singleton could be something like "(foo)",
1395 * in which case we have no idea what its length
1396 * is, so we punt here.
1400 if ( yystack
.l_mark
[-1] <= 0 )
1402 synerr( _("iteration value must be positive") );
1403 yyval
= yystack
.l_mark
[-3];
1407 yyval
= link_machines( yystack
.l_mark
[-3],
1408 copysingl( yystack
.l_mark
[-3], yystack
.l_mark
[-1] - 1 ) );
1415 /* Create the '.' character class. */
1417 ccladd( ccldot
, '\n' );
1418 cclnegate( ccldot
);
1421 mkeccl( ccltbl
+ cclmap
[ccldot
],
1422 ccllen
[ccldot
], nextecm
,
1423 ecgroup
, csize
, csize
);
1425 /* Create the (?s:'.') character class. */
1427 cclnegate( cclany
);
1430 mkeccl( ccltbl
+ cclmap
[cclany
],
1431 ccllen
[cclany
], nextecm
,
1432 ecgroup
, csize
, csize
);
1440 yyval
= mkstate( -cclany
);
1442 yyval
= mkstate( -ccldot
);
1447 /* Sort characters for fast searching.
1449 qsort( ccltbl
+ cclmap
[yystack
.l_mark
[0]], ccllen
[yystack
.l_mark
[0]], sizeof (*ccltbl
), cclcmp
);
1452 mkeccl( ccltbl
+ cclmap
[yystack
.l_mark
[0]], ccllen
[yystack
.l_mark
[0]],
1453 nextecm
, ecgroup
, csize
, csize
);
1457 if (ccl_has_nl
[yystack
.l_mark
[0]])
1458 rule_has_nl
[num_rules
] = true;
1460 yyval
= mkstate( -yystack
.l_mark
[0] );
1467 if (ccl_has_nl
[yystack
.l_mark
[0]])
1468 rule_has_nl
[num_rules
] = true;
1470 yyval
= mkstate( -yystack
.l_mark
[0] );
1474 { yyval
= yystack
.l_mark
[-1]; }
1477 { yyval
= yystack
.l_mark
[-1]; }
1483 if (yystack
.l_mark
[0] == nlch
)
1484 rule_has_nl
[num_rules
] = true;
1486 if (sf_case_ins() && has_case(yystack
.l_mark
[0]))
1487 /* create an alternation, as in (a|A) */
1488 yyval
= mkor (mkstate(yystack
.l_mark
[0]), mkstate(reverse_case(yystack
.l_mark
[0])));
1490 yyval
= mkstate( yystack
.l_mark
[0] );
1494 { yyval
= ccl_set_diff (yystack
.l_mark
[-2], yystack
.l_mark
[0]); }
1497 { yyval
= ccl_set_union (yystack
.l_mark
[-2], yystack
.l_mark
[0]); }
1500 { yyval
= yystack
.l_mark
[-1]; }
1504 cclnegate( yystack
.l_mark
[-1] );
1505 yyval
= yystack
.l_mark
[-1];
1514 /* If one end of the range has case and the other
1515 * does not, or the cases are different, then we're not
1516 * sure what range the user is trying to express.
1517 * Examples: [@-z] or [S-t]
1519 if (has_case (yystack
.l_mark
[-2]) != has_case (yystack
.l_mark
[0])
1520 || (has_case (yystack
.l_mark
[-2]) && (b_islower (yystack
.l_mark
[-2]) != b_islower (yystack
.l_mark
[0])))
1521 || (has_case (yystack
.l_mark
[-2]) && (b_isupper (yystack
.l_mark
[-2]) != b_isupper (yystack
.l_mark
[0]))))
1523 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1524 yystack
.l_mark
[-2], yystack
.l_mark
[0]);
1526 /* If the range spans uppercase characters but not
1527 * lowercase (or vice-versa), then should we automatically
1528 * include lowercase characters in the range?
1529 * Example: [@-_] spans [a-z] but not [A-Z]
1531 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]))
1533 _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),
1534 yystack
.l_mark
[-2], yystack
.l_mark
[0]);
1537 if ( yystack
.l_mark
[-2] > yystack
.l_mark
[0] )
1538 synerr( _("negative range in character class") );
1542 for ( i
= yystack
.l_mark
[-2]; i
<= yystack
.l_mark
[0]; ++i
)
1543 ccladd( yystack
.l_mark
[-3], i
);
1545 /* Keep track if this ccl is staying in
1546 * alphabetical order.
1548 cclsorted
= cclsorted
&& (yystack
.l_mark
[-2] > lastchar
);
1549 lastchar
= yystack
.l_mark
[0];
1551 /* Do it again for upper/lowercase */
1552 if (sf_case_ins() && has_case(yystack
.l_mark
[-2]) && has_case(yystack
.l_mark
[0])){
1553 yystack
.l_mark
[-2] = reverse_case (yystack
.l_mark
[-2]);
1554 yystack
.l_mark
[0] = reverse_case (yystack
.l_mark
[0]);
1556 for ( i
= yystack
.l_mark
[-2]; i
<= yystack
.l_mark
[0]; ++i
)
1557 ccladd( yystack
.l_mark
[-3], i
);
1559 cclsorted
= cclsorted
&& (yystack
.l_mark
[-2] > lastchar
);
1560 lastchar
= yystack
.l_mark
[0];
1565 yyval
= yystack
.l_mark
[-3];
1570 ccladd( yystack
.l_mark
[-1], yystack
.l_mark
[0] );
1571 cclsorted
= cclsorted
&& (yystack
.l_mark
[0] > lastchar
);
1572 lastchar
= yystack
.l_mark
[0];
1574 /* Do it again for upper/lowercase */
1575 if (sf_case_ins() && has_case(yystack
.l_mark
[0])){
1576 yystack
.l_mark
[0] = reverse_case (yystack
.l_mark
[0]);
1577 ccladd (yystack
.l_mark
[-1], yystack
.l_mark
[0]);
1579 cclsorted
= cclsorted
&& (yystack
.l_mark
[0] > lastchar
);
1580 lastchar
= yystack
.l_mark
[0];
1583 yyval
= yystack
.l_mark
[-1];
1588 /* Too hard to properly maintain cclsorted. */
1590 yyval
= yystack
.l_mark
[-1];
1597 currccl
= yyval
= cclinit();
1601 { CCL_EXPR(isalnum
); }
1604 { CCL_EXPR(isalpha
); }
1607 { CCL_EXPR(IS_BLANK
); }
1610 { CCL_EXPR(iscntrl
); }
1613 { CCL_EXPR(isdigit
); }
1616 { CCL_EXPR(isgraph
); }
1626 { CCL_EXPR(isprint
); }
1629 { CCL_EXPR(ispunct
); }
1632 { CCL_EXPR(isspace
); }
1635 { CCL_EXPR(isxdigit
); }
1645 { CCL_NEG_EXPR(isalnum
); }
1648 { CCL_NEG_EXPR(isalpha
); }
1651 { CCL_NEG_EXPR(IS_BLANK
); }
1654 { CCL_NEG_EXPR(iscntrl
); }
1657 { CCL_NEG_EXPR(isdigit
); }
1660 { CCL_NEG_EXPR(isgraph
); }
1663 { CCL_NEG_EXPR(isprint
); }
1666 { CCL_NEG_EXPR(ispunct
); }
1669 { CCL_NEG_EXPR(isspace
); }
1672 { CCL_NEG_EXPR(isxdigit
); }
1676 if ( sf_case_ins() )
1677 lwarn(_("[:^lower:] is ambiguous in case insensitive scanner"));
1679 CCL_NEG_EXPR(islower
);
1684 if ( sf_case_ins() )
1685 lwarn(_("[:^upper:] ambiguous in case insensitive scanner"));
1687 CCL_NEG_EXPR(isupper
);
1692 if ( yystack
.l_mark
[0] == nlch
)
1693 rule_has_nl
[num_rules
] = true;
1697 if (sf_case_ins() && has_case(yystack
.l_mark
[0]))
1698 yyval
= mkor (mkstate(yystack
.l_mark
[0]), mkstate(reverse_case(yystack
.l_mark
[0])));
1700 yyval
= mkstate (yystack
.l_mark
[0]);
1702 yyval
= link_machines( yystack
.l_mark
[-1], yyval
);
1706 { yyval
= mkstate( SYM_EPSILON
); }
1709 yystack
.s_mark
-= yym
;
1710 yystate
= *yystack
.s_mark
;
1711 yystack
.l_mark
-= yym
;
1713 if (yystate
== 0 && yym
== 0)
1717 printf("%sdebug: after reduction, shifting from state 0 to\
1718 state %d\n", YYPREFIX
, YYFINAL
);
1721 *++yystack
.s_mark
= YYFINAL
;
1722 *++yystack
.l_mark
= yyval
;
1725 if ((yychar
= YYLEX
) < 0) yychar
= 0;
1730 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
1731 if (!yys
) yys
= "illegal-symbol";
1732 printf("%sdebug: state %d, reading %d (%s)\n",
1733 YYPREFIX
, YYFINAL
, yychar
, yys
);
1737 if (yychar
== 0) goto yyaccept
;
1740 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
1741 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
1742 yystate
= yytable
[yyn
];
1744 yystate
= yydgoto
[yym
];
1747 printf("%sdebug: after reduction, shifting from state %d \
1748 to state %d\n", YYPREFIX
, *yystack
.s_mark
, yystate
);
1750 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
1754 *++yystack
.s_mark
= (short) yystate
;
1755 *++yystack
.l_mark
= yyval
;
1759 yyerror("yacc stack overflow");
1762 yyfreestack(&yystack
);
1766 yyfreestack(&yystack
);