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