GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
#include <stdlib.h> |
||
2 |
#include <string.h> |
||
3 |
#define YYBYACC 1 |
||
4 |
#define YYMAJOR 1 |
||
5 |
#define YYMINOR 9 |
||
6 |
#define YYLEX yylex() |
||
7 |
#define YYEMPTY -1 |
||
8 |
#define yyclearin (yychar=(YYEMPTY)) |
||
9 |
#define yyerrok (yyerrflag=0) |
||
10 |
#define YYRECOVERING() (yyerrflag!=0) |
||
11 |
#define YYPREFIX "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 = false; /* 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) \ |
||
58 |
do{ \ |
||
59 |
char fw3_msg[MAXLINE];\ |
||
60 |
snprintf( fw3_msg, MAXLINE,(fmt), (a1), (a2) );\ |
||
61 |
warn( fw3_msg );\ |
||
62 |
}while(0) |
||
63 |
|||
64 |
/* Expand a POSIX character class expression. */ |
||
65 |
#define CCL_EXPR(func) \ |
||
66 |
do{ \ |
||
67 |
int c; \ |
||
68 |
for ( c = 0; c < csize; ++c ) \ |
||
69 |
if ( isascii(c) && func(c) ) \ |
||
70 |
ccladd( currccl, c ); \ |
||
71 |
}while(0) |
||
72 |
|||
73 |
/* negated class */ |
||
74 |
#define CCL_NEG_EXPR(func) \ |
||
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 YYSTYPE int |
||
89 |
|||
90 |
#line 91 "parse.c" |
||
91 |
#define CHAR 257 |
||
92 |
#define NUMBER 258 |
||
93 |
#define SECTEND 259 |
||
94 |
#define SCDECL 260 |
||
95 |
#define XSCDECL 261 |
||
96 |
#define NAME 262 |
||
97 |
#define PREVCCL 263 |
||
98 |
#define EOF_OP 264 |
||
99 |
#define OPTION_OP 265 |
||
100 |
#define OPT_OUTFILE 266 |
||
101 |
#define OPT_PREFIX 267 |
||
102 |
#define OPT_YYCLASS 268 |
||
103 |
#define OPT_HEADER 269 |
||
104 |
#define OPT_EXTRA_TYPE 270 |
||
105 |
#define OPT_TABLES 271 |
||
106 |
#define CCE_ALNUM 272 |
||
107 |
#define CCE_ALPHA 273 |
||
108 |
#define CCE_BLANK 274 |
||
109 |
#define CCE_CNTRL 275 |
||
110 |
#define CCE_DIGIT 276 |
||
111 |
#define CCE_GRAPH 277 |
||
112 |
#define CCE_LOWER 278 |
||
113 |
#define CCE_PRINT 279 |
||
114 |
#define CCE_PUNCT 280 |
||
115 |
#define CCE_SPACE 281 |
||
116 |
#define CCE_UPPER 282 |
||
117 |
#define CCE_XDIGIT 283 |
||
118 |
#define CCE_NEG_ALNUM 284 |
||
119 |
#define CCE_NEG_ALPHA 285 |
||
120 |
#define CCE_NEG_BLANK 286 |
||
121 |
10 |
#define CCE_NEG_CNTRL 287 |
|
122 |
10 |
#define CCE_NEG_DIGIT 288 |
|
123 |
#define CCE_NEG_GRAPH 289 |
||
124 |
10 |
#define CCE_NEG_LOWER 290 |
|
125 |
#define CCE_NEG_PRINT 291 |
||
126 |
#define CCE_NEG_PUNCT 292 |
||
127 |
#define CCE_NEG_SPACE 293 |
||
128 |
#define CCE_NEG_UPPER 294 |
||
129 |
10 |
#define CCE_NEG_XDIGIT 295 |
|
130 |
#define CCL_OP_DIFF 296 |
||
131 |
10 |
#define CCL_OP_UNION 297 |
|
132 |
#define BEGIN_REPEAT_POSIX 298 |
||
133 |
✓✓ | 84 |
#define END_REPEAT_POSIX 299 |
134 |
32 |
#define BEGIN_REPEAT_FLEX 300 |
|
135 |
#define END_REPEAT_FLEX 301 |
||
136 |
✓✓ | 10 |
#define YYERRCODE 256 |
137 |
2 |
const short yylhs[] = |
|
138 |
{ -1, |
||
139 |
0, 1, 2, 2, 2, 2, 3, 6, 6, 7, |
||
140 |
8 |
7, 7, 8, 9, 9, 10, 10, 10, 10, 10, |
|
141 |
10, 4, 4, 4, 5, 12, 12, 12, 12, 14, |
||
142 |
10 |
11, 11, 11, 15, 15, 15, 16, 13, 13, 13, |
|
143 |
13, 18, 18, 17, 19, 19, 19, 19, 19, 20, |
||
144 |
10 |
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 |
30 |
const short yylen[] = |
|
151 |
{ 2, |
||
152 |
30 |
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 |
30 |
const short yydefred[] = |
|
164 |
30 |
{ 2, |
|
165 |
30 |
0, 0, 6, 0, 7, 8, 9, 15, 24, 0, |
|
166 |
4, 0, 0, 12, 11, 0, 0, 0, 0, 0, |
||
167 |
30 |
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 |
6 |
61, 58, 28, 0, 56, 96, 0, 0, 0, 27, |
|
171 |
6 |
0, 0, 0, 0, 0, 64, 31, 0, 23, 26, |
|
172 |
0, 0, 70, 0, 22, 0, 40, 0, 44, 0, |
||
173 |
12 |
0, 0, 50, 51, 52, 0, 0, 34, 95, 59, |
|
174 |
12 |
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 |
48 |
0, 0, 0, 62, 63, 66, 0, 49, 0, 55, |
|
178 |
48 |
0, 67, 0, 48, 0, 54, 47, 53, |
|
179 |
}; |
||
180 |
18 |
const short yydgoto[] = |
|
181 |
18 |
{ 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 |
564 |
0, 0, 0, 0, 0, 146, 0, 0, 0, 0, |
|
212 |
564 |
18, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
213 |
6 |
0, 0, 124, 0, 0, 0, 0, 0, 0, 0, |
|
214 |
6 |
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 |
574 |
0, 0, 0, 121, 133, 0, 0, 0, 0, 0, |
|
221 |
574 |
0, 0, 106, 0, 0, 93, 0, 32, 84, -45, |
|
222 |
574 |
0, 0, 25, 90, 0, |
|
223 |
574 |
}; |
|
224 |
574 |
#define YYTABLESIZE 419 |
|
225 |
const short yytable[] = |
||
226 |
574 |
{ 57, |
|
227 |
83, 84, 90, 56, 131, 118, 91, 129, 25, 57, |
||
228 |
574 |
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 |
4 |
46, 45, 57, 45, 33, 25, 43, 45, 45, 42, |
|
233 |
8 |
58, 25, 136, 45, 45, 24, 68, 25, 27, 33, |
|
234 |
4 |
28, 58, 33, 58, 54, 81, 69, 30, 36, 134, |
|
235 |
57, 29, 43, 30, 67, 42, 30, 43, 72, 78, |
||
236 |
✗✓ | 4 |
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 |
✓✓ | 36 |
0, 0, 52, 0, 33, 33, 50, 51, 0, 51, |
251 |
✓✓ | 16 |
0, 33, 33, 52, 53, 52, 57, 0, 0, 0, |
252 |
8 |
0, 0, 57, 0, 0, 0, 0, 0, 82, 0, |
|
253 |
4 |
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 |
✓✓ | 4 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
257 |
0, 46, 93, 0, 0, 0, 0, 0, 0, 0, |
||
258 |
1 |
0, 0, 0, 0, 0, 45, 0, 94, 95, 96, |
|
259 |
97, 98, 99, 100, 101, 102, 103, 104, 105, 106, |
||
260 |
✗✓ | 1 |
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 |
546 |
68, 68, 68, 68, 68, 68, 68, 68, 68, |
|
269 |
1092 |
}; |
|
270 |
546 |
const short yycheck[] = |
|
271 |
{ 10, |
||
272 |
✓✓ | 546 |
42, 43, 34, 34, 44, 93, 41, 44, 0, 40, |
273 |
36, 60, 34, 10, 34, 46, 34, 63, 40, 258, |
||
274 |
✓✓ | 364 |
40, 63, 40, 34, 46, 36, 46, 10, 46, 40, |
275 |
126 |
41, 42, 43, 256, 36, 46, 47, 34, 258, 36, |
|
276 |
252 |
256, 256, 34, 40, 41, 47, 262, 262, 40, 46, |
|
277 |
126 |
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 |
✓✓ | 2724 |
42, 123, 94, 259, 260, 261, 296, 297, 91, 265, |
283 |
✓✓ | 1145 |
86, 87, 91, 124, 262, 94, 262, 259, 260, 261, |
284 |
494 |
94, 262, 124, 265, 259, 260, 261, 124, 262, 262, |
|
285 |
988 |
265, 123, 262, 259, 260, 261, 62, 10, 93, 265, |
|
286 |
494 |
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 |
✓✓ | 14 |
288, 289, 290, 291, 292, 293, 294, 295, -1, -1, |
293 |
12 |
-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 |
✓✓ | 18 |
263, -1, -1, -1, 263, 264, -1, 298, -1, 300, |
301 |
✓✓ | 8 |
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
302 |
4 |
-1, 298, 257, -1, -1, -1, -1, -1, -1, -1, |
|
303 |
-1, -1, -1, -1, -1, 298, -1, 272, 273, 274, |
||
304 |
✗✓ | 2 |
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 |
2 |
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 YYFINAL 1 |
||
316 |
#ifndef YYDEBUG |
||
317 |
#define YYDEBUG 0 |
||
318 |
98 |
#endif |
|
319 |
98 |
#define YYMAXTOKEN 301 |
|
320 |
#if YYDEBUG |
||
321 |
const char * const yyname[] = |
||
322 |
98 |
{ |
|
323 |
98 |
"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 |
472 |
"goal : initlex sect1 sect1end sect2 initforrule", |
|
343 |
472 |
"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 |
✗✓ | 112 |
"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 |
✓✓ | 152 |
"option : OPT_HEADER '=' NAME", |
362 |
✗✓ | 20 |
"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 |
✓✗ | 112 |
"flexrule : error", |
371 |
112 |
"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 YYSTYPE |
||
441 |
typedef int YYSTYPE; |
||
442 |
#endif |
||
443 |
#ifdef YYSTACKSIZE |
||
444 |
#undef YYMAXDEPTH |
||
445 |
#define YYMAXDEPTH YYSTACKSIZE |
||
446 |
#else |
||
447 |
#ifdef YYMAXDEPTH |
||
448 |
#define YYSTACKSIZE YYMAXDEPTH |
||
449 |
#else |
||
450 |
#define YYSTACKSIZE 10000 |
||
451 |
#define YYMAXDEPTH 10000 |
||
452 |
#endif |
||
453 |
#endif |
||
454 |
#define YYINITSTACKSIZE 200 |
||
455 |
/* LINTUSED */ |
||
456 |
int yydebug; |
||
457 |
int yynerrs; |
||
458 |
int yyerrflag; |
||
459 |
int yychar; |
||
460 |
short *yyssp; |
||
461 |
YYSTYPE *yyvsp; |
||
462 |
YYSTYPE yyval; |
||
463 |
YYSTYPE yylval; |
||
464 |
short *yyss; |
||
465 |
short *yysslim; |
||
466 |
YYSTYPE *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[MAXLINE]; |
||
480 |
550 |
||
481 |
for ( i = 1; i <= scon_stk_ptr; ++i ) |
||
482 |
✗✓ | 550 |
{ |
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]] = true; |
||
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 |
556 |
} |
|
499 |
556 |
} |
|
500 |
|||
501 |
556 |
line_directive_out( (FILE *) 0, 1 ); |
|
502 |
|||
503 |
2454 |
/* This isn't a normal rule after all - don't count it as |
|
504 |
2454 |
* 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[MAXLINE]; |
||
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 = true; |
||
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 |
5454 |
{ |
|
540 |
char warn_msg[MAXLINE]; |
||
541 |
5454 |
||
542 |
snprintf( warn_msg, sizeof(warn_msg), msg, arg ); |
||
543 |
3010 |
warn( warn_msg ); |
|
544 |
3010 |
} |
|
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[MAXLINE]; |
||
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[MAXLINE]; |
||
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, "%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 |
29 |
} |
|
612 |
#line 605 "parse.c" |
||
613 |
✓✗ | 89 |
/* allocate initial stack or double stack size, up to YYMAXDEPTH */ |
614 |
30 |
static int yygrowstack(void) |
|
615 |
✗✗ | 29 |
{ |
616 |
unsigned int newsize; |
||
617 |
long sslen; |
||
618 |
421 |
short *newss; |
|
619 |
451 |
YYSTYPE *newvs; |
|
620 |
|||
621 |
421 |
if ((newsize = yystacksize) == 0) |
|
622 |
newsize = YYINITSTACKSIZE; |
||
623 |
else if (newsize >= YYMAXDEPTH) |
||
624 |
1528 |
return -1; |
|
625 |
✓✗✓✗ |
1588 |
else if ((newsize *= 2) > YYMAXDEPTH) |
626 |
newsize = YYMAXDEPTH; |
||
627 |
✗✓ | 1588 |
sslen = yyssp - yyss; |
628 |
30 |
#ifdef SIZE_MAX |
|
629 |
✓✗ | 30 |
#define YY_SIZE_MAX SIZE_MAX |
630 |
#else |
||
631 |
30 |
#define YY_SIZE_MAX 0xffffffffU |
|
632 |
✗✗✗✗ |
30 |
#endif |
633 |
✓✗✓✗ |
60 |
if (newsize && YY_SIZE_MAX / newsize < sizeof *newss) |
634 |
goto bail; |
||
635 |
✗✓ | 60 |
newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) : |
636 |
30 |
(short *)malloc(newsize * sizeof *newss); /* overflow check above */ |
|
637 |
✓✗ | 30 |
if (newss == NULL) |
638 |
goto bail; |
||
639 |
✗✗ | 30 |
yyss = newss; |
640 |
30 |
yyssp = newss + sslen; |
|
641 |
✗✗ | 30 |
if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs) |
642 |
30 |
goto bail; |
|
643 |
30 |
newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) : |
|
644 |
(YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */ |
||
645 |
if (newvs == NULL) |
||
646 |
goto bail; |
||
647 |
yyvs = newvs; |
||
648 |
yyvsp = newvs + sslen; |
||
649 |
yystacksize = newsize; |
||
650 |
yysslim = yyss + newsize - 1; |
||
651 |
return 0; |
||
652 |
bail: |
||
653 |
30 |
if (yyss) |
|
654 |
free(yyss); |
||
655 |
if (yyvs) |
||
656 |
free(yyvs); |
||
657 |
yyss = yyssp = NULL; |
||
658 |
yyvs = yyvsp = NULL; |
||
659 |
yystacksize = 0; |
||
660 |
return -1; |
||
661 |
} |
||
662 |
|||
663 |
#define YYABORT goto yyabort |
||
664 |
#define YYREJECT goto yyabort |
||
665 |
#define YYACCEPT goto yyaccept |
||
666 |
#define YYERROR goto yyerrlab |
||
667 |
int |
||
668 |
yyparse(void) |
||
669 |
{ |
||
670 |
int yym, yyn, yystate; |
||
671 |
#if YYDEBUG |
||
672 |
const char *yys; |
||
673 |
|||
674 |
60 |
if ((yys = getenv("YYDEBUG"))) |
|
675 |
30 |
{ |
|
676 |
30 |
yyn = *yys; |
|
677 |
if (yyn >= '0' && yyn <= '9') |
||
678 |
✓✗✓✗ ✗✗ |
60 |
yydebug = yyn - '0'; |
679 |
30 |
} |
|
680 |
30 |
#endif /* YYDEBUG */ |
|
681 |
30 |
||
682 |
yynerrs = 0; |
||
683 |
yyerrflag = 0; |
||
684 |
✓✓ | 78950 |
yychar = (-1); |
685 |
✓✓ | 56714 |
|
686 |
if (yyss == NULL && yygrowstack()) goto yyoverflow; |
||
687 |
38279 |
yyssp = yyss; |
|
688 |
yyvsp = yyvs; |
||
689 |
*yyssp = yystate = 0; |
||
690 |
|||
691 |
✓✓ | 21 |
yyloop: |
692 |
if ((yyn = yydefred[yystate]) != 0) goto yyreduce; |
||
693 |
if (yychar < 0) |
||
694 |
9 |
{ |
|
695 |
9 |
if ((yychar = yylex()) < 0) yychar = 0; |
|
696 |
9 |
#if YYDEBUG |
|
697 |
if (yydebug) |
||
698 |
✓✓ | 38288 |
{ |
699 |
✓✗✓✓ ✓✓ |
222317 |
yys = 0; |
700 |
108882 |
if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
|
701 |
7 |
if (!yys) yys = "illegal-symbol"; |
|
702 |
printf("%sdebug: state %d, reading %d (%s)\n", |
||
703 |
YYPREFIX, yystate, yychar, yys); |
||
704 |
9 |
} |
|
705 |
9 |
#endif |
|
706 |
} |
||
707 |
✗✓✗✗ ✓✓ |
38278 |
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && |
708 |
14 |
yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
|
709 |
7 |
{ |
|
710 |
7 |
#if YYDEBUG |
|
711 |
38269 |
if (yydebug) |
|
712 |
38278 |
printf("%sdebug: state %d, shifting to state %d\n", |
|
713 |
38278 |
YYPREFIX, yystate, yytable[yyn]); |
|
714 |
✓✗ | 38269 |
#endif |
715 |
21 |
if (yyssp >= yysslim && yygrowstack()) |
|
716 |
{ |
||
717 |
✓✗✓✗ ✓✗ |
73801 |
goto yyoverflow; |
718 |
36890 |
} |
|
719 |
*++yyssp = yystate = yytable[yyn]; |
||
720 |
18466 |
*++yyvsp = yylval; |
|
721 |
18445 |
yychar = (-1); |
|
722 |
21 |
if (yyerrflag > 0) --yyerrflag; |
|
723 |
goto yyloop; |
||
724 |
} |
||
725 |
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && |
||
726 |
yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
||
727 |
2516 |
{ |
|
728 |
yyn = yytable[yyn]; |
||
729 |
✓✓ | 2516 |
goto yyreduce; |
730 |
4988 |
} |
|
731 |
2494 |
if (yyerrflag) goto yyinrecovery; |
|
732 |
#if defined(__GNUC__) |
||
733 |
2516 |
goto yynewerror; |
|
734 |
#endif |
||
735 |
✗✗✓✓ |
2516 |
yynewerror: |
736 |
10 |
yyerror("syntax error"); |
|
737 |
#if defined(__GNUC__) |
||
738 |
2516 |
goto yyerrlab; |
|
739 |
#endif |
||
740 |
✗✗✗✗ ✗✗ |
2516 |
yyerrlab: |
741 |
++yynerrs; |
||
742 |
yyinrecovery: |
||
743 |
if (yyerrflag < 3) |
||
744 |
{ |
||
745 |
yyerrflag = 3; |
||
746 |
for (;;) |
||
747 |
{ |
||
748 |
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && |
||
749 |
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) |
||
750 |
{ |
||
751 |
#if YYDEBUG |
||
752 |
186 |
if (yydebug) |
|
753 |
186 |
printf("%sdebug: state %d, error recovery shifting\ |
|
754 |
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); |
||
755 |
1904 |
#endif |
|
756 |
1904 |
if (yyssp >= yysslim && yygrowstack()) |
|
757 |
{ |
||
758 |
goto yyoverflow; |
||
759 |
3837 |
} |
|
760 |
*++yyssp = yystate = yytable[yyn]; |
||
761 |
✓✓ | 3837 |
*++yyvsp = yylval; |
762 |
18 |
goto yyloop; |
|
763 |
} |
||
764 |
✓✓✓✓ |
4888 |
else |
765 |
{ |
||
766 |
843 |
#if YYDEBUG |
|
767 |
if (yydebug) |
||
768 |
2994 |
printf("%sdebug: error recovery discarding state %d\n", |
|
769 |
YYPREFIX, *yyssp); |
||
770 |
3837 |
#endif |
|
771 |
if (yyssp <= yyss) goto yyabort; |
||
772 |
--yyssp; |
||
773 |
--yyvsp; |
||
774 |
} |
||
775 |
} |
||
776 |
} |
||
777 |
else |
||
778 |
{ |
||
779 |
2492 |
if (yychar == 0) goto yyabort; |
|
780 |
2492 |
#if YYDEBUG |
|
781 |
if (yydebug) |
||
782 |
{ |
||
783 |
24 |
yys = 0; |
|
784 |
24 |
if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
|
785 |
if (!yys) yys = "illegal-symbol"; |
||
786 |
24 |
printf("%sdebug: state %d, error recovery discards token %d (%s)\n", |
|
787 |
YYPREFIX, yystate, yychar, yys); |
||
788 |
} |
||
789 |
#endif |
||
790 |
yychar = (-1); |
||
791 |
✓✓ | 47679 |
goto yyloop; |
792 |
✓✓ | 40681 |
} |
793 |
36735 |
yyreduce: |
|
794 |
#if YYDEBUG |
||
795 |
3946 |
if (yydebug) |
|
796 |
✓✓✗✓ ✓✓✓✓ ✗✗✗✗ ✗✗✗✓ ✓✓✓✓ ✓✗✓✓ ✗✓✗✓ ✗✗✗✓ ✓✓✗✓ ✓✗✗✗ ✓✓✓✗ ✗✗✓✓ ✗✓✓✓ ✗✗✓✓ ✓✓✗✓ ✗✗✗✗ ✗✗✗✗ ✗✗✗✗ ✗✗✗✗ ✗✗✗✗ ✗✗✗✗ ✓✓✓ |
78578 |
printf("%sdebug: state %d, reducing by rule %d (%s)\n", |
797 |
YYPREFIX, yystate, yyn, yyrule[yyn]); |
||
798 |
#endif |
||
799 |
✗✓ | 34 |
yym = yylen[yyn]; |
800 |
✓✗✓✓ |
58 |
if (yym) |
801 |
✓✗✓✓ |
44 |
yyval = yyvsp[1-yym]; |
802 |
else |
||
803 |
memset(&yyval, 0, sizeof yyval); |
||
804 |
switch (yyn) |
||
805 |
{ |
||
806 |
case 1: |
||
807 |
#line 118 "/usr/src/usr.bin/lex/parse.y" |
||
808 |
{ /* add default rule */ |
||
809 |
int def_rule; |
||
810 |
|||
811 |
✓✓✓✗ ✗✓ |
52 |
pat = cclinit(); |
812 |
cclnegate( pat ); |
||
813 |
|||
814 |
def_rule = mkstate( -pat ); |
||
815 |
|||
816 |
/* Remember the number of the default rule so we |
||
817 |
✗✓ | 6998 |
* don't generate "can't match" warnings for it. |
818 |
*/ |
||
819 |
default_rule = num_rules; |
||
820 |
|||
821 |
finish_rule( def_rule, false, 0, 0, 0); |
||
822 |
✓✓ | 119088 |
|
823 |
52546 |
for ( i = 1; i <= lastsc; ++i ) |
|
824 |
scset[i] = mkbranch( scset[i], def_rule ); |
||
825 |
|||
826 |
if ( spprdflt ) |
||
827 |
add_action( |
||
828 |
✓✓ | 20973 |
"YY_FATAL_ERROR( \"flex scanner jammed\" )" ); |
829 |
6998 |
else |
|
830 |
add_action( "ECHO" ); |
||
831 |
|||
832 |
✓✓✓✓ ✓✗ |
7032 |
add_action( ";\n\tYY_BREAK\n" ); |
833 |
10 |
} |
|
834 |
10 |
break; |
|
835 |
case 2: |
||
836 |
✓✓ | 540 |
#line 147 "/usr/src/usr.bin/lex/parse.y" |
837 |
260 |
{ /* initialize for processing rules */ |
|
838 |
|||
839 |
✓✓ | 25 |
/* Create default DFA start condition. */ |
840 |
10 |
scinstal( "INITIAL", false ); |
|
841 |
10 |
} |
|
842 |
break; |
||
843 |
case 6: |
||
844 |
#line 158 "/usr/src/usr.bin/lex/parse.y" |
||
845 |
6998 |
{ synerr( _("unknown error processing section 1") ); } |
|
846 |
break; |
||
847 |
6998 |
case 7: |
|
848 |
#line 162 "/usr/src/usr.bin/lex/parse.y" |
||
849 |
{ |
||
850 |
197 |
check_options(); |
|
851 |
✓✓ | 498 |
scon_stk = allocate_integer_array( lastsc + 1 ); |
852 |
197 |
scon_stk_ptr = 0; |
|
853 |
} |
||
854 |
break; |
||
855 |
✓✓✗✓ |
276 |
case 8: |
856 |
#line 170 "/usr/src/usr.bin/lex/parse.y" |
||
857 |
{ xcluflg = false; } |
||
858 |
break; |
||
859 |
case 9: |
||
860 |
#line 173 "/usr/src/usr.bin/lex/parse.y" |
||
861 |
{ xcluflg = true; } |
||
862 |
break; |
||
863 |
197 |
case 10: |
|
864 |
#line 177 "/usr/src/usr.bin/lex/parse.y" |
||
865 |
197 |
{ scinstal( nmstr, xcluflg ); } |
|
866 |
break; |
||
867 |
case 11: |
||
868 |
#line 180 "/usr/src/usr.bin/lex/parse.y" |
||
869 |
{ scinstal( nmstr, xcluflg ); } |
||
870 |
break; |
||
871 |
case 12: |
||
872 |
#line 183 "/usr/src/usr.bin/lex/parse.y" |
||
873 |
{ synerr( _("bad start condition list") ); } |
||
874 |
break; |
||
875 |
2516 |
case 16: |
|
876 |
2516 |
#line 194 "/usr/src/usr.bin/lex/parse.y" |
|
877 |
2516 |
{ |
|
878 |
outfilename = copy_string( nmstr ); |
||
879 |
2516 |
did_outfilename = 1; |
|
880 |
} |
||
881 |
break; |
||
882 |
case 17: |
||
883 |
#line 199 "/usr/src/usr.bin/lex/parse.y" |
||
884 |
{ extra_type = copy_string( nmstr ); } |
||
885 |
break; |
||
886 |
case 18: |
||
887 |
#line 201 "/usr/src/usr.bin/lex/parse.y" |
||
888 |
{ prefix = copy_string( nmstr ); } |
||
889 |
break; |
||
890 |
case 19: |
||
891 |
#line 203 "/usr/src/usr.bin/lex/parse.y" |
||
892 |
{ yyclass = copy_string( nmstr ); } |
||
893 |
break; |
||
894 |
case 20: |
||
895 |
#line 205 "/usr/src/usr.bin/lex/parse.y" |
||
896 |
{ headerfilename = copy_string( nmstr ); } |
||
897 |
break; |
||
898 |
case 21: |
||
899 |
#line 207 "/usr/src/usr.bin/lex/parse.y" |
||
900 |
{ tablesext = true; tablesfilename = copy_string( nmstr ); } |
||
901 |
break; |
||
902 |
case 22: |
||
903 |
#line 211 "/usr/src/usr.bin/lex/parse.y" |
||
904 |
{ scon_stk_ptr = yyvsp[-3]; } |
||
905 |
break; |
||
906 |
case 23: |
||
907 |
#line 213 "/usr/src/usr.bin/lex/parse.y" |
||
908 |
{ scon_stk_ptr = yyvsp[-3]; } |
||
909 |
break; |
||
910 |
case 25: |
||
911 |
#line 218 "/usr/src/usr.bin/lex/parse.y" |
||
912 |
{ |
||
913 |
/* Initialize for a parse of one rule. */ |
||
914 |
trlcontxt = variable_trail_rule = varlength = false; |
||
915 |
trailcnt = headcnt = rulelen = 0; |
||
916 |
current_state_type = STATE_NORMAL; |
||
917 |
previous_continued_action = continued_action; |
||
918 |
in_rule = true; |
||
919 |
|||
920 |
new_rule(); |
||
921 |
} |
||
922 |
break; |
||
923 |
case 26: |
||
924 |
#line 231 "/usr/src/usr.bin/lex/parse.y" |
||
925 |
{ |
||
926 |
pat = yyvsp[0]; |
||
927 |
finish_rule( pat, variable_trail_rule, |
||
928 |
headcnt, trailcnt , previous_continued_action); |
||
929 |
✗✓ | 396 |
|
930 |
if ( scon_stk_ptr > 0 ) |
||
931 |
{ |
||
932 |
396 |
for ( i = 1; i <= scon_stk_ptr; ++i ) |
|
933 |
scbol[scon_stk[i]] = |
||
934 |
✓✓✓✓ |
496 |
mkbranch( scbol[scon_stk[i]], |
935 |
22 |
pat ); |
|
936 |
} |
||
937 |
374 |
||
938 |
else |
||
939 |
396 |
{ |
|
940 |
/* Add to all non-exclusive start conditions, |
||
941 |
396 |
* including the default (0) start condition. |
|
942 |
*/ |
||
943 |
186 |
||
944 |
186 |
for ( i = 1; i <= lastsc; ++i ) |
|
945 |
if ( ! scxclu[i] ) |
||
946 |
scbol[i] = mkbranch( scbol[i], |
||
947 |
pat ); |
||
948 |
} |
||
949 |
|||
950 |
if ( ! bol_needed ) |
||
951 |
{ |
||
952 |
bol_needed = true; |
||
953 |
|||
954 |
if ( performance_report > 1 ) |
||
955 |
pinpoint_message( |
||
956 |
"'^' operator results in sub-optimal performance" ); |
||
957 |
} |
||
958 |
} |
||
959 |
break; |
||
960 |
case 27: |
||
961 |
#line 267 "/usr/src/usr.bin/lex/parse.y" |
||
962 |
{ |
||
963 |
pat = yyvsp[0]; |
||
964 |
finish_rule( pat, variable_trail_rule, |
||
965 |
headcnt, trailcnt , previous_continued_action); |
||
966 |
|||
967 |
if ( scon_stk_ptr > 0 ) |
||
968 |
{ |
||
969 |
for ( i = 1; i <= scon_stk_ptr; ++i ) |
||
970 |
scset[scon_stk[i]] = |
||
971 |
mkbranch( scset[scon_stk[i]], |
||
972 |
pat ); |
||
973 |
} |
||
974 |
|||
975 |
else |
||
976 |
{ |
||
977 |
for ( i = 1; i <= lastsc; ++i ) |
||
978 |
if ( ! scxclu[i] ) |
||
979 |
scset[i] = |
||
980 |
mkbranch( scset[i], |
||
981 |
pat ); |
||
982 |
} |
||
983 |
} |
||
984 |
break; |
||
985 |
case 28: |
||
986 |
#line 291 "/usr/src/usr.bin/lex/parse.y" |
||
987 |
{ |
||
988 |
if ( scon_stk_ptr > 0 ) |
||
989 |
build_eof_action(); |
||
990 |
|||
991 |
else |
||
992 |
{ |
||
993 |
/* This EOF applies to all start conditions |
||
994 |
* which don't already have EOF actions. |
||
995 |
*/ |
||
996 |
for ( i = 1; i <= lastsc; ++i ) |
||
997 |
if ( ! sceof[i] ) |
||
998 |
scon_stk[++scon_stk_ptr] = i; |
||
999 |
|||
1000 |
if ( scon_stk_ptr == 0 ) |
||
1001 |
warn( |
||
1002 |
"all start conditions already have <<EOF>> rules" ); |
||
1003 |
|||
1004 |
else |
||
1005 |
build_eof_action(); |
||
1006 |
} |
||
1007 |
} |
||
1008 |
break; |
||
1009 |
case 29: |
||
1010 |
#line 314 "/usr/src/usr.bin/lex/parse.y" |
||
1011 |
{ synerr( _("unrecognized rule") ); } |
||
1012 |
break; |
||
1013 |
case 30: |
||
1014 |
#line 318 "/usr/src/usr.bin/lex/parse.y" |
||
1015 |
{ yyval = scon_stk_ptr; } |
||
1016 |
break; |
||
1017 |
case 31: |
||
1018 |
#line 322 "/usr/src/usr.bin/lex/parse.y" |
||
1019 |
{ yyval = yyvsp[-2]; } |
||
1020 |
break; |
||
1021 |
case 32: |
||
1022 |
#line 325 "/usr/src/usr.bin/lex/parse.y" |
||
1023 |
{ |
||
1024 |
yyval = scon_stk_ptr; |
||
1025 |
|||
1026 |
for ( i = 1; i <= lastsc; ++i ) |
||
1027 |
{ |
||
1028 |
int j; |
||
1029 |
|||
1030 |
for ( j = 1; j <= scon_stk_ptr; ++j ) |
||
1031 |
if ( scon_stk[j] == i ) |
||
1032 |
break; |
||
1033 |
|||
1034 |
if ( j > scon_stk_ptr ) |
||
1035 |
scon_stk[++scon_stk_ptr] = i; |
||
1036 |
} |
||
1037 |
} |
||
1038 |
break; |
||
1039 |
case 33: |
||
1040 |
#line 342 "/usr/src/usr.bin/lex/parse.y" |
||
1041 |
{ yyval = scon_stk_ptr; } |
||
1042 |
break; |
||
1043 |
case 36: |
||
1044 |
#line 350 "/usr/src/usr.bin/lex/parse.y" |
||
1045 |
{ synerr( _("bad start condition list") ); } |
||
1046 |
break; |
||
1047 |
case 37: |
||
1048 |
#line 354 "/usr/src/usr.bin/lex/parse.y" |
||
1049 |
{ |
||
1050 |
if ( (scnum = sclookup( nmstr )) == 0 ) |
||
1051 |
format_pinpoint_message( |
||
1052 |
"undeclared start condition %s", |
||
1053 |
nmstr ); |
||
1054 |
else |
||
1055 |
{ |
||
1056 |
for ( i = 1; i <= scon_stk_ptr; ++i ) |
||
1057 |
if ( scon_stk[i] == scnum ) |
||
1058 |
{ |
||
1059 |
format_warn( |
||
1060 |
"<%s> specified twice", |
||
1061 |
scname[scnum] ); |
||
1062 |
break; |
||
1063 |
} |
||
1064 |
|||
1065 |
if ( i > scon_stk_ptr ) |
||
1066 |
scon_stk[++scon_stk_ptr] = scnum; |
||
1067 |
} |
||
1068 |
} |
||
1069 |
break; |
||
1070 |
case 38: |
||
1071 |
#line 377 "/usr/src/usr.bin/lex/parse.y" |
||
1072 |
{ |
||
1073 |
if ( transchar[lastst[yyvsp[0]]] != SYM_EPSILON ) |
||
1074 |
/* Provide final transition \now/ so it |
||
1075 |
* will be marked as a trailing context |
||
1076 |
* state. |
||
1077 |
*/ |
||
1078 |
yyvsp[0] = link_machines( yyvsp[0], |
||
1079 |
mkstate( SYM_EPSILON ) ); |
||
1080 |
|||
1081 |
mark_beginning_as_normal( yyvsp[0] ); |
||
1082 |
current_state_type = STATE_NORMAL; |
||
1083 |
|||
1084 |
if ( previous_continued_action ) |
||
1085 |
{ |
||
1086 |
/* We need to treat this as variable trailing |
||
1087 |
* context so that the backup does not happen |
||
1088 |
* in the action but before the action switch |
||
1089 |
* statement. If the backup happens in the |
||
1090 |
* action, then the rules "falling into" this |
||
1091 |
* one's action will *also* do the backup, |
||
1092 |
* erroneously. |
||
1093 |
*/ |
||
1094 |
if ( ! varlength || headcnt != 0 ) |
||
1095 |
warn( |
||
1096 |
"trailing context made variable due to preceding '|' action" ); |
||
1097 |
|||
1098 |
/* Mark as variable. */ |
||
1099 |
varlength = true; |
||
1100 |
headcnt = 0; |
||
1101 |
|||
1102 |
} |
||
1103 |
|||
1104 |
if ( lex_compat || (varlength && headcnt == 0) ) |
||
1105 |
{ /* variable trailing context rule */ |
||
1106 |
/* Mark the first part of the rule as the |
||
1107 |
* accepting "head" part of a trailing |
||
1108 |
* context rule. |
||
1109 |
* |
||
1110 |
* By the way, we didn't do this at the |
||
1111 |
* beginning of this production because back |
||
1112 |
* then current_state_type was set up for a |
||
1113 |
* trail rule, and add_accept() can create |
||
1114 |
* a new state ... |
||
1115 |
*/ |
||
1116 |
add_accept( yyvsp[-1], |
||
1117 |
num_rules | YY_TRAILING_HEAD_MASK ); |
||
1118 |
variable_trail_rule = true; |
||
1119 |
} |
||
1120 |
|||
1121 |
else |
||
1122 |
trailcnt = rulelen; |
||
1123 |
|||
1124 |
yyval = link_machines( yyvsp[-1], yyvsp[0] ); |
||
1125 |
} |
||
1126 |
break; |
||
1127 |
case 39: |
||
1128 |
#line 433 "/usr/src/usr.bin/lex/parse.y" |
||
1129 |
{ synerr( _("trailing context used twice") ); } |
||
1130 |
break; |
||
1131 |
case 40: |
||
1132 |
#line 436 "/usr/src/usr.bin/lex/parse.y" |
||
1133 |
{ |
||
1134 |
headcnt = 0; |
||
1135 |
trailcnt = 1; |
||
1136 |
rulelen = 1; |
||
1137 |
varlength = false; |
||
1138 |
|||
1139 |
current_state_type = STATE_TRAILING_CONTEXT; |
||
1140 |
|||
1141 |
if ( trlcontxt ) |
||
1142 |
{ |
||
1143 |
synerr( _("trailing context used twice") ); |
||
1144 |
yyval = mkstate( SYM_EPSILON ); |
||
1145 |
} |
||
1146 |
|||
1147 |
else if ( previous_continued_action ) |
||
1148 |
{ |
||
1149 |
/* See the comment in the rule for "re2 re" |
||
1150 |
* above. |
||
1151 |
*/ |
||
1152 |
warn( |
||
1153 |
"trailing context made variable due to preceding '|' action" ); |
||
1154 |
|||
1155 |
varlength = true; |
||
1156 |
} |
||
1157 |
|||
1158 |
if ( lex_compat || varlength ) |
||
1159 |
{ |
||
1160 |
/* Again, see the comment in the rule for |
||
1161 |
* "re2 re" above. |
||
1162 |
*/ |
||
1163 |
add_accept( yyvsp[-1], |
||
1164 |
num_rules | YY_TRAILING_HEAD_MASK ); |
||
1165 |
variable_trail_rule = true; |
||
1166 |
} |
||
1167 |
|||
1168 |
trlcontxt = true; |
||
1169 |
|||
1170 |
eps = mkstate( SYM_EPSILON ); |
||
1171 |
yyval = link_machines( yyvsp[-1], |
||
1172 |
link_machines( eps, mkstate( '\n' ) ) ); |
||
1173 |
} |
||
1174 |
break; |
||
1175 |
case 41: |
||
1176 |
#line 479 "/usr/src/usr.bin/lex/parse.y" |
||
1177 |
{ |
||
1178 |
yyval = yyvsp[0]; |
||
1179 |
|||
1180 |
if ( trlcontxt ) |
||
1181 |
{ |
||
1182 |
if ( lex_compat || (varlength && headcnt == 0) ) |
||
1183 |
/* Both head and trail are |
||
1184 |
* variable-length. |
||
1185 |
*/ |
||
1186 |
variable_trail_rule = true; |
||
1187 |
else |
||
1188 |
trailcnt = rulelen; |
||
1189 |
} |
||
1190 |
} |
||
1191 |
break; |
||
1192 |
case 42: |
||
1193 |
#line 497 "/usr/src/usr.bin/lex/parse.y" |
||
1194 |
{ |
||
1195 |
varlength = true; |
||
1196 |
yyval = mkor( yyvsp[-2], yyvsp[0] ); |
||
1197 |
} |
||
1198 |
break; |
||
1199 |
case 43: |
||
1200 |
#line 503 "/usr/src/usr.bin/lex/parse.y" |
||
1201 |
{ yyval = yyvsp[0]; } |
||
1202 |
break; |
||
1203 |
case 44: |
||
1204 |
#line 508 "/usr/src/usr.bin/lex/parse.y" |
||
1205 |
{ |
||
1206 |
/* This rule is written separately so the |
||
1207 |
* reduction will occur before the trailing |
||
1208 |
* series is parsed. |
||
1209 |
*/ |
||
1210 |
|||
1211 |
if ( trlcontxt ) |
||
1212 |
synerr( _("trailing context used twice") ); |
||
1213 |
else |
||
1214 |
trlcontxt = true; |
||
1215 |
|||
1216 |
if ( varlength ) |
||
1217 |
/* We hope the trailing context is |
||
1218 |
* fixed-length. |
||
1219 |
*/ |
||
1220 |
varlength = false; |
||
1221 |
else |
||
1222 |
headcnt = rulelen; |
||
1223 |
|||
1224 |
rulelen = 0; |
||
1225 |
|||
1226 |
current_state_type = STATE_TRAILING_CONTEXT; |
||
1227 |
yyval = yyvsp[-1]; |
||
1228 |
} |
||
1229 |
break; |
||
1230 |
case 45: |
||
1231 |
#line 535 "/usr/src/usr.bin/lex/parse.y" |
||
1232 |
{ |
||
1233 |
/* This is where concatenation of adjacent patterns |
||
1234 |
* gets done. |
||
1235 |
*/ |
||
1236 |
yyval = link_machines( yyvsp[-1], yyvsp[0] ); |
||
1237 |
} |
||
1238 |
break; |
||
1239 |
case 46: |
||
1240 |
#line 543 "/usr/src/usr.bin/lex/parse.y" |
||
1241 |
{ yyval = yyvsp[0]; } |
||
1242 |
break; |
||
1243 |
case 47: |
||
1244 |
#line 546 "/usr/src/usr.bin/lex/parse.y" |
||
1245 |
{ |
||
1246 |
varlength = true; |
||
1247 |
|||
1248 |
if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 ) |
||
1249 |
{ |
||
1250 |
synerr( _("bad iteration values") ); |
||
1251 |
yyval = yyvsp[-5]; |
||
1252 |
} |
||
1253 |
else |
||
1254 |
{ |
||
1255 |
if ( yyvsp[-3] == 0 ) |
||
1256 |
{ |
||
1257 |
if ( yyvsp[-1] <= 0 ) |
||
1258 |
{ |
||
1259 |
synerr( |
||
1260 |
_("bad iteration values") ); |
||
1261 |
yyval = yyvsp[-5]; |
||
1262 |
} |
||
1263 |
else |
||
1264 |
yyval = mkopt( |
||
1265 |
mkrep( yyvsp[-5], 1, yyvsp[-1] ) ); |
||
1266 |
} |
||
1267 |
else |
||
1268 |
yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] ); |
||
1269 |
} |
||
1270 |
} |
||
1271 |
break; |
||
1272 |
case 48: |
||
1273 |
#line 574 "/usr/src/usr.bin/lex/parse.y" |
||
1274 |
{ |
||
1275 |
varlength = true; |
||
1276 |
|||
1277 |
if ( yyvsp[-2] <= 0 ) |
||
1278 |
{ |
||
1279 |
synerr( _("iteration value must be positive") ); |
||
1280 |
yyval = yyvsp[-4]; |
||
1281 |
} |
||
1282 |
|||
1283 |
else |
||
1284 |
yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITE_REPEAT ); |
||
1285 |
} |
||
1286 |
break; |
||
1287 |
case 49: |
||
1288 |
#line 588 "/usr/src/usr.bin/lex/parse.y" |
||
1289 |
{ |
||
1290 |
/* The series could be something like "(foo)", |
||
1291 |
* in which case we have no idea what its length |
||
1292 |
* is, so we punt here. |
||
1293 |
*/ |
||
1294 |
varlength = true; |
||
1295 |
|||
1296 |
if ( yyvsp[-1] <= 0 ) |
||
1297 |
{ |
||
1298 |
synerr( _("iteration value must be positive") |
||
1299 |
); |
||
1300 |
yyval = yyvsp[-3]; |
||
1301 |
} |
||
1302 |
|||
1303 |
else |
||
1304 |
yyval = link_machines( yyvsp[-3], |
||
1305 |
copysingl( yyvsp[-3], yyvsp[-1] - 1 ) ); |
||
1306 |
} |
||
1307 |
break; |
||
1308 |
case 50: |
||
1309 |
#line 610 "/usr/src/usr.bin/lex/parse.y" |
||
1310 |
{ |
||
1311 |
varlength = true; |
||
1312 |
|||
1313 |
yyval = mkclos( yyvsp[-1] ); |
||
1314 |
} |
||
1315 |
break; |
||
1316 |
case 51: |
||
1317 |
#line 617 "/usr/src/usr.bin/lex/parse.y" |
||
1318 |
{ |
||
1319 |
varlength = true; |
||
1320 |
yyval = mkposcl( yyvsp[-1] ); |
||
1321 |
} |
||
1322 |
break; |
||
1323 |
case 52: |
||
1324 |
#line 623 "/usr/src/usr.bin/lex/parse.y" |
||
1325 |
{ |
||
1326 |
varlength = true; |
||
1327 |
yyval = mkopt( yyvsp[-1] ); |
||
1328 |
} |
||
1329 |
break; |
||
1330 |
case 53: |
||
1331 |
#line 629 "/usr/src/usr.bin/lex/parse.y" |
||
1332 |
{ |
||
1333 |
varlength = true; |
||
1334 |
|||
1335 |
if ( yyvsp[-3] > yyvsp[-1] || yyvsp[-3] < 0 ) |
||
1336 |
{ |
||
1337 |
synerr( _("bad iteration values") ); |
||
1338 |
yyval = yyvsp[-5]; |
||
1339 |
} |
||
1340 |
else |
||
1341 |
{ |
||
1342 |
if ( yyvsp[-3] == 0 ) |
||
1343 |
{ |
||
1344 |
if ( yyvsp[-1] <= 0 ) |
||
1345 |
{ |
||
1346 |
synerr( |
||
1347 |
_("bad iteration values") ); |
||
1348 |
yyval = yyvsp[-5]; |
||
1349 |
} |
||
1350 |
else |
||
1351 |
yyval = mkopt( |
||
1352 |
mkrep( yyvsp[-5], 1, yyvsp[-1] ) ); |
||
1353 |
} |
||
1354 |
else |
||
1355 |
yyval = mkrep( yyvsp[-5], yyvsp[-3], yyvsp[-1] ); |
||
1356 |
} |
||
1357 |
} |
||
1358 |
break; |
||
1359 |
case 54: |
||
1360 |
#line 657 "/usr/src/usr.bin/lex/parse.y" |
||
1361 |
{ |
||
1362 |
varlength = true; |
||
1363 |
|||
1364 |
if ( yyvsp[-2] <= 0 ) |
||
1365 |
{ |
||
1366 |
synerr( _("iteration value must be positive") ); |
||
1367 |
yyval = yyvsp[-4]; |
||
1368 |
} |
||
1369 |
|||
1370 |
else |
||
1371 |
yyval = mkrep( yyvsp[-4], yyvsp[-2], INFINITE_REPEAT ); |
||
1372 |
} |
||
1373 |
break; |
||
1374 |
case 55: |
||
1375 |
#line 671 "/usr/src/usr.bin/lex/parse.y" |
||
1376 |
{ |
||
1377 |
/* The singleton could be something like "(foo)", |
||
1378 |
* in which case we have no idea what its length |
||
1379 |
* is, so we punt here. |
||
1380 |
*/ |
||
1381 |
varlength = true; |
||
1382 |
|||
1383 |
if ( yyvsp[-1] <= 0 ) |
||
1384 |
{ |
||
1385 |
synerr( _("iteration value must be positive") ); |
||
1386 |
yyval = yyvsp[-3]; |
||
1387 |
} |
||
1388 |
|||
1389 |
else |
||
1390 |
yyval = link_machines( yyvsp[-3], |
||
1391 |
copysingl( yyvsp[-3], yyvsp[-1] - 1 ) ); |
||
1392 |
} |
||
1393 |
break; |
||
1394 |
case 56: |
||
1395 |
#line 690 "/usr/src/usr.bin/lex/parse.y" |
||
1396 |
{ |
||
1397 |
if ( ! madeany ) |
||
1398 |
{ |
||
1399 |
/* Create the '.' character class. */ |
||
1400 |
ccldot = cclinit(); |
||
1401 |
ccladd( ccldot, '\n' ); |
||
1402 |
cclnegate( ccldot ); |
||
1403 |
|||
1404 |
if ( useecs ) |
||
1405 |
mkeccl( ccltbl + cclmap[ccldot], |
||
1406 |
ccllen[ccldot], nextecm, |
||
1407 |
ecgroup, csize, csize ); |
||
1408 |
|||
1409 |
/* Create the (?s:'.') character class. */ |
||
1410 |
cclany = cclinit(); |
||
1411 |
cclnegate( cclany ); |
||
1412 |
|||
1413 |
if ( useecs ) |
||
1414 |
mkeccl( ccltbl + cclmap[cclany], |
||
1415 |
ccllen[cclany], nextecm, |
||
1416 |
ecgroup, csize, csize ); |
||
1417 |
|||
1418 |
madeany = true; |
||
1419 |
} |
||
1420 |
|||
1421 |
++rulelen; |
||
1422 |
|||
1423 |
if (sf_dot_all()) |
||
1424 |
yyval = mkstate( -cclany ); |
||
1425 |
else |
||
1426 |
yyval = mkstate( -ccldot ); |
||
1427 |
} |
||
1428 |
break; |
||
1429 |
case 57: |
||
1430 |
#line 724 "/usr/src/usr.bin/lex/parse.y" |
||
1431 |
{ |
||
1432 |
/* Sort characters for fast searching. |
||
1433 |
*/ |
||
1434 |
qsort( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], sizeof (*ccltbl), cclcmp ); |
||
1435 |
|||
1436 |
if ( useecs ) |
||
1437 |
mkeccl( ccltbl + cclmap[yyvsp[0]], ccllen[yyvsp[0]], |
||
1438 |
nextecm, ecgroup, csize, csize ); |
||
1439 |
|||
1440 |
++rulelen; |
||
1441 |
|||
1442 |
if (ccl_has_nl[yyvsp[0]]) |
||
1443 |
rule_has_nl[num_rules] = true; |
||
1444 |
|||
1445 |
yyval = mkstate( -yyvsp[0] ); |
||
1446 |
} |
||
1447 |
break; |
||
1448 |
case 58: |
||
1449 |
#line 742 "/usr/src/usr.bin/lex/parse.y" |
||
1450 |
{ |
||
1451 |
++rulelen; |
||
1452 |
|||
1453 |
if (ccl_has_nl[yyvsp[0]]) |
||
1454 |
rule_has_nl[num_rules] = true; |
||
1455 |
|||
1456 |
yyval = mkstate( -yyvsp[0] ); |
||
1457 |
} |
||
1458 |
break; |
||
1459 |
case 59: |
||
1460 |
#line 752 "/usr/src/usr.bin/lex/parse.y" |
||
1461 |
{ yyval = yyvsp[-1]; } |
||
1462 |
break; |
||
1463 |
case 60: |
||
1464 |
#line 755 "/usr/src/usr.bin/lex/parse.y" |
||
1465 |
{ yyval = yyvsp[-1]; } |
||
1466 |
break; |
||
1467 |
case 61: |
||
1468 |
#line 758 "/usr/src/usr.bin/lex/parse.y" |
||
1469 |
{ |
||
1470 |
++rulelen; |
||
1471 |
|||
1472 |
if (yyvsp[0] == nlch) |
||
1473 |
rule_has_nl[num_rules] = true; |
||
1474 |
|||
1475 |
if (sf_case_ins() && has_case(yyvsp[0])) |
||
1476 |
/* create an alternation, as in (a|A) */ |
||
1477 |
yyval = mkor (mkstate(yyvsp[0]), mkstate(reverse_case(yyvsp[0]))); |
||
1478 |
else |
||
1479 |
yyval = mkstate( yyvsp[0] ); |
||
1480 |
} |
||
1481 |
break; |
||
1482 |
case 62: |
||
1483 |
#line 772 "/usr/src/usr.bin/lex/parse.y" |
||
1484 |
{ yyval = ccl_set_diff (yyvsp[-2], yyvsp[0]); } |
||
1485 |
break; |
||
1486 |
case 63: |
||
1487 |
#line 773 "/usr/src/usr.bin/lex/parse.y" |
||
1488 |
{ yyval = ccl_set_union (yyvsp[-2], yyvsp[0]); } |
||
1489 |
break; |
||
1490 |
case 65: |
||
1491 |
#line 779 "/usr/src/usr.bin/lex/parse.y" |
||
1492 |
{ yyval = yyvsp[-1]; } |
||
1493 |
break; |
||
1494 |
case 66: |
||
1495 |
#line 782 "/usr/src/usr.bin/lex/parse.y" |
||
1496 |
{ |
||
1497 |
cclnegate( yyvsp[-1] ); |
||
1498 |
yyval = yyvsp[-1]; |
||
1499 |
} |
||
1500 |
break; |
||
1501 |
case 67: |
||
1502 |
#line 789 "/usr/src/usr.bin/lex/parse.y" |
||
1503 |
{ |
||
1504 |
|||
1505 |
if (sf_case_ins()) |
||
1506 |
{ |
||
1507 |
|||
1508 |
/* If one end of the range has case and the other |
||
1509 |
* does not, or the cases are different, then we're not |
||
1510 |
* sure what range the user is trying to express. |
||
1511 |
* Examples: [@-z] or [S-t] |
||
1512 |
*/ |
||
1513 |
if (has_case (yyvsp[-2]) != has_case (yyvsp[0]) |
||
1514 |
|| (has_case (yyvsp[-2]) && (b_islower (yyvsp[-2]) != b_islower (yyvsp[0]))) |
||
1515 |
|| (has_case (yyvsp[-2]) && (b_isupper (yyvsp[-2]) != b_isupper (yyvsp[0])))) |
||
1516 |
format_warn3 ( |
||
1517 |
_("the character range [%c-%c] is ambiguous in a case-insensitive scanner"), |
||
1518 |
yyvsp[-2], yyvsp[0]); |
||
1519 |
|||
1520 |
/* If the range spans uppercase characters but not |
||
1521 |
* lowercase (or vice-versa), then should we automatically |
||
1522 |
* include lowercase characters in the range? |
||
1523 |
* Example: [@-_] spans [a-z] but not [A-Z] |
||
1524 |
*/ |
||
1525 |
else if (!has_case (yyvsp[-2]) && !has_case (yyvsp[0]) && !range_covers_case (yyvsp[-2], yyvsp[0])) |
||
1526 |
format_warn3 ( |
||
1527 |
_("the character range [%c-%c] is ambiguous in a case-insensitive scanner"), |
||
1528 |
yyvsp[-2], yyvsp[0]); |
||
1529 |
} |
||
1530 |
|||
1531 |
if ( yyvsp[-2] > yyvsp[0] ) |
||
1532 |
synerr( _("negative range in character class") ); |
||
1533 |
|||
1534 |
else |
||
1535 |
{ |
||
1536 |
for ( i = yyvsp[-2]; i <= yyvsp[0]; ++i ) |
||
1537 |
ccladd( yyvsp[-3], i ); |
||
1538 |
|||
1539 |
/* Keep track if this ccl is staying in |
||
1540 |
* alphabetical order. |
||
1541 |
*/ |
||
1542 |
cclsorted = cclsorted && (yyvsp[-2] > lastchar); |
||
1543 |
lastchar = yyvsp[0]; |
||
1544 |
|||
1545 |
/* Do it again for upper/lowercase */ |
||
1546 |
if (sf_case_ins() && has_case(yyvsp[-2]) && has_case(yyvsp[0])){ |
||
1547 |
yyvsp[-2] = reverse_case (yyvsp[-2]); |
||
1548 |
yyvsp[0] = reverse_case (yyvsp[0]); |
||
1549 |
|||
1550 |
for ( i = yyvsp[-2]; i <= yyvsp[0]; ++i ) |
||
1551 |
ccladd( yyvsp[-3], i ); |
||
1552 |
|||
1553 |
cclsorted = cclsorted && (yyvsp[-2] > lastchar); |
||
1554 |
lastchar = yyvsp[0]; |
||
1555 |
} |
||
1556 |
|||
1557 |
} |
||
1558 |
|||
1559 |
yyval = yyvsp[-3]; |
||
1560 |
} |
||
1561 |
break; |
||
1562 |
case 68: |
||
1563 |
#line 849 "/usr/src/usr.bin/lex/parse.y" |
||
1564 |
{ |
||
1565 |
ccladd( yyvsp[-1], yyvsp[0] ); |
||
1566 |
cclsorted = cclsorted && (yyvsp[0] > lastchar); |
||
1567 |
lastchar = yyvsp[0]; |
||
1568 |
|||
1569 |
/* Do it again for upper/lowercase */ |
||
1570 |
if (sf_case_ins() && has_case(yyvsp[0])){ |
||
1571 |
yyvsp[0] = reverse_case (yyvsp[0]); |
||
1572 |
ccladd (yyvsp[-1], yyvsp[0]); |
||
1573 |
|||
1574 |
cclsorted = cclsorted && (yyvsp[0] > lastchar); |
||
1575 |
lastchar = yyvsp[0]; |
||
1576 |
} |
||
1577 |
|||
1578 |
yyval = yyvsp[-1]; |
||
1579 |
} |
||
1580 |
break; |
||
1581 |
case 69: |
||
1582 |
#line 867 "/usr/src/usr.bin/lex/parse.y" |
||
1583 |
{ |
||
1584 |
/* Too hard to properly maintain cclsorted. */ |
||
1585 |
cclsorted = false; |
||
1586 |
yyval = yyvsp[-1]; |
||
1587 |
} |
||
1588 |
break; |
||
1589 |
case 70: |
||
1590 |
#line 874 "/usr/src/usr.bin/lex/parse.y" |
||
1591 |
{ |
||
1592 |
cclsorted = true; |
||
1593 |
lastchar = 0; |
||
1594 |
currccl = yyval = cclinit(); |
||
1595 |
} |
||
1596 |
break; |
||
1597 |
case 71: |
||
1598 |
#line 882 "/usr/src/usr.bin/lex/parse.y" |
||
1599 |
{ CCL_EXPR(isalnum); } |
||
1600 |
break; |
||
1601 |
case 72: |
||
1602 |
#line 883 "/usr/src/usr.bin/lex/parse.y" |
||
1603 |
{ CCL_EXPR(isalpha); } |
||
1604 |
break; |
||
1605 |
case 73: |
||
1606 |
#line 884 "/usr/src/usr.bin/lex/parse.y" |
||
1607 |
{ CCL_EXPR(isblank); } |
||
1608 |
break; |
||
1609 |
case 74: |
||
1610 |
#line 885 "/usr/src/usr.bin/lex/parse.y" |
||
1611 |
{ CCL_EXPR(iscntrl); } |
||
1612 |
break; |
||
1613 |
case 75: |
||
1614 |
#line 886 "/usr/src/usr.bin/lex/parse.y" |
||
1615 |
{ CCL_EXPR(isdigit); } |
||
1616 |
break; |
||
1617 |
case 76: |
||
1618 |
#line 887 "/usr/src/usr.bin/lex/parse.y" |
||
1619 |
{ CCL_EXPR(isgraph); } |
||
1620 |
break; |
||
1621 |
case 77: |
||
1622 |
#line 888 "/usr/src/usr.bin/lex/parse.y" |
||
1623 |
{ |
||
1624 |
CCL_EXPR(islower); |
||
1625 |
if (sf_case_ins()) |
||
1626 |
CCL_EXPR(isupper); |
||
1627 |
} |
||
1628 |
break; |
||
1629 |
case 78: |
||
1630 |
#line 893 "/usr/src/usr.bin/lex/parse.y" |
||
1631 |
{ CCL_EXPR(isprint); } |
||
1632 |
break; |
||
1633 |
case 79: |
||
1634 |
#line 894 "/usr/src/usr.bin/lex/parse.y" |
||
1635 |
{ CCL_EXPR(ispunct); } |
||
1636 |
break; |
||
1637 |
case 80: |
||
1638 |
#line 895 "/usr/src/usr.bin/lex/parse.y" |
||
1639 |
{ CCL_EXPR(isspace); } |
||
1640 |
break; |
||
1641 |
case 81: |
||
1642 |
#line 896 "/usr/src/usr.bin/lex/parse.y" |
||
1643 |
{ CCL_EXPR(isxdigit); } |
||
1644 |
break; |
||
1645 |
case 82: |
||
1646 |
#line 897 "/usr/src/usr.bin/lex/parse.y" |
||
1647 |
{ |
||
1648 |
CCL_EXPR(isupper); |
||
1649 |
if (sf_case_ins()) |
||
1650 |
CCL_EXPR(islower); |
||
1651 |
} |
||
1652 |
break; |
||
1653 |
case 83: |
||
1654 |
#line 903 "/usr/src/usr.bin/lex/parse.y" |
||
1655 |
{ CCL_NEG_EXPR(isalnum); } |
||
1656 |
break; |
||
1657 |
case 84: |
||
1658 |
#line 904 "/usr/src/usr.bin/lex/parse.y" |
||
1659 |
{ CCL_NEG_EXPR(isalpha); } |
||
1660 |
break; |
||
1661 |
case 85: |
||
1662 |
#line 905 "/usr/src/usr.bin/lex/parse.y" |
||
1663 |
{ CCL_NEG_EXPR(isblank); } |
||
1664 |
break; |
||
1665 |
case 86: |
||
1666 |
#line 906 "/usr/src/usr.bin/lex/parse.y" |
||
1667 |
{ CCL_NEG_EXPR(iscntrl); } |
||
1668 |
break; |
||
1669 |
case 87: |
||
1670 |
#line 907 "/usr/src/usr.bin/lex/parse.y" |
||
1671 |
{ CCL_NEG_EXPR(isdigit); } |
||
1672 |
break; |
||
1673 |
case 88: |
||
1674 |
#line 908 "/usr/src/usr.bin/lex/parse.y" |
||
1675 |
{ CCL_NEG_EXPR(isgraph); } |
||
1676 |
break; |
||
1677 |
case 89: |
||
1678 |
#line 909 "/usr/src/usr.bin/lex/parse.y" |
||
1679 |
{ CCL_NEG_EXPR(isprint); } |
||
1680 |
break; |
||
1681 |
case 90: |
||
1682 |
#line 910 "/usr/src/usr.bin/lex/parse.y" |
||
1683 |
{ CCL_NEG_EXPR(ispunct); } |
||
1684 |
break; |
||
1685 |
case 91: |
||
1686 |
#line 911 "/usr/src/usr.bin/lex/parse.y" |
||
1687 |
{ CCL_NEG_EXPR(isspace); } |
||
1688 |
break; |
||
1689 |
case 92: |
||
1690 |
#line 912 "/usr/src/usr.bin/lex/parse.y" |
||
1691 |
{ CCL_NEG_EXPR(isxdigit); } |
||
1692 |
break; |
||
1693 |
case 93: |
||
1694 |
#line 913 "/usr/src/usr.bin/lex/parse.y" |
||
1695 |
{ |
||
1696 |
if ( sf_case_ins() ) |
||
1697 |
warn(_("[:^lower:] is ambiguous in case insensitive scanner")); |
||
1698 |
else |
||
1699 |
CCL_NEG_EXPR(islower); |
||
1700 |
} |
||
1701 |
break; |
||
1702 |
case 94: |
||
1703 |
#line 919 "/usr/src/usr.bin/lex/parse.y" |
||
1704 |
{ |
||
1705 |
if ( sf_case_ins() ) |
||
1706 |
warn(_("[:^upper:] ambiguous in case insensitive scanner")); |
||
1707 |
else |
||
1708 |
CCL_NEG_EXPR(isupper); |
||
1709 |
} |
||
1710 |
break; |
||
1711 |
case 95: |
||
1712 |
#line 928 "/usr/src/usr.bin/lex/parse.y" |
||
1713 |
{ |
||
1714 |
if ( yyvsp[0] == nlch ) |
||
1715 |
rule_has_nl[num_rules] = true; |
||
1716 |
|||
1717 |
++rulelen; |
||
1718 |
|||
1719 |
if (sf_case_ins() && has_case(yyvsp[0])) |
||
1720 |
yyval = mkor (mkstate(yyvsp[0]), mkstate(reverse_case(yyvsp[0]))); |
||
1721 |
else |
||
1722 |
yyval = mkstate (yyvsp[0]); |
||
1723 |
|||
1724 |
yyval = link_machines( yyvsp[-1], yyval); |
||
1725 |
40661 |
} |
|
1726 |
40661 |
break; |
|
1727 |
40661 |
case 96: |
|
1728 |
40661 |
#line 943 "/usr/src/usr.bin/lex/parse.y" |
|
1729 |
✓✓ | 40661 |
{ yyval = mkstate( SYM_EPSILON ); } |
1730 |
break; |
||
1731 |
#line 1724 "parse.c" |
||
1732 |
} |
||
1733 |
yyssp -= yym; |
||
1734 |
yystate = *yyssp; |
||
1735 |
yyvsp -= yym; |
||
1736 |
yym = yylhs[yyn]; |
||
1737 |
10 |
if (yystate == 0 && yym == 0) |
|
1738 |
10 |
{ |
|
1739 |
✗✓ | 10 |
#if YYDEBUG |
1740 |
if (yydebug) |
||
1741 |
printf("%sdebug: after reduction, shifting from state 0 to\ |
||
1742 |
state %d\n", YYPREFIX, YYFINAL); |
||
1743 |
#endif |
||
1744 |
yystate = YYFINAL; |
||
1745 |
*++yyssp = YYFINAL; |
||
1746 |
*++yyvsp = yyval; |
||
1747 |
if (yychar < 0) |
||
1748 |
{ |
||
1749 |
if ((yychar = yylex()) < 0) yychar = 0; |
||
1750 |
#if YYDEBUG |
||
1751 |
if (yydebug) |
||
1752 |
{ |
||
1753 |
✗✓ | 10 |
yys = 0; |
1754 |
if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
||
1755 |
if (!yys) yys = "illegal-symbol"; |
||
1756 |
✓✓✓✓ ✓✓ |
147978 |
printf("%sdebug: state %d, reading %d (%s)\n", |
1757 |
71362 |
YYPREFIX, YYFINAL, yychar, yys); |
|
1758 |
11473 |
} |
|
1759 |
#endif |
||
1760 |
29178 |
} |
|
1761 |
if (yychar == 0) goto yyaccept; |
||
1762 |
goto yyloop; |
||
1763 |
} |
||
1764 |
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && |
||
1765 |
yyn <= YYTABLESIZE && yycheck[yyn] == yystate) |
||
1766 |
✗✓✗✗ |
40651 |
yystate = yytable[yyn]; |
1767 |
else |
||
1768 |
yystate = yydgoto[yym]; |
||
1769 |
#if YYDEBUG |
||
1770 |
40651 |
if (yydebug) |
|
1771 |
40651 |
printf("%sdebug: after reduction, shifting from state %d \ |
|
1772 |
40651 |
to state %d\n", YYPREFIX, *yyssp, yystate); |
|
1773 |
#endif |
||
1774 |
if (yyssp >= yysslim && yygrowstack()) |
||
1775 |
{ |
||
1776 |
goto yyoverflow; |
||
1777 |
} |
||
1778 |
*++yyssp = yystate; |
||
1779 |
*++yyvsp = yyval; |
||
1780 |
goto yyloop; |
||
1781 |
yyoverflow: |
||
1782 |
yyerror("yacc stack overflow"); |
||
1783 |
yyabort: |
||
1784 |
if (yyss) |
||
1785 |
✓✗ | 10 |
free(yyss); |
1786 |
10 |
if (yyvs) |
|
1787 |
✓✗ | 10 |
free(yyvs); |
1788 |
10 |
yyss = yyssp = NULL; |
|
1789 |
10 |
yyvs = yyvsp = NULL; |
|
1790 |
10 |
yystacksize = 0; |
|
1791 |
10 |
return (1); |
|
1792 |
10 |
yyaccept: |
|
1793 |
10 |
if (yyss) |
|
1794 |
free(yyss); |
||
1795 |
if (yyvs) |
||
1796 |
free(yyvs); |
||
1797 |
yyss = yyssp = NULL; |
||
1798 |
yyvs = yyvsp = NULL; |
||
1799 |
yystacksize = 0; |
||
1800 |
return (0); |
||
1801 |
} |
Generated by: GCOVR (Version 3.3) |