File: | src/usr.bin/lex/obj/parse.c |
Warning: | line 687, column 12 Use of zero-allocated memory |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | #include <stdlib.h> | |||
2 | #include <string.h> | |||
3 | #define YYBYACC1 1 | |||
4 | #define YYMAJOR1 1 | |||
5 | #define YYMINOR9 9 | |||
6 | #define YYLEXyylex() yylex() | |||
7 | #define YYEMPTY-1 -1 | |||
8 | #define yyclearin(yychar=(-1)) (yychar=(YYEMPTY-1)) | |||
9 | #define yyerrok(yyerrflag=0) (yyerrflag=0) | |||
10 | #define YYRECOVERING()(yyerrflag!=0) (yyerrflag!=0) | |||
11 | #define YYPREFIX"yy" "yy" | |||
12 | #line 37 "/usr/src/usr.bin/lex/parse.y" | |||
13 | /* Copyright (c) 1990 The Regents of the University of California. */ | |||
14 | /* All rights reserved. */ | |||
15 | ||||
16 | /* This code is derived from software contributed to Berkeley by */ | |||
17 | /* Vern Paxson. */ | |||
18 | ||||
19 | /* The United States Government has rights in this work pursuant */ | |||
20 | /* to contract no. DE-AC03-76SF00098 between the United States */ | |||
21 | /* Department of Energy and the University of California. */ | |||
22 | ||||
23 | /* This file is part of flex. */ | |||
24 | ||||
25 | /* Redistribution and use in source and binary forms, with or without */ | |||
26 | /* modification, are permitted provided that the following conditions */ | |||
27 | /* are met: */ | |||
28 | ||||
29 | /* 1. Redistributions of source code must retain the above copyright */ | |||
30 | /* notice, this list of conditions and the following disclaimer. */ | |||
31 | /* 2. Redistributions in binary form must reproduce the above copyright */ | |||
32 | /* notice, this list of conditions and the following disclaimer in the */ | |||
33 | /* documentation and/or other materials provided with the distribution. */ | |||
34 | ||||
35 | /* Neither the name of the University nor the names of its contributors */ | |||
36 | /* may be used to endorse or promote products derived from this software */ | |||
37 | /* without specific prior written permission. */ | |||
38 | ||||
39 | /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ | |||
40 | /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ | |||
41 | /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ | |||
42 | /* PURPOSE. */ | |||
43 | ||||
44 | #include "flexdef.h" | |||
45 | #include "tables.h" | |||
46 | ||||
47 | int pat, scnum, eps, headcnt, trailcnt, lastchar, i, rulelen; | |||
48 | int trlcontxt, xcluflg, currccl, cclsorted, varlength, variable_trail_rule; | |||
49 | ||||
50 | int *scon_stk; | |||
51 | int scon_stk_ptr; | |||
52 | ||||
53 | static int madeany = false0; /* whether we've made the '.' character class */ | |||
54 | static int ccldot, cclany; | |||
55 | int previous_continued_action; /* whether the previous rule's action was '|' */ | |||
56 | ||||
57 | #define format_warn3(fmt, a1, a2)do{ char fw3_msg[2048]; snprintf( fw3_msg, 2048,(fmt), (a1), ( a2) ); warn( fw3_msg ); }while(0) \ | |||
58 | do{ \ | |||
59 | char fw3_msg[MAXLINE2048];\ | |||
60 | snprintf( fw3_msg, MAXLINE2048,(fmt), (a1), (a2) );\ | |||
61 | warn( fw3_msg );\ | |||
62 | }while(0) | |||
63 | ||||
64 | /* Expand a POSIX character class expression. */ | |||
65 | #define CCL_EXPR(func)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && func(c) ) ccladd( currccl, c ); }while(0) \ | |||
66 | do{ \ | |||
67 | int c; \ | |||
68 | for ( c = 0; c < csize; ++c ) \ | |||
69 | if ( isascii(c)((c) <= 0177) && func(c) ) \ | |||
70 | ccladd( currccl, c ); \ | |||
71 | }while(0) | |||
72 | ||||
73 | /* negated class */ | |||
74 | #define CCL_NEG_EXPR(func)do{ int c; for ( c = 0; c < csize; ++c ) if ( !func(c) ) ccladd ( currccl, c ); }while(0) \ | |||
75 | do{ \ | |||
76 | int c; \ | |||
77 | for ( c = 0; c < csize; ++c ) \ | |||
78 | if ( !func(c) ) \ | |||
79 | ccladd( currccl, c ); \ | |||
80 | }while(0) | |||
81 | ||||
82 | /* On some over-ambitious machines, such as DEC Alpha's, the default | |||
83 | * token type is "long" instead of "int"; this leads to problems with | |||
84 | * declaring yylval in flexdef.h. But so far, all the yacc's I've seen | |||
85 | * wrap their definitions of YYSTYPE with "#ifndef YYSTYPE"'s, so the | |||
86 | * following should ensure that the default token type is "int". | |||
87 | */ | |||
88 | #define YYSTYPEint int | |||
89 | ||||
90 | #line 91 "parse.c" | |||
91 | #define CHAR257 257 | |||
92 | #define NUMBER258 258 | |||
93 | #define SECTEND259 259 | |||
94 | #define SCDECL260 260 | |||
95 | #define XSCDECL261 261 | |||
96 | #define NAME262 262 | |||
97 | #define PREVCCL263 263 | |||
98 | #define EOF_OP264 264 | |||
99 | #define OPTION_OP265 265 | |||
100 | #define OPT_OUTFILE266 266 | |||
101 | #define OPT_PREFIX267 267 | |||
102 | #define OPT_YYCLASS268 268 | |||
103 | #define OPT_HEADER269 269 | |||
104 | #define OPT_EXTRA_TYPE270 270 | |||
105 | #define OPT_TABLES271 271 | |||
106 | #define CCE_ALNUM272 272 | |||
107 | #define CCE_ALPHA273 273 | |||
108 | #define CCE_BLANK274 274 | |||
109 | #define CCE_CNTRL275 275 | |||
110 | #define CCE_DIGIT276 276 | |||
111 | #define CCE_GRAPH277 277 | |||
112 | #define CCE_LOWER278 278 | |||
113 | #define CCE_PRINT279 279 | |||
114 | #define CCE_PUNCT280 280 | |||
115 | #define CCE_SPACE281 281 | |||
116 | #define CCE_UPPER282 282 | |||
117 | #define CCE_XDIGIT283 283 | |||
118 | #define CCE_NEG_ALNUM284 284 | |||
119 | #define CCE_NEG_ALPHA285 285 | |||
120 | #define CCE_NEG_BLANK286 286 | |||
121 | #define CCE_NEG_CNTRL287 287 | |||
122 | #define CCE_NEG_DIGIT288 288 | |||
123 | #define CCE_NEG_GRAPH289 289 | |||
124 | #define CCE_NEG_LOWER290 290 | |||
125 | #define CCE_NEG_PRINT291 291 | |||
126 | #define CCE_NEG_PUNCT292 292 | |||
127 | #define CCE_NEG_SPACE293 293 | |||
128 | #define CCE_NEG_UPPER294 294 | |||
129 | #define CCE_NEG_XDIGIT295 295 | |||
130 | #define CCL_OP_DIFF296 296 | |||
131 | #define CCL_OP_UNION297 297 | |||
132 | #define BEGIN_REPEAT_POSIX298 298 | |||
133 | #define END_REPEAT_POSIX299 299 | |||
134 | #define BEGIN_REPEAT_FLEX300 300 | |||
135 | #define END_REPEAT_FLEX301 301 | |||
136 | #define YYERRCODE256 256 | |||
137 | const short yylhs[] = | |||
138 | { -1, | |||
139 | 0, 1, 2, 2, 2, 2, 3, 6, 6, 7, | |||
140 | 7, 7, 8, 9, 9, 10, 10, 10, 10, 10, | |||
141 | 10, 4, 4, 4, 5, 12, 12, 12, 12, 14, | |||
142 | 11, 11, 11, 15, 15, 15, 16, 13, 13, 13, | |||
143 | 13, 18, 18, 17, 19, 19, 19, 19, 19, 20, | |||
144 | 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, | |||
145 | 20, 21, 21, 21, 23, 23, 24, 24, 24, 24, | |||
146 | 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, | |||
147 | 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, | |||
148 | 25, 25, 25, 25, 22, 22, | |||
149 | }; | |||
150 | const short yylen[] = | |||
151 | { 2, | |||
152 | 5, 0, 3, 2, 0, 1, 1, 1, 1, 2, | |||
153 | 1, 1, 2, 2, 0, 3, 3, 3, 3, 3, | |||
154 | 3, 5, 5, 0, 0, 2, 1, 1, 1, 0, | |||
155 | 4, 3, 0, 3, 1, 1, 1, 2, 3, 2, | |||
156 | 1, 3, 1, 2, 2, 1, 6, 5, 4, 2, | |||
157 | 2, 2, 6, 5, 4, 1, 1, 1, 3, 3, | |||
158 | 1, 3, 3, 1, 3, 4, 4, 2, 2, 0, | |||
159 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
160 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |||
161 | 1, 1, 1, 1, 2, 0, | |||
162 | }; | |||
163 | const short yydefred[] = | |||
164 | { 2, | |||
165 | 0, 0, 6, 0, 7, 8, 9, 15, 24, 0, | |||
166 | 4, 0, 0, 12, 11, 0, 0, 0, 0, 0, | |||
167 | 0, 0, 14, 0, 1, 0, 10, 0, 0, 0, | |||
168 | 0, 0, 0, 0, 0, 24, 0, 16, 18, 19, | |||
169 | 20, 17, 21, 32, 36, 37, 0, 35, 0, 29, | |||
170 | 61, 58, 28, 0, 56, 96, 0, 0, 0, 27, | |||
171 | 0, 0, 0, 0, 0, 64, 31, 0, 23, 26, | |||
172 | 0, 0, 70, 0, 22, 0, 40, 0, 44, 0, | |||
173 | 0, 0, 50, 51, 52, 0, 0, 34, 95, 59, | |||
174 | 60, 0, 0, 71, 72, 73, 74, 75, 76, 77, | |||
175 | 78, 79, 80, 82, 81, 83, 84, 85, 86, 87, | |||
176 | 88, 93, 89, 90, 91, 94, 92, 65, 69, 39, | |||
177 | 0, 0, 0, 62, 63, 66, 0, 49, 0, 55, | |||
178 | 0, 67, 0, 48, 0, 54, 47, 53, | |||
179 | }; | |||
180 | const short yydgoto[] = | |||
181 | { 1, | |||
182 | 2, 4, 9, 13, 25, 10, 16, 11, 12, 23, | |||
183 | 26, 59, 60, 35, 47, 48, 61, 62, 63, 64, | |||
184 | 65, 71, 66, 74, 119, | |||
185 | }; | |||
186 | const short yysindex[] = | |||
187 | { 0, | |||
188 | 0, -222, 0, -155, 0, 0, 0, 0, 0, -215, | |||
189 | 0, -123, 6, 0, 0, -193, 10, 21, 26, 31, | |||
190 | 35, 37, 0, 59, 0, -44, 0, -147, -145, -140, | |||
191 | -133, -132, -129, 75, -214, 0, -19, 0, 0, 0, | |||
192 | 0, 0, 0, 0, 0, 0, 23, 0, -48, 0, | |||
193 | 0, 0, 0, -17, 0, 0, -17, 27, 128, 0, | |||
194 | -17, -1, -30, -41, -189, 0, 0, -121, 0, 0, | |||
195 | -31, -34, 0, -87, 0, -25, 0, -17, 0, -109, | |||
196 | -41, -108, 0, 0, 0, 60, 60, 0, 0, 0, | |||
197 | 0, 46, 107, 0, 0, 0, 0, 0, 0, 0, | |||
198 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
199 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
200 | -30, -36, -39, 0, 0, 0, -104, 0, -219, 0, | |||
201 | -238, 0, -144, 0, -143, 0, 0, 0,}; | |||
202 | const short yyrindex[] = | |||
203 | { 0, | |||
204 | 0, -141, 0, 0, 0, 0, 0, 0, 0, 0, | |||
205 | 0, -134, 9, 0, 0, -125, 0, 0, 0, 0, | |||
206 | 0, 0, 0, -178, 0, 22, 0, 0, 0, 0, | |||
207 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
208 | 0, 0, 0, 0, 0, 0, 0, 0, -21, 0, | |||
209 | 0, 0, 0, 0, 0, 0, 0, 85, 0, 0, | |||
210 | 0, 144, 47, 4, -10, 0, 0, 0, 0, 0, | |||
211 | 0, 0, 0, 0, 0, 146, 0, 0, 0, 0, | |||
212 | 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
213 | 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, | |||
214 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
215 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
216 | 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
217 | 0, 0, 0, 0, 0, 0, 0, 0,}; | |||
218 | const short yygindex[] = | |||
219 | { 0, | |||
220 | 0, 0, 0, 121, 133, 0, 0, 0, 0, 0, | |||
221 | 0, 0, 106, 0, 0, 93, 0, 32, 84, -45, | |||
222 | 0, 0, 25, 90, 0, | |||
223 | }; | |||
224 | #define YYTABLESIZE419 419 | |||
225 | const short yytable[] = | |||
226 | { 57, | |||
227 | 83, 84, 90, 56, 131, 118, 91, 129, 25, 57, | |||
228 | 120, 24, 33, 46, 56, 55, 56, 81, 33, 135, | |||
229 | 57, 85, 57, 57, 33, 57, 55, 45, 55, 57, | |||
230 | 57, 57, 57, 3, 77, 57, 57, 46, 133, 46, | |||
231 | 14, 45, 33, 46, 46, 79, 15, 46, 33, 46, | |||
232 | 46, 45, 57, 45, 33, 25, 43, 45, 45, 42, | |||
233 | 58, 25, 136, 45, 45, 24, 68, 25, 27, 33, | |||
234 | 28, 58, 33, 58, 54, 81, 69, 30, 36, 134, | |||
235 | 57, 29, 43, 30, 67, 42, 30, 43, 72, 78, | |||
236 | 42, 31, 76, 43, 46, 32, 42, 33, 78, 33, | |||
237 | 34, 33, 33, 5, 6, 7, 86, 87, 45, 8, | |||
238 | 124, 125, 25, 57, 38, 25, 39, 5, 5, 5, | |||
239 | 73, 40, 78, 5, 13, 13, 13, 46, 41, 42, | |||
240 | 13, 33, 43, 3, 3, 3, 44, 75, 126, 3, | |||
241 | 46, 45, 17, 18, 19, 20, 21, 22, 122, 123, | |||
242 | 58, 127, 132, 41, 137, 38, 49, 138, 37, 70, | |||
243 | 88, 121, 92, 0, 0, 0, 0, 0, 0, 93, | |||
244 | 43, 0, 0, 42, 0, 0, 0, 70, 0, 0, | |||
245 | 0, 0, 0, 0, 94, 95, 96, 97, 98, 99, | |||
246 | 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, | |||
247 | 110, 111, 112, 113, 114, 115, 116, 117, 0, 0, | |||
248 | 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, | |||
249 | 0, 0, 0, 0, 0, 89, 51, 0, 0, 0, | |||
250 | 0, 0, 52, 0, 33, 33, 50, 51, 0, 51, | |||
251 | 0, 33, 33, 52, 53, 52, 57, 0, 0, 0, | |||
252 | 0, 0, 57, 0, 0, 0, 0, 0, 82, 0, | |||
253 | 46, 130, 128, 0, 33, 33, 46, 80, 0, 0, | |||
254 | 0, 33, 33, 0, 45, 0, 0, 25, 25, 0, | |||
255 | 45, 0, 0, 0, 25, 25, 0, 57, 0, 57, | |||
256 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
257 | 0, 46, 93, 0, 0, 0, 0, 0, 0, 0, | |||
258 | 0, 0, 0, 0, 0, 45, 0, 94, 95, 96, | |||
259 | 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, | |||
260 | 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, | |||
261 | 117, 70, 0, 0, 0, 0, 0, 0, 0, 0, | |||
262 | 0, 0, 0, 0, 0, 0, 70, 70, 70, 70, | |||
263 | 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, | |||
264 | 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, | |||
265 | 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |||
266 | 0, 0, 0, 0, 0, 68, 68, 68, 68, 68, | |||
267 | 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, | |||
268 | 68, 68, 68, 68, 68, 68, 68, 68, 68, | |||
269 | }; | |||
270 | const short yycheck[] = | |||
271 | { 10, | |||
272 | 42, 43, 34, 34, 44, 93, 41, 44, 0, 40, | |||
273 | 36, 60, 34, 10, 34, 46, 34, 63, 40, 258, | |||
274 | 40, 63, 40, 34, 46, 36, 46, 10, 46, 40, | |||
275 | 41, 42, 43, 256, 36, 46, 47, 34, 258, 36, | |||
276 | 256, 256, 34, 40, 41, 47, 262, 262, 40, 46, | |||
277 | 47, 34, 63, 36, 46, 34, 10, 40, 41, 10, | |||
278 | 91, 40, 301, 46, 47, 60, 44, 46, 262, 91, | |||
279 | 61, 91, 94, 91, 94, 121, 125, 256, 123, 299, | |||
280 | 91, 61, 36, 262, 62, 36, 61, 41, 57, 124, | |||
281 | 41, 61, 61, 47, 91, 61, 47, 61, 124, 91, | |||
282 | 42, 123, 94, 259, 260, 261, 296, 297, 91, 265, | |||
283 | 86, 87, 91, 124, 262, 94, 262, 259, 260, 261, | |||
284 | 94, 262, 124, 265, 259, 260, 261, 124, 262, 262, | |||
285 | 265, 123, 262, 259, 260, 261, 62, 10, 93, 265, | |||
286 | 262, 124, 266, 267, 268, 269, 270, 271, 258, 258, | |||
287 | 91, 45, 257, 10, 299, 10, 36, 301, 26, 54, | |||
288 | 68, 78, 73, -1, -1, -1, -1, -1, -1, 257, | |||
289 | 124, -1, -1, 124, -1, -1, -1, 93, -1, -1, | |||
290 | -1, -1, -1, -1, 272, 273, 274, 275, 276, 277, | |||
291 | 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, | |||
292 | 288, 289, 290, 291, 292, 293, 294, 295, -1, -1, | |||
293 | -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, | |||
294 | -1, -1, -1, -1, -1, 257, 257, -1, -1, -1, | |||
295 | -1, -1, 263, -1, 256, 257, 256, 257, -1, 257, | |||
296 | -1, 263, 264, 263, 264, 263, 257, -1, -1, -1, | |||
297 | -1, -1, 263, -1, -1, -1, -1, -1, 300, -1, | |||
298 | 257, 301, 299, -1, 256, 257, 263, 298, -1, -1, | |||
299 | -1, 263, 264, -1, 257, -1, -1, 256, 257, -1, | |||
300 | 263, -1, -1, -1, 263, 264, -1, 298, -1, 300, | |||
301 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
302 | -1, 298, 257, -1, -1, -1, -1, -1, -1, -1, | |||
303 | -1, -1, -1, -1, -1, 298, -1, 272, 273, 274, | |||
304 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | |||
305 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, | |||
306 | 295, 257, -1, -1, -1, -1, -1, -1, -1, -1, | |||
307 | -1, -1, -1, -1, -1, -1, 272, 273, 274, 275, | |||
308 | 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, | |||
309 | 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, | |||
310 | 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, | |||
311 | -1, -1, -1, -1, -1, 272, 273, 274, 275, 276, | |||
312 | 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, | |||
313 | 287, 288, 289, 290, 291, 292, 293, 294, 295, | |||
314 | }; | |||
315 | #define YYFINAL1 1 | |||
316 | #ifndef YYDEBUG0 | |||
317 | #define YYDEBUG0 0 | |||
318 | #endif | |||
319 | #define YYMAXTOKEN301 301 | |||
320 | #if YYDEBUG0 | |||
321 | const char * const yyname[] = | |||
322 | { | |||
323 | "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, | |||
324 | 0,0,0,"'\"'",0,"'$'",0,0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0, | |||
325 | 0,0,0,0,0,0,0,0,0,0,"'<'","'='","'>'","'?'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
326 | 0,0,0,0,0,0,0,0,0,"'['",0,"']'","'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
327 | 0,0,0,0,0,0,0,"'{'","'|'","'}'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
328 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
329 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, | |||
330 | 0,0,0,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", | |||
331 | "SCDECL","XSCDECL","NAME","PREVCCL","EOF_OP","OPTION_OP","OPT_OUTFILE", | |||
332 | "OPT_PREFIX","OPT_YYCLASS","OPT_HEADER","OPT_EXTRA_TYPE","OPT_TABLES", | |||
333 | "CCE_ALNUM","CCE_ALPHA","CCE_BLANK","CCE_CNTRL","CCE_DIGIT","CCE_GRAPH", | |||
334 | "CCE_LOWER","CCE_PRINT","CCE_PUNCT","CCE_SPACE","CCE_UPPER","CCE_XDIGIT", | |||
335 | "CCE_NEG_ALNUM","CCE_NEG_ALPHA","CCE_NEG_BLANK","CCE_NEG_CNTRL","CCE_NEG_DIGIT", | |||
336 | "CCE_NEG_GRAPH","CCE_NEG_LOWER","CCE_NEG_PRINT","CCE_NEG_PUNCT","CCE_NEG_SPACE", | |||
337 | "CCE_NEG_UPPER","CCE_NEG_XDIGIT","CCL_OP_DIFF","CCL_OP_UNION", | |||
338 | "BEGIN_REPEAT_POSIX","END_REPEAT_POSIX","BEGIN_REPEAT_FLEX","END_REPEAT_FLEX", | |||
339 | }; | |||
340 | const char * const yyrule[] = | |||
341 | {"$accept : goal", | |||
342 | "goal : initlex sect1 sect1end sect2 initforrule", | |||
343 | "initlex :", | |||
344 | "sect1 : sect1 startconddecl namelist1", | |||
345 | "sect1 : sect1 options", | |||
346 | "sect1 :", | |||
347 | "sect1 : error", | |||
348 | "sect1end : SECTEND", | |||
349 | "startconddecl : SCDECL", | |||
350 | "startconddecl : XSCDECL", | |||
351 | "namelist1 : namelist1 NAME", | |||
352 | "namelist1 : NAME", | |||
353 | "namelist1 : error", | |||
354 | "options : OPTION_OP optionlist", | |||
355 | "optionlist : optionlist option", | |||
356 | "optionlist :", | |||
357 | "option : OPT_OUTFILE '=' NAME", | |||
358 | "option : OPT_EXTRA_TYPE '=' NAME", | |||
359 | "option : OPT_PREFIX '=' NAME", | |||
360 | "option : OPT_YYCLASS '=' NAME", | |||
361 | "option : OPT_HEADER '=' NAME", | |||
362 | "option : OPT_TABLES '=' NAME", | |||
363 | "sect2 : sect2 scon initforrule flexrule '\\n'", | |||
364 | "sect2 : sect2 scon '{' sect2 '}'", | |||
365 | "sect2 :", | |||
366 | "initforrule :", | |||
367 | "flexrule : '^' rule", | |||
368 | "flexrule : rule", | |||
369 | "flexrule : EOF_OP", | |||
370 | "flexrule : error", | |||
371 | "scon_stk_ptr :", | |||
372 | "scon : '<' scon_stk_ptr namelist2 '>'", | |||
373 | "scon : '<' '*' '>'", | |||
374 | "scon :", | |||
375 | "namelist2 : namelist2 ',' sconname", | |||
376 | "namelist2 : sconname", | |||
377 | "namelist2 : error", | |||
378 | "sconname : NAME", | |||
379 | "rule : re2 re", | |||
380 | "rule : re2 re '$'", | |||
381 | "rule : re '$'", | |||
382 | "rule : re", | |||
383 | "re : re '|' series", | |||
384 | "re : series", | |||
385 | "re2 : re '/'", | |||
386 | "series : series singleton", | |||
387 | "series : singleton", | |||
388 | "series : series BEGIN_REPEAT_POSIX NUMBER ',' NUMBER END_REPEAT_POSIX", | |||
389 | "series : series BEGIN_REPEAT_POSIX NUMBER ',' END_REPEAT_POSIX", | |||
390 | "series : series BEGIN_REPEAT_POSIX NUMBER END_REPEAT_POSIX", | |||
391 | "singleton : singleton '*'", | |||
392 | "singleton : singleton '+'", | |||
393 | "singleton : singleton '?'", | |||
394 | "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' NUMBER END_REPEAT_FLEX", | |||
395 | "singleton : singleton BEGIN_REPEAT_FLEX NUMBER ',' END_REPEAT_FLEX", | |||
396 | "singleton : singleton BEGIN_REPEAT_FLEX NUMBER END_REPEAT_FLEX", | |||
397 | "singleton : '.'", | |||
398 | "singleton : fullccl", | |||
399 | "singleton : PREVCCL", | |||
400 | "singleton : '\"' string '\"'", | |||
401 | "singleton : '(' re ')'", | |||
402 | "singleton : CHAR", | |||
403 | "fullccl : fullccl CCL_OP_DIFF braceccl", | |||
404 | "fullccl : fullccl CCL_OP_UNION braceccl", | |||
405 | "fullccl : braceccl", | |||
406 | "braceccl : '[' ccl ']'", | |||
407 | "braceccl : '[' '^' ccl ']'", | |||
408 | "ccl : ccl CHAR '-' CHAR", | |||
409 | "ccl : ccl CHAR", | |||
410 | "ccl : ccl ccl_expr", | |||
411 | "ccl :", | |||
412 | "ccl_expr : CCE_ALNUM", | |||
413 | "ccl_expr : CCE_ALPHA", | |||
414 | "ccl_expr : CCE_BLANK", | |||
415 | "ccl_expr : CCE_CNTRL", | |||
416 | "ccl_expr : CCE_DIGIT", | |||
417 | "ccl_expr : CCE_GRAPH", | |||
418 | "ccl_expr : CCE_LOWER", | |||
419 | "ccl_expr : CCE_PRINT", | |||
420 | "ccl_expr : CCE_PUNCT", | |||
421 | "ccl_expr : CCE_SPACE", | |||
422 | "ccl_expr : CCE_XDIGIT", | |||
423 | "ccl_expr : CCE_UPPER", | |||
424 | "ccl_expr : CCE_NEG_ALNUM", | |||
425 | "ccl_expr : CCE_NEG_ALPHA", | |||
426 | "ccl_expr : CCE_NEG_BLANK", | |||
427 | "ccl_expr : CCE_NEG_CNTRL", | |||
428 | "ccl_expr : CCE_NEG_DIGIT", | |||
429 | "ccl_expr : CCE_NEG_GRAPH", | |||
430 | "ccl_expr : CCE_NEG_PRINT", | |||
431 | "ccl_expr : CCE_NEG_PUNCT", | |||
432 | "ccl_expr : CCE_NEG_SPACE", | |||
433 | "ccl_expr : CCE_NEG_XDIGIT", | |||
434 | "ccl_expr : CCE_NEG_LOWER", | |||
435 | "ccl_expr : CCE_NEG_UPPER", | |||
436 | "string : string CHAR", | |||
437 | "string :", | |||
438 | }; | |||
439 | #endif | |||
440 | #ifndef YYSTYPEint | |||
441 | typedef int YYSTYPEint; | |||
442 | #endif | |||
443 | #ifdef YYSTACKSIZE10000 | |||
444 | #undef YYMAXDEPTH10000 | |||
445 | #define YYMAXDEPTH10000 YYSTACKSIZE10000 | |||
446 | #else | |||
447 | #ifdef YYMAXDEPTH10000 | |||
448 | #define YYSTACKSIZE10000 YYMAXDEPTH10000 | |||
449 | #else | |||
450 | #define YYSTACKSIZE10000 10000 | |||
451 | #define YYMAXDEPTH10000 10000 | |||
452 | #endif | |||
453 | #endif | |||
454 | #define YYINITSTACKSIZE200 200 | |||
455 | /* LINTUSED */ | |||
456 | int yydebug; | |||
457 | int yynerrs; | |||
458 | int yyerrflag; | |||
459 | int yychar; | |||
460 | short *yyssp; | |||
461 | YYSTYPEint *yyvsp; | |||
462 | YYSTYPEint yyval; | |||
463 | YYSTYPEint yylval; | |||
464 | short *yyss; | |||
465 | short *yysslim; | |||
466 | YYSTYPEint *yyvs; | |||
467 | unsigned int yystacksize; | |||
468 | int yyparse(void); | |||
469 | #line 947 "/usr/src/usr.bin/lex/parse.y" | |||
470 | ||||
471 | ||||
472 | /* build_eof_action - build the "<<EOF>>" action for the active start | |||
473 | * conditions | |||
474 | */ | |||
475 | ||||
476 | void build_eof_action() | |||
477 | { | |||
478 | int i; | |||
479 | char action_text[MAXLINE2048]; | |||
480 | ||||
481 | for ( i = 1; i <= scon_stk_ptr; ++i ) | |||
482 | { | |||
483 | if ( sceof[scon_stk[i]] ) | |||
484 | format_pinpoint_message( | |||
485 | "multiple <<EOF>> rules for start condition %s", | |||
486 | scname[scon_stk[i]] ); | |||
487 | ||||
488 | else | |||
489 | { | |||
490 | sceof[scon_stk[i]] = true1; | |||
491 | ||||
492 | if (previous_continued_action /* && previous action was regular */) | |||
493 | add_action("YY_RULE_SETUP\n"); | |||
494 | ||||
495 | snprintf( action_text, sizeof(action_text), "case YY_STATE_EOF(%s):\n", | |||
496 | scname[scon_stk[i]] ); | |||
497 | add_action( action_text ); | |||
498 | } | |||
499 | } | |||
500 | ||||
501 | line_directive_out( (FILE *) 0, 1 ); | |||
502 | ||||
503 | /* This isn't a normal rule after all - don't count it as | |||
504 | * such, so we don't have any holes in the rule numbering | |||
505 | * (which make generating "rule can never match" warnings | |||
506 | * more difficult. | |||
507 | */ | |||
508 | --num_rules; | |||
509 | ++num_eof_rules; | |||
510 | } | |||
511 | ||||
512 | ||||
513 | /* format_synerr - write out formatted syntax error */ | |||
514 | ||||
515 | void format_synerr( msg, arg ) | |||
516 | const char *msg, arg[]; | |||
517 | { | |||
518 | char errmsg[MAXLINE2048]; | |||
519 | ||||
520 | (void) snprintf( errmsg, sizeof(errmsg), msg, arg ); | |||
521 | synerr( errmsg ); | |||
522 | } | |||
523 | ||||
524 | ||||
525 | /* synerr - report a syntax error */ | |||
526 | ||||
527 | void synerr( str ) | |||
528 | const char *str; | |||
529 | { | |||
530 | syntaxerror = true1; | |||
531 | pinpoint_message( str ); | |||
532 | } | |||
533 | ||||
534 | ||||
535 | /* format_warn - write out formatted warning */ | |||
536 | ||||
537 | void format_warn( msg, arg ) | |||
538 | const char *msg, arg[]; | |||
539 | { | |||
540 | char warn_msg[MAXLINE2048]; | |||
541 | ||||
542 | snprintf( warn_msg, sizeof(warn_msg), msg, arg ); | |||
543 | warn( warn_msg ); | |||
544 | } | |||
545 | ||||
546 | ||||
547 | /* warn - report a warning, unless -w was given */ | |||
548 | ||||
549 | void warn( str ) | |||
550 | const char *str; | |||
551 | { | |||
552 | line_warning( str, linenum ); | |||
553 | } | |||
554 | ||||
555 | /* format_pinpoint_message - write out a message formatted with one string, | |||
556 | * pinpointing its location | |||
557 | */ | |||
558 | ||||
559 | void format_pinpoint_message( msg, arg ) | |||
560 | const char *msg, arg[]; | |||
561 | { | |||
562 | char errmsg[MAXLINE2048]; | |||
563 | ||||
564 | snprintf( errmsg, sizeof(errmsg), msg, arg ); | |||
565 | pinpoint_message( errmsg ); | |||
566 | } | |||
567 | ||||
568 | ||||
569 | /* pinpoint_message - write out a message, pinpointing its location */ | |||
570 | ||||
571 | void pinpoint_message( str ) | |||
572 | const char *str; | |||
573 | { | |||
574 | line_pinpoint( str, linenum ); | |||
575 | } | |||
576 | ||||
577 | ||||
578 | /* line_warning - report a warning at a given line, unless -w was given */ | |||
579 | ||||
580 | void line_warning( str, line ) | |||
581 | const char *str; | |||
582 | int line; | |||
583 | { | |||
584 | char warning[MAXLINE2048]; | |||
585 | ||||
586 | if ( ! nowarn ) | |||
587 | { | |||
588 | snprintf( warning, sizeof(warning), "warning, %s", str ); | |||
589 | line_pinpoint( warning, line ); | |||
590 | } | |||
591 | } | |||
592 | ||||
593 | ||||
594 | /* line_pinpoint - write out a message, pinpointing it at the given line */ | |||
595 | ||||
596 | void line_pinpoint( str, line ) | |||
597 | const char *str; | |||
598 | int line; | |||
599 | { | |||
600 | fprintf( stderr(&__sF[2]), "%s:%d: %s\n", infilename, line, str ); | |||
601 | } | |||
602 | ||||
603 | ||||
604 | /* yyerror - eat up an error message from the parser; | |||
605 | * currently, messages are ignore | |||
606 | */ | |||
607 | ||||
608 | void yyerror( msg ) | |||
609 | const char *msg; | |||
610 | { | |||
611 | } | |||
612 | #line 605 "parse.c" | |||
613 | /* allocate initial stack or double stack size, up to YYMAXDEPTH */ | |||
614 | static int yygrowstack(void) | |||
615 | { | |||
616 | unsigned int newsize; | |||
617 | long sslen; | |||
618 | short *newss; | |||
619 | YYSTYPEint *newvs; | |||
620 | ||||
621 | if ((newsize = yystacksize) == 0) | |||
622 | newsize = YYINITSTACKSIZE200; | |||
623 | else if (newsize >= YYMAXDEPTH10000) | |||
624 | return -1; | |||
625 | else if ((newsize *= 2) > YYMAXDEPTH10000) | |||
626 | newsize = YYMAXDEPTH10000; | |||
627 | sslen = yyssp - yyss; | |||
628 | #ifdef SIZE_MAX0xffffffffffffffffUL | |||
629 | #define YY_SIZE_MAX0xffffffffffffffffUL SIZE_MAX0xffffffffffffffffUL | |||
630 | #else | |||
631 | #define YY_SIZE_MAX0xffffffffffffffffUL 0xffffffffU | |||
632 | #endif | |||
633 | if (newsize && YY_SIZE_MAX0xffffffffffffffffUL / newsize < sizeof *newss) | |||
634 | goto bail; | |||
635 | newss = (short *)realloc(yyss, newsize * sizeof *newss); | |||
636 | if (newss == NULL((void *)0)) | |||
637 | goto bail; | |||
638 | yyss = newss; | |||
639 | yyssp = newss + sslen; | |||
640 | if (newsize
| |||
641 | goto bail; | |||
642 | newvs = (YYSTYPEint *)realloc(yyvs, newsize * sizeof *newvs); | |||
643 | if (newvs == NULL((void *)0)) | |||
644 | goto bail; | |||
645 | yyvs = newvs; | |||
646 | yyvsp = newvs + sslen; | |||
647 | yystacksize = newsize; | |||
648 | yysslim = yyss + newsize - 1; | |||
649 | return 0; | |||
650 | bail: | |||
651 | if (yyss) | |||
652 | free(yyss); | |||
653 | if (yyvs) | |||
654 | free(yyvs); | |||
655 | yyss = yyssp = NULL((void *)0); | |||
656 | yyvs = yyvsp = NULL((void *)0); | |||
657 | yystacksize = 0; | |||
658 | return -1; | |||
659 | } | |||
660 | ||||
661 | #define YYABORTgoto yyabort goto yyabort | |||
662 | #define YYREJECTgoto yyabort goto yyabort | |||
663 | #define YYACCEPTgoto yyaccept goto yyaccept | |||
664 | #define YYERRORgoto yyerrlab goto yyerrlab | |||
665 | int | |||
666 | yyparse(void) | |||
667 | { | |||
668 | int yym, yyn, yystate; | |||
669 | #if YYDEBUG0 | |||
670 | const char *yys; | |||
671 | ||||
672 | if ((yys = getenv("YYDEBUG"))) | |||
673 | { | |||
674 | yyn = *yys; | |||
675 | if (yyn >= '0' && yyn <= '9') | |||
676 | yydebug = yyn - '0'; | |||
677 | } | |||
678 | #endif /* YYDEBUG */ | |||
679 | ||||
680 | yynerrs = 0; | |||
681 | yyerrflag = 0; | |||
682 | yychar = (-1); | |||
683 | ||||
684 | if (yyss == NULL((void *)0) && yygrowstack()) goto yyoverflow; | |||
| ||||
685 | yyssp = yyss; | |||
686 | yyvsp = yyvs; | |||
687 | *yyssp = yystate = 0; | |||
| ||||
688 | ||||
689 | yyloop: | |||
690 | if ((yyn = yydefred[yystate]) != 0) goto yyreduce; | |||
691 | if (yychar < 0) | |||
692 | { | |||
693 | if ((yychar = yylex()) < 0) yychar = 0; | |||
694 | #if YYDEBUG0 | |||
695 | if (yydebug) | |||
696 | { | |||
697 | yys = 0; | |||
698 | if (yychar <= YYMAXTOKEN301) yys = yyname[yychar]; | |||
699 | if (!yys) yys = "illegal-symbol"; | |||
700 | printf("%sdebug: state %d, reading %d (%s)\n", | |||
701 | YYPREFIX"yy", yystate, yychar, yys); | |||
702 | } | |||
703 | #endif | |||
704 | } | |||
705 | if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && | |||
706 | yyn <= YYTABLESIZE419 && yycheck[yyn] == yychar) | |||
707 | { | |||
708 | #if YYDEBUG0 | |||
709 | if (yydebug) | |||
710 | printf("%sdebug: state %d, shifting to state %d\n", | |||
711 | YYPREFIX"yy", yystate, yytable[yyn]); | |||
712 | #endif | |||
713 | if (yyssp >= yysslim && yygrowstack()) | |||
714 | { | |||
715 | goto yyoverflow; | |||
716 | } | |||
717 | *++yyssp = yystate = yytable[yyn]; | |||
718 | *++yyvsp = yylval; | |||
719 | yychar = (-1); | |||
720 | if (yyerrflag > 0) --yyerrflag; | |||
721 | goto yyloop; | |||
722 | } | |||
723 | if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && | |||
724 | yyn <= YYTABLESIZE419 && yycheck[yyn] == yychar) | |||
725 | { | |||
726 | yyn = yytable[yyn]; | |||
727 | goto yyreduce; | |||
728 | } | |||
729 | if (yyerrflag) goto yyinrecovery; | |||
730 | #if defined(__GNUC__4) | |||
731 | goto yynewerror; | |||
732 | #endif | |||
733 | yynewerror: | |||
734 | yyerror("syntax error"); | |||
735 | #if defined(__GNUC__4) | |||
736 | goto yyerrlab; | |||
737 | #endif | |||
738 | yyerrlab: | |||
739 | ++yynerrs; | |||
740 | yyinrecovery: | |||
741 | if (yyerrflag < 3) | |||
742 | { | |||
743 | yyerrflag = 3; | |||
744 | for (;;) | |||
745 | { | |||
746 | if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE256) >= 0 && | |||
747 | yyn <= YYTABLESIZE419 && yycheck[yyn] == YYERRCODE256) | |||
748 | { | |||
749 | #if YYDEBUG0 | |||
750 | if (yydebug) | |||
751 | printf("%sdebug: state %d, error recovery shifting\ | |||
752 | to state %d\n", YYPREFIX"yy", *yyssp, yytable[yyn]); | |||
753 | #endif | |||
754 | if (yyssp >= yysslim && yygrowstack()) | |||
755 | { | |||
756 | goto yyoverflow; | |||
757 | } | |||
758 | *++yyssp = yystate = yytable[yyn]; | |||
759 | *++yyvsp = yylval; | |||
760 | goto yyloop; | |||
761 | } | |||
762 | else | |||
763 | { | |||
764 | #if YYDEBUG0 | |||
765 | if (yydebug) | |||
766 | printf("%sdebug: error recovery discarding state %d\n", | |||
767 | YYPREFIX"yy", *yyssp); | |||
768 | #endif | |||
769 | if (yyssp <= yyss) goto yyabort; | |||
770 | --yyssp; | |||
771 | --yyvsp; | |||
772 | } | |||
773 | } | |||
774 | } | |||
775 | else | |||
776 | { | |||
777 | if (yychar == 0) goto yyabort; | |||
778 | #if YYDEBUG0 | |||
779 | if (yydebug) | |||
780 | { | |||
781 | yys = 0; | |||
782 | if (yychar <= YYMAXTOKEN301) yys = yyname[yychar]; | |||
783 | if (!yys) yys = "illegal-symbol"; | |||
784 | printf("%sdebug: state %d, error recovery discards token %d (%s)\n", | |||
785 | YYPREFIX"yy", yystate, yychar, yys); | |||
786 | } | |||
787 | #endif | |||
788 | yychar = (-1); | |||
789 | goto yyloop; | |||
790 | } | |||
791 | yyreduce: | |||
792 | #if YYDEBUG0 | |||
793 | if (yydebug) | |||
794 | printf("%sdebug: state %d, reducing by rule %d (%s)\n", | |||
795 | YYPREFIX"yy", yystate, yyn, yyrule[yyn]); | |||
796 | #endif | |||
797 | yym = yylen[yyn]; | |||
798 | if (yym) | |||
799 | yyval = yyvsp[1-yym]; | |||
800 | else | |||
801 | memset(&yyval, 0, sizeof yyval); | |||
802 | switch (yyn) | |||
803 | { | |||
804 | case 1: | |||
805 | #line 118 "/usr/src/usr.bin/lex/parse.y" | |||
806 | { /* add default rule */ | |||
807 | int def_rule; | |||
808 | ||||
809 | pat = cclinit(); | |||
810 | cclnegate( pat ); | |||
811 | ||||
812 | def_rule = mkstate( -pat ); | |||
813 | ||||
814 | /* Remember the number of the default rule so we | |||
815 | * don't generate "can't match" warnings for it. | |||
816 | */ | |||
817 | default_rule = num_rules; | |||
818 | ||||
819 | finish_rule( def_rule, false0, 0, 0, 0); | |||
820 | ||||
821 | for ( i = 1; i <= lastsc; ++i ) | |||
822 | scset[i] = mkbranch( scset[i], def_rule ); | |||
823 | ||||
824 | if ( spprdflt ) | |||
825 | add_action( | |||
826 | "YY_FATAL_ERROR( \"flex scanner jammed\" )" ); | |||
827 | else | |||
828 | add_action( "ECHO" ); | |||
829 | ||||
830 | add_action( ";\n\tYY_BREAK\n" ); | |||
831 | } | |||
832 | break; | |||
833 | case 2: | |||
834 | #line 147 "/usr/src/usr.bin/lex/parse.y" | |||
835 | { /* initialize for processing rules */ | |||
836 | ||||
837 | /* Create default DFA start condition. */ | |||
838 | scinstal( "INITIAL", false0 ); | |||
839 | } | |||
840 | break; | |||
841 | case 6: | |||
842 | #line 158 "/usr/src/usr.bin/lex/parse.y" | |||
843 | { synerr( _("unknown error processing section 1")"unknown error processing section 1" ); } | |||
844 | break; | |||
845 | case 7: | |||
846 | #line 162 "/usr/src/usr.bin/lex/parse.y" | |||
847 | { | |||
848 | check_options(); | |||
849 | scon_stk = allocate_integer_array( lastsc + 1 )(int *) allocate_array( lastsc + 1, sizeof( int ) ); | |||
850 | scon_stk_ptr = 0; | |||
851 | } | |||
852 | break; | |||
853 | case 8: | |||
854 | #line 170 "/usr/src/usr.bin/lex/parse.y" | |||
855 | { xcluflg = false0; } | |||
856 | break; | |||
857 | case 9: | |||
858 | #line 173 "/usr/src/usr.bin/lex/parse.y" | |||
859 | { xcluflg = true1; } | |||
860 | break; | |||
861 | case 10: | |||
862 | #line 177 "/usr/src/usr.bin/lex/parse.y" | |||
863 | { scinstal( nmstr, xcluflg ); } | |||
864 | break; | |||
865 | case 11: | |||
866 | #line 180 "/usr/src/usr.bin/lex/parse.y" | |||
867 | { scinstal( nmstr, xcluflg ); } | |||
868 | break; | |||
869 | case 12: | |||
870 | #line 183 "/usr/src/usr.bin/lex/parse.y" | |||
871 | { synerr( _("bad start condition list")"bad start condition list" ); } | |||
872 | break; | |||
873 | case 16: | |||
874 | #line 194 "/usr/src/usr.bin/lex/parse.y" | |||
875 | { | |||
876 | outfilename = copy_string( nmstr ); | |||
877 | did_outfilename = 1; | |||
878 | } | |||
879 | break; | |||
880 | case 17: | |||
881 | #line 199 "/usr/src/usr.bin/lex/parse.y" | |||
882 | { extra_type = copy_string( nmstr ); } | |||
883 | break; | |||
884 | case 18: | |||
885 | #line 201 "/usr/src/usr.bin/lex/parse.y" | |||
886 | { prefix = copy_string( nmstr ); } | |||
887 | break; | |||
888 | case 19: | |||
889 | #line 203 "/usr/src/usr.bin/lex/parse.y" | |||
890 | { yyclass = copy_string( nmstr ); } | |||
891 | break; | |||
892 | case 20: | |||
893 | #line 205 "/usr/src/usr.bin/lex/parse.y" | |||
894 | { headerfilename = copy_string( nmstr ); } | |||
895 | break; | |||
896 | case 21: | |||
897 | #line 207 "/usr/src/usr.bin/lex/parse.y" | |||
898 | { tablesext = true1; tablesfilename = copy_string( nmstr ); } | |||
899 | break; | |||
900 | case 22: | |||
901 | #line 211 "/usr/src/usr.bin/lex/parse.y" | |||
902 | { scon_stk_ptr = yyvsp[-3]; } | |||
903 | break; | |||
904 | case 23: | |||
905 | #line 213 "/usr/src/usr.bin/lex/parse.y" | |||
906 | { scon_stk_ptr = yyvsp[-3]; } | |||
907 | break; | |||
908 | case 25: | |||
909 | #line 218 "/usr/src/usr.bin/lex/parse.y" | |||
910 | { | |||
911 | /* Initialize for a parse of one rule. */ | |||
912 | trlcontxt = variable_trail_rule = varlength = false0; | |||
913 | trailcnt = headcnt = rulelen = 0; | |||
914 | current_state_type = STATE_NORMAL0x1; | |||
915 | previous_continued_action = continued_action; | |||
916 | in_rule = true1; | |||
917 | ||||
918 | new_rule(); | |||
919 | } | |||
920 | break; | |||
921 | case 26: | |||
922 | #line 231 "/usr/src/usr.bin/lex/parse.y" | |||
923 | { | |||
924 | pat = yyvsp[0]; | |||
925 | finish_rule( pat, variable_trail_rule, | |||
926 | headcnt, trailcnt , previous_continued_action); | |||
927 | ||||
928 | if ( scon_stk_ptr > 0 ) | |||
929 | { | |||
930 | for ( i = 1; i <= scon_stk_ptr; ++i ) | |||
931 | scbol[scon_stk[i]] = | |||
932 | mkbranch( scbol[scon_stk[i]], | |||
933 | pat ); | |||
934 | } | |||
935 | ||||
936 | else | |||
937 | { | |||
938 | /* Add to all non-exclusive start conditions, | |||
939 | * including the default (0) start condition. | |||
940 | */ | |||
941 | ||||
942 | for ( i = 1; i <= lastsc; ++i ) | |||
943 | if ( ! scxclu[i] ) | |||
944 | scbol[i] = mkbranch( scbol[i], | |||
945 | pat ); | |||
946 | } | |||
947 | ||||
948 | if ( ! bol_needed ) | |||
949 | { | |||
950 | bol_needed = true1; | |||
951 | ||||
952 | if ( performance_report > 1 ) | |||
953 | pinpoint_message( | |||
954 | "'^' operator results in sub-optimal performance" ); | |||
955 | } | |||
956 | } | |||
957 | break; | |||
958 | case 27: | |||
959 | #line 267 "/usr/src/usr.bin/lex/parse.y" | |||
960 | { | |||
961 | pat = yyvsp[0]; | |||
962 | finish_rule( pat, variable_trail_rule, | |||
963 | headcnt, trailcnt , previous_continued_action); | |||
964 | ||||
965 | if ( scon_stk_ptr > 0 ) | |||
966 | { | |||
967 | for ( i = 1; i <= scon_stk_ptr; ++i ) | |||
968 | scset[scon_stk[i]] = | |||
969 | mkbranch( scset[scon_stk[i]], | |||
970 | pat ); | |||
971 | } | |||
972 | ||||
973 | else | |||
974 | { | |||
975 | for ( i = 1; i <= lastsc; ++i ) | |||
976 | if ( ! scxclu[i] ) | |||
977 | scset[i] = | |||
978 | mkbranch( scset[i], | |||
979 | pat ); | |||
980 | } | |||
981 | } | |||
982 | break; | |||
983 | case 28: | |||
984 | #line 291 "/usr/src/usr.bin/lex/parse.y" | |||
985 | { | |||
986 | if ( scon_stk_ptr > 0 ) | |||
987 | build_eof_action(); | |||
988 | ||||
989 | else | |||
990 | { | |||
991 | /* This EOF applies to all start conditions | |||
992 | * which don't already have EOF actions. | |||
993 | */ | |||
994 | for ( i = 1; i <= lastsc; ++i ) | |||
995 | if ( ! sceof[i] ) | |||
996 | scon_stk[++scon_stk_ptr] = i; | |||
997 | ||||
998 | if ( scon_stk_ptr == 0 ) | |||
999 | warn( | |||
1000 | "all start conditions already have <<EOF>> rules" ); | |||
1001 | ||||
1002 | else | |||
1003 | build_eof_action(); | |||
1004 | } | |||
1005 | } | |||
1006 | break; | |||
1007 | case 29: | |||
1008 | #line 314 "/usr/src/usr.bin/lex/parse.y" | |||
1009 | { synerr( _("unrecognized rule")"unrecognized rule" ); } | |||
1010 | break; | |||
1011 | case 30: | |||
1012 | #line 318 "/usr/src/usr.bin/lex/parse.y" | |||
1013 | { yyval = scon_stk_ptr; } | |||
1014 | break; | |||
1015 | case 31: | |||
1016 | #line 322 "/usr/src/usr.bin/lex/parse.y" | |||
1017 | { yyval = yyvsp[-2]; } | |||
1018 | break; | |||
1019 | case 32: | |||
1020 | #line 325 "/usr/src/usr.bin/lex/parse.y" | |||
1021 | { | |||
1022 | yyval = scon_stk_ptr; | |||
1023 | ||||
1024 | for ( i = 1; i <= lastsc; ++i ) | |||
1025 | { | |||
1026 | int j; | |||
1027 | ||||
1028 | for ( j = 1; j <= scon_stk_ptr; ++j ) | |||
1029 | if ( scon_stk[j] == i ) | |||
1030 | break; | |||
1031 | ||||
1032 | if ( j > scon_stk_ptr ) | |||
1033 | scon_stk[++scon_stk_ptr] = i; | |||
1034 | } | |||
1035 | } | |||
1036 | break; | |||
1037 | case 33: | |||
1038 | #line 342 "/usr/src/usr.bin/lex/parse.y" | |||
1039 | { yyval = scon_stk_ptr; } | |||
1040 | break; | |||
1041 | case 36: | |||
1042 | #line 350 "/usr/src/usr.bin/lex/parse.y" | |||
1043 | { synerr( _("bad start condition list")"bad start condition list" ); } | |||
1044 | break; | |||
1045 | case 37: | |||
1046 | #line 354 "/usr/src/usr.bin/lex/parse.y" | |||
1047 | { | |||
1048 | if ( (scnum = sclookup( nmstr )) == 0 ) | |||
1049 | format_pinpoint_message( | |||
1050 | "undeclared start condition %s", | |||
1051 | nmstr ); | |||
1052 | else | |||
1053 | { | |||
1054 | for ( i = 1; i <= scon_stk_ptr; ++i ) | |||
1055 | if ( scon_stk[i] == scnum ) | |||
1056 | { | |||
1057 | format_warn( | |||
1058 | "<%s> specified twice", | |||
1059 | scname[scnum] ); | |||
1060 | break; | |||
1061 | } | |||
1062 | ||||
1063 | if ( i > scon_stk_ptr ) | |||
1064 | scon_stk[++scon_stk_ptr] = scnum; | |||
1065 | } | |||
1066 | } | |||
1067 | break; | |||
1068 | case 38: | |||
1069 | #line 377 "/usr/src/usr.bin/lex/parse.y" | |||
1070 | { | |||
1071 | if ( transchar[lastst[yyvsp[0]]] != SYM_EPSILON(256 + 1) ) | |||
1072 | /* Provide final transition \now/ so it | |||
1073 | * will be marked as a trailing context | |||
1074 | * state. | |||
1075 | */ | |||
1076 | yyvsp[0] = link_machines( yyvsp[0], | |||
1077 | mkstate( SYM_EPSILON(256 + 1) ) ); | |||
1078 | ||||
1079 | mark_beginning_as_normal( yyvsp[0] ); | |||
1080 | current_state_type = STATE_NORMAL0x1; | |||
1081 | ||||
1082 | if ( previous_continued_action ) | |||
1083 | { | |||
1084 | /* We need to treat this as variable trailing | |||
1085 | * context so that the backup does not happen | |||
1086 | * in the action but before the action switch | |||
1087 | * statement. If the backup happens in the | |||
1088 | * action, then the rules "falling into" this | |||
1089 | * one's action will *also* do the backup, | |||
1090 | * erroneously. | |||
1091 | */ | |||
1092 | if ( ! varlength || headcnt != 0 ) | |||
1093 | warn( | |||
1094 | "trailing context made variable due to preceding '|' action" ); | |||
1095 | ||||
1096 | /* Mark as variable. */ | |||
1097 | varlength = true1; | |||
1098 | headcnt = 0; | |||
1099 | ||||
1100 | } | |||
1101 | ||||
1102 | if ( lex_compat || (varlength && headcnt == 0) ) | |||
1103 | { /* variable trailing context rule */ | |||
1104 | /* Mark the first part of the rule as the | |||
1105 | * accepting "head" part of a trailing | |||
1106 | * context rule. | |||
1107 | * | |||
1108 | * By the way, we didn't do this at the | |||
1109 | * beginning of this production because back | |||
1110 | * then current_state_type was set up for a | |||
1111 | * trail rule, and add_accept() can create | |||
1112 | * a new state ... | |||
1113 | */ | |||
1114 | add_accept( yyvsp[-1], | |||
1115 | num_rules | YY_TRAILING_HEAD_MASK0x4000 ); | |||
1116 | variable_trail_rule = true1; | |||
1117 | } | |||
1118 | ||||
1119 | else | |||
1120 | trailcnt = rulelen; | |||
1121 | ||||
1122 | yyval = link_machines( yyvsp[-1], yyvsp[0] ); | |||
1123 | } | |||
1124 | break; | |||
1125 | case 39: | |||
1126 | #line 433 "/usr/src/usr.bin/lex/parse.y" | |||
1127 | { synerr( _("trailing context used twice")"trailing context used twice" ); } | |||
1128 | break; | |||
1129 | case 40: | |||
1130 | #line 436 "/usr/src/usr.bin/lex/parse.y" | |||
1131 | { | |||
1132 | headcnt = 0; | |||
1133 | trailcnt = 1; | |||
1134 | rulelen = 1; | |||
1135 | varlength = false0; | |||
1136 | ||||
1137 | current_state_type = STATE_TRAILING_CONTEXT0x2; | |||
1138 | ||||
1139 | if ( trlcontxt ) | |||
1140 | { | |||
1141 | synerr( _("trailing context used twice")"trailing context used twice" ); | |||
1142 | yyval = mkstate( SYM_EPSILON(256 + 1) ); | |||
1143 | } | |||
1144 | ||||
1145 | else if ( previous_continued_action ) | |||
1146 | { | |||
1147 | /* See the comment in the rule for "re2 re" | |||
1148 | * above. | |||
1149 | */ | |||
1150 | warn( | |||
1151 | "trailing context made variable due to preceding '|' action" ); | |||
1152 | ||||
1153 | varlength = true1; | |||
1154 | } | |||
1155 | ||||
1156 | if ( lex_compat || varlength ) | |||
1157 | { | |||
1158 | /* Again, see the comment in the rule for | |||
1159 | * "re2 re" above. | |||
1160 | */ | |||
1161 | add_accept( yyvsp[-1], | |||
1162 | num_rules | YY_TRAILING_HEAD_MASK0x4000 ); | |||
1163 | variable_trail_rule = true1; | |||
1164 | } | |||
1165 | ||||
1166 | trlcontxt = true1; | |||
1167 | ||||
1168 | eps = mkstate( SYM_EPSILON(256 + 1) ); | |||
1169 | yyval = link_machines( yyvsp[-1], | |||
1170 | link_machines( eps, mkstate( '\n' ) ) ); | |||
1171 | } | |||
1172 | break; | |||
1173 | case 41: | |||
1174 | #line 479 "/usr/src/usr.bin/lex/parse.y" | |||
1175 | { | |||
1176 | yyval = yyvsp[0]; | |||
1177 | ||||
1178 | if ( trlcontxt ) | |||
1179 | { | |||
1180 | if ( lex_compat || (varlength && headcnt == 0) ) | |||
1181 | /* Both head and trail are | |||
1182 | * variable-length. | |||
1183 | */ | |||
1184 | variable_trail_rule = true1; | |||
1185 | else | |||
1186 | trailcnt = rulelen; | |||
1187 | } | |||
1188 | } | |||
1189 | break; | |||
1190 | case 42: | |||
1191 | #line 497 "/usr/src/usr.bin/lex/parse.y" | |||
1192 | { | |||
1193 | varlength = true1; | |||
1194 | yyval = mkor( yyvsp[-2], yyvsp[0] ); | |||
1195 | } | |||
1196 | break; | |||
1197 | case 43: | |||
1198 | #line 503 "/usr/src/usr.bin/lex/parse.y" | |||
1199 | { yyval = yyvsp[0]; } | |||
1200 | break; | |||
1201 | case 44: | |||
1202 | #line 508 "/usr/src/usr.bin/lex/parse.y" | |||
1203 | { | |||
1204 | /* This rule is written separately so the | |||
1205 | * reduction will occur before the trailing | |||
1206 | * series is parsed. | |||
1207 | */ | |||
1208 | ||||
1209 | if ( trlcontxt ) | |||
1210 | synerr( _("trailing context used twice")"trailing context used twice" ); | |||
1211 | else | |||
1212 | trlcontxt = true1; | |||
1213 | ||||
1214 | if ( varlength ) | |||
1215 | /* We hope the trailing context is | |||
1216 | * fixed-length. | |||
1217 | */ | |||
1218 | varlength = false0; | |||
1219 | else | |||
1220 | headcnt = rulelen; | |||
1221 | ||||
1222 | rulelen = 0; | |||
1223 | ||||
1224 | current_state_type = STATE_TRAILING_CONTEXT0x2; | |||
1225 | yyval = yyvsp[-1]; | |||
1226 | } | |||
1227 | break; | |||
1228 | case 45: | |||
1229 | #line 535 "/usr/src/usr.bin/lex/parse.y" | |||
1230 | { | |||
1231 | /* This is where concatenation of adjacent patterns | |||
1232 | * gets done. | |||
1233 | */ | |||
1234 | yyval = link_machines( yyvsp[-1], yyvsp[0] ); | |||
1235 | } | |||
1236 | break; | |||
1237 | case 46: | |||
1238 | #line 543 "/usr/src/usr.bin/lex/parse.y" | |||
1239 | { yyval = yyvsp[0]; } | |||
1240 | break; | |||
1241 | case 47: | |||
1242 | #line 546 "/usr/src/usr.bin/lex/parse.y" | |||
1243 | { | |||
1244 | varlength = true1; | |||
1245 | ||||
1246 | if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 ) | |||
1247 | { | |||
1248 | synerr( _("bad iteration values")"bad iteration values" ); | |||
1249 | yyval = yyvsp[-5]; | |||
1250 | } | |||
1251 | else | |||
1252 | { | |||
1253 | if ( yyvsp[-3] == 0 ) | |||
1254 | { | |||
1255 | if ( yyvsp[-1] <= 0 ) | |||
1256 | { | |||
1257 | synerr( | |||
1258 | _("bad iteration values")"bad iteration values" ); | |||
1259 | yyval = yyvsp[-5]; | |||
1260 | } | |||
1261 | else | |||
1262 | yyval = mkopt( | |||
1263 | mkrep( yyvsp[-5], 1, yyvsp[-1] ) ); | |||
1264 | } | |||
1265 | else | |||
1266 | yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] ); | |||
1267 | } | |||
1268 | } | |||
1269 | break; | |||
1270 | case 48: | |||
1271 | #line 574 "/usr/src/usr.bin/lex/parse.y" | |||
1272 | { | |||
1273 | varlength = true1; | |||
1274 | ||||
1275 | if ( yyvsp[-2] <= 0 ) | |||
1276 | { | |||
1277 | synerr( _("iteration value must be positive")"iteration value must be positive" ); | |||
1278 | yyval = yyvsp[-4]; | |||
1279 | } | |||
1280 | ||||
1281 | else | |||
1282 | yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITE_REPEAT-1 ); | |||
1283 | } | |||
1284 | break; | |||
1285 | case 49: | |||
1286 | #line 588 "/usr/src/usr.bin/lex/parse.y" | |||
1287 | { | |||
1288 | /* The series could be something like "(foo)", | |||
1289 | * in which case we have no idea what its length | |||
1290 | * is, so we punt here. | |||
1291 | */ | |||
1292 | varlength = true1; | |||
1293 | ||||
1294 | if ( yyvsp[-1] <= 0 ) | |||
1295 | { | |||
1296 | synerr( _("iteration value must be positive")"iteration value must be positive" | |||
1297 | ); | |||
1298 | yyval = yyvsp[-3]; | |||
1299 | } | |||
1300 | ||||
1301 | else | |||
1302 | yyval = link_machines( yyvsp[-3], | |||
1303 | copysingl( yyvsp[-3], yyvsp[-1] - 1 ) ); | |||
1304 | } | |||
1305 | break; | |||
1306 | case 50: | |||
1307 | #line 610 "/usr/src/usr.bin/lex/parse.y" | |||
1308 | { | |||
1309 | varlength = true1; | |||
1310 | ||||
1311 | yyval = mkclos( yyvsp[-1] ); | |||
1312 | } | |||
1313 | break; | |||
1314 | case 51: | |||
1315 | #line 617 "/usr/src/usr.bin/lex/parse.y" | |||
1316 | { | |||
1317 | varlength = true1; | |||
1318 | yyval = mkposcl( yyvsp[-1] ); | |||
1319 | } | |||
1320 | break; | |||
1321 | case 52: | |||
1322 | #line 623 "/usr/src/usr.bin/lex/parse.y" | |||
1323 | { | |||
1324 | varlength = true1; | |||
1325 | yyval = mkopt( yyvsp[-1] ); | |||
1326 | } | |||
1327 | break; | |||
1328 | case 53: | |||
1329 | #line 629 "/usr/src/usr.bin/lex/parse.y" | |||
1330 | { | |||
1331 | varlength = true1; | |||
1332 | ||||
1333 | if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 ) | |||
1334 | { | |||
1335 | synerr( _("bad iteration values")"bad iteration values" ); | |||
1336 | yyval = yyvsp[-5]; | |||
1337 | } | |||
1338 | else | |||
1339 | { | |||
1340 | if ( yyvsp[-3] == 0 ) | |||
1341 | { | |||
1342 | if ( yyvsp[-1] <= 0 ) | |||
1343 | { | |||
1344 | synerr( | |||
1345 | _("bad iteration values")"bad iteration values" ); | |||
1346 | yyval = yyvsp[-5]; | |||
1347 | } | |||
1348 | else | |||
1349 | yyval = mkopt( | |||
1350 | mkrep( yyvsp[-5], 1, yyvsp[-1] ) ); | |||
1351 | } | |||
1352 | else | |||
1353 | yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] ); | |||
1354 | } | |||
1355 | } | |||
1356 | break; | |||
1357 | case 54: | |||
1358 | #line 657 "/usr/src/usr.bin/lex/parse.y" | |||
1359 | { | |||
1360 | varlength = true1; | |||
1361 | ||||
1362 | if ( yyvsp[-2] <= 0 ) | |||
1363 | { | |||
1364 | synerr( _("iteration value must be positive")"iteration value must be positive" ); | |||
1365 | yyval = yyvsp[-4]; | |||
1366 | } | |||
1367 | ||||
1368 | else | |||
1369 | yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITE_REPEAT-1 ); | |||
1370 | } | |||
1371 | break; | |||
1372 | case 55: | |||
1373 | #line 671 "/usr/src/usr.bin/lex/parse.y" | |||
1374 | { | |||
1375 | /* The singleton could be something like "(foo)", | |||
1376 | * in which case we have no idea what its length | |||
1377 | * is, so we punt here. | |||
1378 | */ | |||
1379 | varlength = true1; | |||
1380 | ||||
1381 | if ( yyvsp[-1] <= 0 ) | |||
1382 | { | |||
1383 | synerr( _("iteration value must be positive")"iteration value must be positive" ); | |||
1384 | yyval = yyvsp[-3]; | |||
1385 | } | |||
1386 | ||||
1387 | else | |||
1388 | yyval = link_machines( yyvsp[-3], | |||
1389 | copysingl( yyvsp[-3], yyvsp[-1] - 1 ) ); | |||
1390 | } | |||
1391 | break; | |||
1392 | case 56: | |||
1393 | #line 690 "/usr/src/usr.bin/lex/parse.y" | |||
1394 | { | |||
1395 | if ( ! madeany ) | |||
1396 | { | |||
1397 | /* Create the '.' character class. */ | |||
1398 | ccldot = cclinit(); | |||
1399 | ccladd( ccldot, '\n' ); | |||
1400 | cclnegate( ccldot ); | |||
1401 | ||||
1402 | if ( useecs ) | |||
1403 | mkeccl( ccltbl + cclmap[ccldot], | |||
1404 | ccllen[ccldot], nextecm, | |||
1405 | ecgroup, csize, csize ); | |||
1406 | ||||
1407 | /* Create the (?s:'.') character class. */ | |||
1408 | cclany = cclinit(); | |||
1409 | cclnegate( cclany ); | |||
1410 | ||||
1411 | if ( useecs ) | |||
1412 | mkeccl( ccltbl + cclmap[cclany], | |||
1413 | ccllen[cclany], nextecm, | |||
1414 | ecgroup, csize, csize ); | |||
1415 | ||||
1416 | madeany = true1; | |||
1417 | } | |||
1418 | ||||
1419 | ++rulelen; | |||
1420 | ||||
1421 | if (sf_dot_all()((_sf_stk[_sf_top_ix]) & 0x0002)) | |||
1422 | yyval = mkstate( -cclany ); | |||
1423 | else | |||
1424 | yyval = mkstate( -ccldot ); | |||
1425 | } | |||
1426 | break; | |||
1427 | case 57: | |||
1428 | #line 724 "/usr/src/usr.bin/lex/parse.y" | |||
1429 | { | |||
1430 | /* Sort characters for fast searching. | |||
1431 | */ | |||
1432 | qsort( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], sizeof (*ccltbl), cclcmp ); | |||
1433 | ||||
1434 | if ( useecs ) | |||
1435 | mkeccl( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], | |||
1436 | nextecm, ecgroup, csize, csize ); | |||
1437 | ||||
1438 | ++rulelen; | |||
1439 | ||||
1440 | if (ccl_has_nl[yyvsp[0]]) | |||
1441 | rule_has_nl[num_rules] = true1; | |||
1442 | ||||
1443 | yyval = mkstate( -yyvsp[0] ); | |||
1444 | } | |||
1445 | break; | |||
1446 | case 58: | |||
1447 | #line 742 "/usr/src/usr.bin/lex/parse.y" | |||
1448 | { | |||
1449 | ++rulelen; | |||
1450 | ||||
1451 | if (ccl_has_nl[yyvsp[0]]) | |||
1452 | rule_has_nl[num_rules] = true1; | |||
1453 | ||||
1454 | yyval = mkstate( -yyvsp[0] ); | |||
1455 | } | |||
1456 | break; | |||
1457 | case 59: | |||
1458 | #line 752 "/usr/src/usr.bin/lex/parse.y" | |||
1459 | { yyval = yyvsp[-1]; } | |||
1460 | break; | |||
1461 | case 60: | |||
1462 | #line 755 "/usr/src/usr.bin/lex/parse.y" | |||
1463 | { yyval = yyvsp[-1]; } | |||
1464 | break; | |||
1465 | case 61: | |||
1466 | #line 758 "/usr/src/usr.bin/lex/parse.y" | |||
1467 | { | |||
1468 | ++rulelen; | |||
1469 | ||||
1470 | if (yyvsp[0] == nlch) | |||
1471 | rule_has_nl[num_rules] = true1; | |||
1472 | ||||
1473 | if (sf_case_ins()((_sf_stk[_sf_top_ix]) & 0x0001) && has_case(yyvsp[0])) | |||
1474 | /* create an alternation, as in (a|A) */ | |||
1475 | yyval = mkor (mkstate(yyvsp[0]), mkstate(reverse_case(yyvsp[0]))); | |||
1476 | else | |||
1477 | yyval = mkstate( yyvsp[0] ); | |||
1478 | } | |||
1479 | break; | |||
1480 | case 62: | |||
1481 | #line 772 "/usr/src/usr.bin/lex/parse.y" | |||
1482 | { yyval = ccl_set_diff (yyvsp[-2], yyvsp[0]); } | |||
1483 | break; | |||
1484 | case 63: | |||
1485 | #line 773 "/usr/src/usr.bin/lex/parse.y" | |||
1486 | { yyval = ccl_set_union (yyvsp[-2], yyvsp[0]); } | |||
1487 | break; | |||
1488 | case 65: | |||
1489 | #line 779 "/usr/src/usr.bin/lex/parse.y" | |||
1490 | { yyval = yyvsp[-1]; } | |||
1491 | break; | |||
1492 | case 66: | |||
1493 | #line 782 "/usr/src/usr.bin/lex/parse.y" | |||
1494 | { | |||
1495 | cclnegate( yyvsp[-1] ); | |||
1496 | yyval = yyvsp[-1]; | |||
1497 | } | |||
1498 | break; | |||
1499 | case 67: | |||
1500 | #line 789 "/usr/src/usr.bin/lex/parse.y" | |||
1501 | { | |||
1502 | ||||
1503 | if (sf_case_ins()((_sf_stk[_sf_top_ix]) & 0x0001)) | |||
1504 | { | |||
1505 | ||||
1506 | /* If one end of the range has case and the other | |||
1507 | * does not, or the cases are different, then we're not | |||
1508 | * sure what range the user is trying to express. | |||
1509 | * Examples: [@-z] or [S-t] | |||
1510 | */ | |||
1511 | if (has_case (yyvsp[-2]) != has_case (yyvsp[0]) | |||
1512 | || (has_case (yyvsp[-2]) && (b_islower (yyvsp[-2])(islower(yyvsp[-2])?1:0) != b_islower (yyvsp[0])(islower(yyvsp[0])?1:0))) | |||
1513 | || (has_case (yyvsp[-2]) && (b_isupper (yyvsp[-2])(isupper(yyvsp[-2])?1:0) != b_isupper (yyvsp[0])(isupper(yyvsp[0])?1:0)))) | |||
1514 | format_warn3 (do{ char fw3_msg[2048]; snprintf( fw3_msg, 2048,("the character range [%c-%c] is ambiguous in a case-insensitive scanner" ), (yyvsp[-2]), (yyvsp[0]) ); warn( fw3_msg ); }while(0) | |||
1515 | _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),do{ char fw3_msg[2048]; snprintf( fw3_msg, 2048,("the character range [%c-%c] is ambiguous in a case-insensitive scanner" ), (yyvsp[-2]), (yyvsp[0]) ); warn( fw3_msg ); }while(0) | |||
1516 | yyvsp[-2], yyvsp[0])do{ char fw3_msg[2048]; snprintf( fw3_msg, 2048,("the character range [%c-%c] is ambiguous in a case-insensitive scanner" ), (yyvsp[-2]), (yyvsp[0]) ); warn( fw3_msg ); }while(0); | |||
1517 | ||||
1518 | /* If the range spans uppercase characters but not | |||
1519 | * lowercase (or vice-versa), then should we automatically | |||
1520 | * include lowercase characters in the range? | |||
1521 | * Example: [@-_] spans [a-z] but not [A-Z] | |||
1522 | */ | |||
1523 | else if (!has_case (yyvsp[-2]) && !has_case (yyvsp[0]) && !range_covers_case (yyvsp[-2], yyvsp[0])) | |||
1524 | format_warn3 (do{ char fw3_msg[2048]; snprintf( fw3_msg, 2048,("the character range [%c-%c] is ambiguous in a case-insensitive scanner" ), (yyvsp[-2]), (yyvsp[0]) ); warn( fw3_msg ); }while(0) | |||
1525 | _("the character range [%c-%c] is ambiguous in a case-insensitive scanner"),do{ char fw3_msg[2048]; snprintf( fw3_msg, 2048,("the character range [%c-%c] is ambiguous in a case-insensitive scanner" ), (yyvsp[-2]), (yyvsp[0]) ); warn( fw3_msg ); }while(0) | |||
1526 | yyvsp[-2], yyvsp[0])do{ char fw3_msg[2048]; snprintf( fw3_msg, 2048,("the character range [%c-%c] is ambiguous in a case-insensitive scanner" ), (yyvsp[-2]), (yyvsp[0]) ); warn( fw3_msg ); }while(0); | |||
1527 | } | |||
1528 | ||||
1529 | if ( yyvsp[-2] > yyvsp[0] ) | |||
1530 | synerr( _("negative range in character class")"negative range in character class" ); | |||
1531 | ||||
1532 | else | |||
1533 | { | |||
1534 | for ( i = yyvsp[-2]; i <= yyvsp[0]; ++i ) | |||
1535 | ccladd( yyvsp[-3], i ); | |||
1536 | ||||
1537 | /* Keep track if this ccl is staying in | |||
1538 | * alphabetical order. | |||
1539 | */ | |||
1540 | cclsorted = cclsorted && (yyvsp[-2] > lastchar); | |||
1541 | lastchar = yyvsp[0]; | |||
1542 | ||||
1543 | /* Do it again for upper/lowercase */ | |||
1544 | if (sf_case_ins()((_sf_stk[_sf_top_ix]) & 0x0001) && has_case(yyvsp[-2]) && has_case(yyvsp[0])){ | |||
1545 | yyvsp[-2] = reverse_case (yyvsp[-2]); | |||
1546 | yyvsp[0] = reverse_case (yyvsp[0]); | |||
1547 | ||||
1548 | for ( i = yyvsp[-2]; i <= yyvsp[0]; ++i ) | |||
1549 | ccladd( yyvsp[-3], i ); | |||
1550 | ||||
1551 | cclsorted = cclsorted && (yyvsp[-2] > lastchar); | |||
1552 | lastchar = yyvsp[0]; | |||
1553 | } | |||
1554 | ||||
1555 | } | |||
1556 | ||||
1557 | yyval = yyvsp[-3]; | |||
1558 | } | |||
1559 | break; | |||
1560 | case 68: | |||
1561 | #line 849 "/usr/src/usr.bin/lex/parse.y" | |||
1562 | { | |||
1563 | ccladd( yyvsp[-1], yyvsp[0] ); | |||
1564 | cclsorted = cclsorted && (yyvsp[0] > lastchar); | |||
1565 | lastchar = yyvsp[0]; | |||
1566 | ||||
1567 | /* Do it again for upper/lowercase */ | |||
1568 | if (sf_case_ins()((_sf_stk[_sf_top_ix]) & 0x0001) && has_case(yyvsp[0])){ | |||
1569 | yyvsp[0] = reverse_case (yyvsp[0]); | |||
1570 | ccladd (yyvsp[-1], yyvsp[0]); | |||
1571 | ||||
1572 | cclsorted = cclsorted && (yyvsp[0] > lastchar); | |||
1573 | lastchar = yyvsp[0]; | |||
1574 | } | |||
1575 | ||||
1576 | yyval = yyvsp[-1]; | |||
1577 | } | |||
1578 | break; | |||
1579 | case 69: | |||
1580 | #line 867 "/usr/src/usr.bin/lex/parse.y" | |||
1581 | { | |||
1582 | /* Too hard to properly maintain cclsorted. */ | |||
1583 | cclsorted = false0; | |||
1584 | yyval = yyvsp[-1]; | |||
1585 | } | |||
1586 | break; | |||
1587 | case 70: | |||
1588 | #line 874 "/usr/src/usr.bin/lex/parse.y" | |||
1589 | { | |||
1590 | cclsorted = true1; | |||
1591 | lastchar = 0; | |||
1592 | currccl = yyval = cclinit(); | |||
1593 | } | |||
1594 | break; | |||
1595 | case 71: | |||
1596 | #line 882 "/usr/src/usr.bin/lex/parse.y" | |||
1597 | { CCL_EXPR(isalnum)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isalnum(c) ) ccladd( currccl, c ); }while(0); } | |||
1598 | break; | |||
1599 | case 72: | |||
1600 | #line 883 "/usr/src/usr.bin/lex/parse.y" | |||
1601 | { CCL_EXPR(isalpha)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isalpha(c) ) ccladd( currccl, c ); }while(0); } | |||
1602 | break; | |||
1603 | case 73: | |||
1604 | #line 884 "/usr/src/usr.bin/lex/parse.y" | |||
1605 | { CCL_EXPR(isblank)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isblank(c) ) ccladd( currccl, c ); }while(0); } | |||
1606 | break; | |||
1607 | case 74: | |||
1608 | #line 885 "/usr/src/usr.bin/lex/parse.y" | |||
1609 | { CCL_EXPR(iscntrl)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && iscntrl(c) ) ccladd( currccl, c ); }while(0); } | |||
1610 | break; | |||
1611 | case 75: | |||
1612 | #line 886 "/usr/src/usr.bin/lex/parse.y" | |||
1613 | { CCL_EXPR(isdigit)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isdigit(c) ) ccladd( currccl, c ); }while(0); } | |||
1614 | break; | |||
1615 | case 76: | |||
1616 | #line 887 "/usr/src/usr.bin/lex/parse.y" | |||
1617 | { CCL_EXPR(isgraph)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isgraph(c) ) ccladd( currccl, c ); }while(0); } | |||
1618 | break; | |||
1619 | case 77: | |||
1620 | #line 888 "/usr/src/usr.bin/lex/parse.y" | |||
1621 | { | |||
1622 | CCL_EXPR(islower)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && islower(c) ) ccladd( currccl, c ); }while(0); | |||
1623 | if (sf_case_ins()((_sf_stk[_sf_top_ix]) & 0x0001)) | |||
1624 | CCL_EXPR(isupper)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isupper(c) ) ccladd( currccl, c ); }while(0); | |||
1625 | } | |||
1626 | break; | |||
1627 | case 78: | |||
1628 | #line 893 "/usr/src/usr.bin/lex/parse.y" | |||
1629 | { CCL_EXPR(isprint)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isprint(c) ) ccladd( currccl, c ); }while(0); } | |||
1630 | break; | |||
1631 | case 79: | |||
1632 | #line 894 "/usr/src/usr.bin/lex/parse.y" | |||
1633 | { CCL_EXPR(ispunct)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && ispunct(c) ) ccladd( currccl, c ); }while(0); } | |||
1634 | break; | |||
1635 | case 80: | |||
1636 | #line 895 "/usr/src/usr.bin/lex/parse.y" | |||
1637 | { CCL_EXPR(isspace)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isspace(c) ) ccladd( currccl, c ); }while(0); } | |||
1638 | break; | |||
1639 | case 81: | |||
1640 | #line 896 "/usr/src/usr.bin/lex/parse.y" | |||
1641 | { CCL_EXPR(isxdigit)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isxdigit(c) ) ccladd( currccl, c ); }while(0); } | |||
1642 | break; | |||
1643 | case 82: | |||
1644 | #line 897 "/usr/src/usr.bin/lex/parse.y" | |||
1645 | { | |||
1646 | CCL_EXPR(isupper)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && isupper(c) ) ccladd( currccl, c ); }while(0); | |||
1647 | if (sf_case_ins()((_sf_stk[_sf_top_ix]) & 0x0001)) | |||
1648 | CCL_EXPR(islower)do{ int c; for ( c = 0; c < csize; ++c ) if ( ((c) <= 0177 ) && islower(c) ) ccladd( currccl, c ); }while(0); | |||
1649 | } | |||
1650 | break; | |||
1651 | case 83: | |||
1652 | #line 903 "/usr/src/usr.bin/lex/parse.y" | |||
1653 | { CCL_NEG_EXPR(isalnum)do{ int c; for ( c = 0; c < csize; ++c ) if ( !isalnum(c) ) ccladd( currccl, c ); }while(0); } | |||
1654 | break; | |||
1655 | case 84: | |||
1656 | #line 904 "/usr/src/usr.bin/lex/parse.y" | |||
1657 | { CCL_NEG_EXPR(isalpha)do{ int c; for ( c = 0; c < csize; ++c ) if ( !isalpha(c) ) ccladd( currccl, c ); }while(0); } | |||
1658 | break; | |||
1659 | case 85: | |||
1660 | #line 905 "/usr/src/usr.bin/lex/parse.y" | |||
1661 | { CCL_NEG_EXPR(isblank)do{ int c; for ( c = 0; c < csize; ++c ) if ( !isblank(c) ) ccladd( currccl, c ); }while(0); } | |||
1662 | break; | |||
1663 | case 86: | |||
1664 | #line 906 "/usr/src/usr.bin/lex/parse.y" | |||
1665 | { CCL_NEG_EXPR(iscntrl)do{ int c; for ( c = 0; c < csize; ++c ) if ( !iscntrl(c) ) ccladd( currccl, c ); }while(0); } | |||
1666 | break; | |||
1667 | case 87: | |||
1668 | #line 907 "/usr/src/usr.bin/lex/parse.y" | |||
1669 | { CCL_NEG_EXPR(isdigit)do{ int c; for ( c = 0; c < csize; ++c ) if ( !isdigit(c) ) ccladd( currccl, c ); }while(0); } | |||
1670 | break; | |||
1671 | case 88: | |||
1672 | #line 908 "/usr/src/usr.bin/lex/parse.y" | |||
1673 | { CCL_NEG_EXPR(isgraph)do{ int c; for ( c = 0; c < csize; ++c ) if ( !isgraph(c) ) ccladd( currccl, c ); }while(0); } | |||
1674 | break; | |||
1675 | case 89: | |||
1676 | #line 909 "/usr/src/usr.bin/lex/parse.y" | |||
1677 | { CCL_NEG_EXPR(isprint)do{ int c; for ( c = 0; c < csize; ++c ) if ( !isprint(c) ) ccladd( currccl, c ); }while(0); } | |||
1678 | break; | |||
1679 | case 90: | |||
1680 | #line 910 "/usr/src/usr.bin/lex/parse.y" | |||
1681 | { CCL_NEG_EXPR(ispunct)do{ int c; for ( c = 0; c < csize; ++c ) if ( !ispunct(c) ) ccladd( currccl, c ); }while(0); } | |||
1682 | break; | |||
1683 | case 91: | |||
1684 | #line 911 "/usr/src/usr.bin/lex/parse.y" | |||
1685 | { CCL_NEG_EXPR(isspace)do{ int c; for ( c = 0; c < csize; ++c ) if ( !isspace(c) ) ccladd( currccl, c ); }while(0); } | |||
1686 | break; | |||
1687 | case 92: | |||
1688 | #line 912 "/usr/src/usr.bin/lex/parse.y" | |||
1689 | { CCL_NEG_EXPR(isxdigit)do{ int c; for ( c = 0; c < csize; ++c ) if ( !isxdigit(c) ) ccladd( currccl, c ); }while(0); } | |||
1690 | break; | |||
1691 | case 93: | |||
1692 | #line 913 "/usr/src/usr.bin/lex/parse.y" | |||
1693 | { | |||
1694 | if ( sf_case_ins()((_sf_stk[_sf_top_ix]) & 0x0001) ) | |||
1695 | warn(_("[:^lower:] is ambiguous in case insensitive scanner")"[:^lower:] is ambiguous in case insensitive scanner"); | |||
1696 | else | |||
1697 | CCL_NEG_EXPR(islower)do{ int c; for ( c = 0; c < csize; ++c ) if ( !islower(c) ) ccladd( currccl, c ); }while(0); | |||
1698 | } | |||
1699 | break; | |||
1700 | case 94: | |||
1701 | #line 919 "/usr/src/usr.bin/lex/parse.y" | |||
1702 | { | |||
1703 | if ( sf_case_ins()((_sf_stk[_sf_top_ix]) & 0x0001) ) | |||
1704 | warn(_("[:^upper:] ambiguous in case insensitive scanner")"[:^upper:] ambiguous in case insensitive scanner"); | |||
1705 | else | |||
1706 | CCL_NEG_EXPR(isupper)do{ int c; for ( c = 0; c < csize; ++c ) if ( !isupper(c) ) ccladd( currccl, c ); }while(0); | |||
1707 | } | |||
1708 | break; | |||
1709 | case 95: | |||
1710 | #line 928 "/usr/src/usr.bin/lex/parse.y" | |||
1711 | { | |||
1712 | if ( yyvsp[0] == nlch ) | |||
1713 | rule_has_nl[num_rules] = true1; | |||
1714 | ||||
1715 | ++rulelen; | |||
1716 | ||||
1717 | if (sf_case_ins()((_sf_stk[_sf_top_ix]) & 0x0001) && has_case(yyvsp[0])) | |||
1718 | yyval = mkor (mkstate(yyvsp[0]), mkstate(reverse_case(yyvsp[0]))); | |||
1719 | else | |||
1720 | yyval = mkstate (yyvsp[0]); | |||
1721 | ||||
1722 | yyval = link_machines( yyvsp[-1], yyval); | |||
1723 | } | |||
1724 | break; | |||
1725 | case 96: | |||
1726 | #line 943 "/usr/src/usr.bin/lex/parse.y" | |||
1727 | { yyval = mkstate( SYM_EPSILON(256 + 1) ); } | |||
1728 | break; | |||
1729 | #line 1722 "parse.c" | |||
1730 | } | |||
1731 | yyssp -= yym; | |||
1732 | yystate = *yyssp; | |||
1733 | yyvsp -= yym; | |||
1734 | yym = yylhs[yyn]; | |||
1735 | if (yystate == 0 && yym == 0) | |||
1736 | { | |||
1737 | #if YYDEBUG0 | |||
1738 | if (yydebug) | |||
1739 | printf("%sdebug: after reduction, shifting from state 0 to\ | |||
1740 | state %d\n", YYPREFIX"yy", YYFINAL1); | |||
1741 | #endif | |||
1742 | yystate = YYFINAL1; | |||
1743 | *++yyssp = YYFINAL1; | |||
1744 | *++yyvsp = yyval; | |||
1745 | if (yychar < 0) | |||
1746 | { | |||
1747 | if ((yychar = yylex()) < 0) yychar = 0; | |||
1748 | #if YYDEBUG0 | |||
1749 | if (yydebug) | |||
1750 | { | |||
1751 | yys = 0; | |||
1752 | if (yychar <= YYMAXTOKEN301) yys = yyname[yychar]; | |||
1753 | if (!yys) yys = "illegal-symbol"; | |||
1754 | printf("%sdebug: state %d, reading %d (%s)\n", | |||
1755 | YYPREFIX"yy", YYFINAL1, yychar, yys); | |||
1756 | } | |||
1757 | #endif | |||
1758 | } | |||
1759 | if (yychar == 0) goto yyaccept; | |||
1760 | goto yyloop; | |||
1761 | } | |||
1762 | if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && | |||
1763 | yyn <= YYTABLESIZE419 && yycheck[yyn] == yystate) | |||
1764 | yystate = yytable[yyn]; | |||
1765 | else | |||
1766 | yystate = yydgoto[yym]; | |||
1767 | #if YYDEBUG0 | |||
1768 | if (yydebug) | |||
1769 | printf("%sdebug: after reduction, shifting from state %d \ | |||
1770 | to state %d\n", YYPREFIX"yy", *yyssp, yystate); | |||
1771 | #endif | |||
1772 | if (yyssp >= yysslim && yygrowstack()) | |||
1773 | { | |||
1774 | goto yyoverflow; | |||
1775 | } | |||
1776 | *++yyssp = yystate; | |||
1777 | *++yyvsp = yyval; | |||
1778 | goto yyloop; | |||
1779 | yyoverflow: | |||
1780 | yyerror("yacc stack overflow"); | |||
1781 | yyabort: | |||
1782 | if (yyss) | |||
1783 | free(yyss); | |||
1784 | if (yyvs) | |||
1785 | free(yyvs); | |||
1786 | yyss = yyssp = NULL((void *)0); | |||
1787 | yyvs = yyvsp = NULL((void *)0); | |||
1788 | yystacksize = 0; | |||
1789 | return (1); | |||
1790 | yyaccept: | |||
1791 | if (yyss) | |||
1792 | free(yyss); | |||
1793 | if (yyvs) | |||
1794 | free(yyvs); | |||
1795 | yyss = yyssp = NULL((void *)0); | |||
1796 | yyvs = yyvsp = NULL((void *)0); | |||
1797 | yystacksize = 0; | |||
1798 | return (0); | |||
1799 | } |