2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
11 #define YYPATCH 20100216
14 #define yyclearin (yychar = YYEMPTY)
15 #define yyerrok (yyerrflag = 0)
16 #define YYRECOVERING() (yyerrflag != 0)
20 /* compatibility with bison */
22 /* compatibility with FreeBSD */
23 #ifdef YYPARSE_PARAM_TYPE
24 #define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
26 #define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
29 #define YYPARSE_DECL() yyparse(void)
30 #endif /* YYPARSE_PARAM */
32 extern int YYPARSE_DECL();
47 static Type *new_type (Typetype t);
48 static struct constraint_spec *new_constraint_spec(enum ctype);
49 static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
50 void yyerror (const char *);
51 static struct objid *new_objid(const char *label, int value);
52 static void add_oid_to_tail(struct objid *, struct objid *);
53 static void fix_labels(Symbol *s);
57 struct string_list *next;
60 /* Declarations for Bison */
61 #define YYMALLOC malloc
73 struct string_list *sl;
75 struct memhead *members;
76 struct constraint_spec *constraint_spec;
79 #define kw_ABSTRACT_SYNTAX 258
81 #define kw_APPLICATION 260
82 #define kw_AUTOMATIC 261
85 #define kw_BMPString 264
86 #define kw_BOOLEAN 265
88 #define kw_CHARACTER 267
91 #define kw_COMPONENT 270
92 #define kw_COMPONENTS 271
93 #define kw_CONSTRAINED 272
94 #define kw_CONTAINING 273
95 #define kw_DEFAULT 274
96 #define kw_DEFINITIONS 275
97 #define kw_EMBEDDED 276
98 #define kw_ENCODED 277
100 #define kw_ENUMERATED 279
101 #define kw_EXCEPT 280
102 #define kw_EXPLICIT 281
103 #define kw_EXPORTS 282
104 #define kw_EXTENSIBILITY 283
105 #define kw_EXTERNAL 284
108 #define kw_GeneralString 287
109 #define kw_GeneralizedTime 288
110 #define kw_GraphicString 289
111 #define kw_IA5String 290
112 #define kw_IDENTIFIER 291
113 #define kw_IMPLICIT 292
114 #define kw_IMPLIED 293
115 #define kw_IMPORTS 294
116 #define kw_INCLUDES 295
117 #define kw_INSTANCE 296
118 #define kw_INTEGER 297
119 #define kw_INTERSECTION 298
120 #define kw_ISO646String 299
123 #define kw_MINUS_INFINITY 302
125 #define kw_NumericString 304
126 #define kw_OBJECT 305
129 #define kw_OPTIONAL 308
130 #define kw_ObjectDescriptor 309
131 #define kw_PATTERN 310
133 #define kw_PLUS_INFINITY 312
134 #define kw_PRESENT 313
135 #define kw_PRIVATE 314
136 #define kw_PrintableString 315
138 #define kw_RELATIVE_OID 317
139 #define kw_SEQUENCE 318
142 #define kw_STRING 321
143 #define kw_SYNTAX 322
144 #define kw_T61String 323
147 #define kw_TYPE_IDENTIFIER 326
148 #define kw_TeletexString 327
150 #define kw_UNIQUE 329
151 #define kw_UNIVERSAL 330
152 #define kw_UTCTime 331
153 #define kw_UTF8String 332
154 #define kw_UniversalString 333
155 #define kw_VideotexString 334
156 #define kw_VisibleString 335
161 #define IDENTIFIER 340
162 #define referencename 341
165 #define YYERRCODE 256
166 static const short yylhs[] = { -1,
167 0, 56, 56, 56, 56, 57, 57, 58, 58, 60,
168 60, 62, 62, 63, 63, 64, 59, 59, 59, 61,
169 61, 65, 65, 50, 50, 66, 14, 14, 14, 15,
170 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
171 15, 15, 15, 17, 48, 48, 48, 48, 21, 21,
172 21, 43, 43, 43, 38, 20, 41, 16, 16, 32,
173 23, 22, 49, 49, 24, 24, 25, 26, 26, 27,
174 18, 29, 29, 30, 31, 31, 19, 51, 52, 53,
175 53, 54, 54, 54, 55, 28, 35, 2, 2, 2,
176 2, 3, 3, 3, 67, 33, 34, 34, 34, 34,
177 34, 34, 34, 34, 40, 40, 40, 39, 36, 36,
178 36, 42, 42, 37, 47, 47, 44, 45, 45, 46,
179 46, 46, 4, 4, 5, 5, 5, 5, 5, 12,
180 11, 13, 9, 7, 7, 6, 1, 10, 8,
182 static const short yylen[] = { 2,
183 9, 2, 2, 2, 0, 2, 0, 3, 0, 3,
184 0, 1, 0, 1, 2, 4, 3, 2, 0, 1,
185 2, 1, 1, 3, 1, 3, 1, 1, 1, 1,
186 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
187 1, 1, 1, 1, 5, 5, 5, 3, 1, 2,
188 4, 1, 3, 3, 4, 4, 1, 2, 5, 2,
189 3, 1, 0, 2, 4, 3, 4, 4, 3, 3,
190 4, 1, 1, 1, 1, 1, 2, 3, 1, 1,
191 1, 2, 3, 5, 4, 3, 4, 0, 1, 1,
192 1, 0, 1, 1, 4, 1, 1, 1, 1, 1,
193 1, 1, 1, 1, 1, 3, 3, 2, 1, 2,
194 3, 1, 3, 4, 1, 0, 3, 0, 2, 4,
195 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
196 1, 1, 1, 1, 1, 1, 1, 1, 1,
198 static const short yydefred[] = { 0,
199 0, 0, 0, 115, 0, 0, 122, 0, 0, 0,
200 0, 117, 119, 0, 0, 0, 0, 0, 4, 2,
201 3, 0, 0, 120, 6, 0, 0, 0, 0, 0,
202 18, 0, 0, 1, 0, 0, 0, 17, 0, 0,
203 0, 14, 0, 8, 0, 22, 23, 24, 0, 10,
204 15, 0, 103, 44, 0, 0, 97, 75, 102, 0,
205 62, 0, 0, 100, 0, 0, 98, 76, 99, 104,
206 101, 0, 74, 0, 0, 27, 30, 31, 33, 29,
207 34, 35, 36, 38, 39, 40, 41, 42, 43, 28,
208 72, 73, 37, 32, 96, 0, 21, 0, 0, 0,
209 0, 0, 0, 50, 60, 0, 0, 0, 0, 0,
210 0, 0, 90, 91, 89, 0, 0, 0, 77, 93,
211 94, 0, 16, 0, 0, 105, 0, 0, 0, 52,
212 0, 0, 135, 0, 138, 134, 132, 133, 137, 136,
213 0, 123, 127, 125, 128, 126, 129, 130, 124, 131,
214 139, 0, 61, 64, 66, 0, 0, 0, 69, 0,
215 0, 95, 0, 0, 0, 0, 79, 80, 81, 0,
216 0, 112, 0, 0, 0, 110, 0, 71, 0, 56,
217 0, 0, 0, 48, 51, 65, 0, 68, 87, 0,
218 0, 0, 78, 0, 0, 59, 111, 107, 106, 0,
219 54, 53, 0, 0, 0, 0, 0, 83, 0, 113,
220 55, 47, 46, 45, 85, 0, 114, 84,
222 static const short yydgoto[] = { 2,
223 140, 116, 122, 141, 142, 143, 144, 145, 146, 147,
224 148, 149, 150, 75, 76, 77, 78, 79, 80, 81,
225 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
226 92, 93, 94, 95, 96, 126, 172, 130, 127, 128,
227 131, 173, 132, 151, 8, 9, 5, 104, 109, 39,
228 119, 166, 167, 168, 169, 17, 23, 29, 30, 36,
229 44, 40, 41, 42, 45, 46, 47,
231 static const short yysindex[] = { -295,
232 -74, 0, -289, 0, -216, 23, 0, -61, -289, -221,
233 -277, 0, 0, -259, -257, -256, -214, 31, 0, 0,
234 0, -220, -264, 0, 0, -187, -206, -232, -201, -213,
235 0, 34, 25, 0, -258, -251, -258, 0, -188, 40,
236 -258, 0, 63, 0, -251, 0, 0, 0, -239, 0,
237 0, -218, 0, 0, -19, -17, 0, 0, 0, -12,
238 0, -184, -212, 0, -106, -111, 0, 0, 0, 0,
239 0, 112, 0, -228, -37, 0, 0, 0, 0, 0,
240 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
241 0, 0, 0, 0, 0, -242, 0, -74, -10, -223,
242 -215, -116, -215, 0, 0, -198, 87, -105, -179, 112,
243 -100, 89, 0, 0, 0, -211, -4, -225, 0, 0,
244 0, 112, 0, -210, 112, 0, -238, -13, 91, 0,
245 9, 92, 0, -202, 0, 0, 0, 0, 0, 0,
246 -33, 0, 0, 0, 0, 0, 0, 0, 0, 0,
247 0, -11, 0, 0, 0, -9, 112, 89, 0, -7,
248 44, 0, -128, 112, -127, 99, 0, 0, 0, 89,
249 101, 0, -2, 89, -4, 0, -283, 0, -200, 0,
250 -278, -4, -8, 0, 0, 0, 89, 0, 0, 19,
251 -27, -4, 0, -199, -210, 0, 0, 0, 0, 104,
252 0, 0, 105, 106, 107, 24, -115, 0, 109, 0,
253 0, 0, 0, 0, 0, -4, 0, 0,
255 static const short yyrindex[] = { 0,
256 -123, 0, 28, 0, 0, -110, 0, 0, 28, -245,
257 0, 0, 0, 0, 0, 0, -183, 0, 0, 0,
258 0, 0, 0, 0, 0, 0, -248, 0, 0, -182,
259 0, -41, 0, 0, 97, 0, 0, 0, 0, 0,
260 98, 0, 0, 0, -119, 0, 0, 0, 0, 0,
261 0, 0, 0, 0, 0, 0, 0, 0, 0, -30,
262 0, 0, 0, 0, -147, 0, 0, 0, 0, 0,
263 0, 0, 0, -181, 0, 0, 0, 0, 0, 0,
264 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
265 0, 0, 0, 0, 0, 169, 0, -49, -40, 0,
266 0, 0, 0, 0, 0, -35, 0, 0, 0, 0,
267 0, -244, 0, 0, 0, 0, 0, 0, 0, 0,
268 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
269 0, 36, 0, 0, 0, 0, 0, 0, 0, 0,
270 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
271 0, 0, 0, 0, 0, 0, 0, -25, 0, 0,
272 0, 0, 0, 0, 0, 0, 0, 0, 0, -20,
273 0, 0, 0, -42, 0, 0, 0, 0, 0, 0,
274 0, 0, 0, 0, 0, 0, -15, 0, 0, 0,
275 122, 0, 0, 0, 0, 0, 0, 0, 0, 0,
276 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
277 0, 0, 0, 0, 0, 0, 0, 0,
279 static const short yygindex[] = { 0,
280 -14, 0, 0, -95, 0, 0, 0, 0, 0, 0,
281 0, 0, 0, -31, 0, 0, 0, 0, 0, 0,
282 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
283 0, 0, 0, 0, 0, -6, -29, -5, 0, -53,
284 0, 0, 61, 22, 158, 0, 70, 65, 64, 16,
285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
286 128, 0, 0, 133, 0, 0, 0,
288 #define YYTABLESIZE 509
289 static const short yytable[] = { 58,
290 58, 108, 118, 58, 63, 63, 3, 184, 63, 116,
291 49, 111, 118, 49, 121, 70, 108, 25, 70, 155,
292 86, 162, 4, 86, 159, 67, 31, 102, 67, 9,
293 177, 113, 181, 26, 177, 175, 177, 5, 120, 14,
294 112, 195, 109, 33, 1, 19, 163, 164, 3, 121,
295 6, 165, 48, 7, 156, 198, 125, 160, 10, 15,
296 201, 129, 11, 12, 19, 18, 20, 21, 22, 176,
297 16, 24, 25, 26, 27, 28, 34, 37, 158, 197,
298 35, 32, 108, 38, 58, 114, 203, 205, 43, 63,
299 170, 19, 5, 174, 49, 26, 208, 49, 50, 70,
300 98, 115, 99, 100, 86, 101, 105, 32, 106, 67,
301 103, 178, 124, 185, 3, 186, 125, 188, 3, 4,
302 218, 107, 196, 109, 129, 187, 102, 157, 118, 171,
303 179, 161, 191, 180, 182, 181, 189, 190, 192, 193,
304 194, 206, 139, 209, 211, 212, 213, 214, 215, 217,
305 216, 116, 118, 74, 7, 13, 12, 11, 20, 63,
306 57, 88, 82, 152, 200, 210, 13, 123, 133, 153,
307 199, 154, 97, 51, 0, 202, 0, 0, 0, 0,
308 0, 0, 0, 0, 134, 0, 135, 0, 0, 0,
309 0, 0, 0, 0, 0, 110, 0, 0, 0, 0,
310 0, 0, 74, 0, 0, 0, 0, 0, 136, 0,
311 0, 0, 0, 107, 0, 0, 0, 0, 0, 0,
312 0, 0, 0, 137, 0, 138, 139, 0, 0, 121,
313 0, 108, 121, 58, 125, 0, 58, 58, 63, 125,
314 0, 63, 63, 49, 25, 0, 49, 49, 70, 207,
315 0, 70, 70, 86, 0, 0, 86, 86, 67, 92,
316 0, 67, 67, 0, 0, 108, 0, 58, 0, 0,
317 0, 0, 63, 0, 0, 0, 133, 49, 0, 0,
318 133, 0, 70, 0, 0, 0, 0, 86, 0, 0,
319 116, 204, 67, 0, 135, 0, 0, 58, 135, 58,
320 117, 0, 63, 183, 63, 0, 0, 49, 0, 49,
321 0, 0, 70, 0, 70, 0, 136, 86, 0, 86,
322 136, 0, 67, 0, 67, 52, 53, 54, 0, 0,
323 55, 137, 0, 138, 139, 137, 0, 138, 139, 0,
324 0, 56, 0, 0, 0, 0, 0, 0, 0, 57,
325 58, 0, 59, 0, 0, 0, 0, 0, 0, 60,
326 0, 0, 0, 0, 0, 61, 0, 62, 63, 0,
327 0, 0, 0, 0, 52, 53, 54, 64, 0, 55,
328 65, 66, 0, 0, 0, 0, 0, 0, 0, 67,
329 56, 0, 0, 68, 69, 70, 0, 71, 57, 58,
330 72, 59, 73, 0, 0, 0, 0, 0, 60, 0,
331 0, 0, 0, 0, 61, 0, 62, 63, 0, 0,
332 0, 0, 0, 0, 0, 0, 64, 0, 0, 65,
333 66, 92, 92, 92, 0, 0, 92, 0, 67, 0,
334 0, 0, 68, 69, 70, 0, 71, 92, 0, 0,
335 0, 73, 0, 0, 0, 92, 92, 0, 92, 0,
336 0, 0, 0, 0, 0, 92, 0, 0, 0, 0,
337 0, 92, 0, 92, 92, 0, 0, 0, 0, 0,
338 0, 0, 0, 92, 0, 0, 92, 92, 0, 0,
339 0, 0, 0, 0, 0, 92, 0, 0, 0, 92,
340 92, 92, 0, 92, 0, 0, 0, 0, 92,
342 static const short yycheck[] = { 40,
343 41, 44, 40, 44, 40, 41, 123, 41, 44, 59,
344 41, 123, 40, 44, 125, 41, 123, 59, 44, 125,
345 41, 117, 1, 44, 125, 41, 259, 40, 44, 278,
346 44, 260, 44, 278, 44, 274, 44, 283, 281, 261,
347 72, 44, 44, 28, 340, 294, 272, 273, 123, 292,
348 340, 277, 37, 343, 108, 339, 340, 111, 275, 281,
349 339, 340, 40, 125, 324, 343, 324, 324, 283, 308,
350 292, 41, 293, 338, 262, 282, 278, 44, 110, 175,
351 294, 340, 125, 59, 125, 314, 182, 183, 340, 125,
352 122, 340, 338, 125, 125, 340, 192, 286, 59, 125,
353 340, 330, 321, 123, 125, 123, 291, 340, 321, 125,
354 123, 125, 123, 125, 123, 125, 340, 125, 123, 98,
355 216, 320, 125, 125, 340, 157, 40, 307, 40, 340,
356 40, 343, 164, 125, 337, 44, 93, 266, 266, 41,
357 40, 123, 343, 343, 41, 41, 41, 41, 125, 41,
358 266, 275, 125, 91, 338, 59, 59, 340, 278, 307,
359 125, 343, 41, 103, 179, 195, 9, 98, 285, 106,
360 177, 107, 45, 41, -1, 181, -1, -1, -1, -1,
361 -1, -1, -1, -1, 301, -1, 303, -1, -1, -1,
362 -1, -1, -1, -1, -1, 307, -1, -1, -1, -1,
363 -1, -1, 91, -1, -1, -1, -1, -1, 325, -1,
364 -1, -1, -1, 320, -1, -1, -1, -1, -1, -1,
365 -1, -1, -1, 340, -1, 342, 343, -1, -1, 340,
366 -1, 274, 343, 274, 340, -1, 277, 278, 274, 340,
367 -1, 277, 278, 274, 286, -1, 277, 278, 274, 277,
368 -1, 277, 278, 274, -1, -1, 277, 278, 274, 91,
369 -1, 277, 278, -1, -1, 308, -1, 308, -1, -1,
370 -1, -1, 308, -1, -1, -1, 285, 308, -1, -1,
371 285, -1, 308, -1, -1, -1, -1, 308, -1, -1,
372 340, 300, 308, -1, 303, -1, -1, 338, 303, 340,
373 338, -1, 338, 337, 340, -1, -1, 338, -1, 340,
374 -1, -1, 338, -1, 340, -1, 325, 338, -1, 340,
375 325, -1, 338, -1, 340, 263, 264, 265, -1, -1,
376 268, 340, -1, 342, 343, 340, -1, 342, 343, -1,
377 -1, 279, -1, -1, -1, -1, -1, -1, -1, 287,
378 288, -1, 290, -1, -1, -1, -1, -1, -1, 297,
379 -1, -1, -1, -1, -1, 303, -1, 305, 306, -1,
380 -1, -1, -1, -1, 263, 264, 265, 315, -1, 268,
381 318, 319, -1, -1, -1, -1, -1, -1, -1, 327,
382 279, -1, -1, 331, 332, 333, -1, 335, 287, 288,
383 338, 290, 340, -1, -1, -1, -1, -1, 297, -1,
384 -1, -1, -1, -1, 303, -1, 305, 306, -1, -1,
385 -1, -1, -1, -1, -1, -1, 315, -1, -1, 318,
386 319, 263, 264, 265, -1, -1, 268, -1, 327, -1,
387 -1, -1, 331, 332, 333, -1, 335, 279, -1, -1,
388 -1, 340, -1, -1, -1, 287, 288, -1, 290, -1,
389 -1, -1, -1, -1, -1, 297, -1, -1, -1, -1,
390 -1, 303, -1, 305, 306, -1, -1, -1, -1, -1,
391 -1, -1, -1, 315, -1, -1, 318, 319, -1, -1,
392 -1, -1, -1, -1, -1, 327, -1, -1, -1, 331,
393 332, 333, -1, 335, -1, -1, -1, -1, 340,
399 #define YYMAXTOKEN 343
401 static const char *yyname[] = {
403 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
404 0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,0,0,0,0,0,
405 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,
406 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,0,0,0,
407 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
408 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
409 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
410 "kw_ABSENT","kw_ABSTRACT_SYNTAX","kw_ALL","kw_APPLICATION","kw_AUTOMATIC",
411 "kw_BEGIN","kw_BIT","kw_BMPString","kw_BOOLEAN","kw_BY","kw_CHARACTER",
412 "kw_CHOICE","kw_CLASS","kw_COMPONENT","kw_COMPONENTS","kw_CONSTRAINED",
413 "kw_CONTAINING","kw_DEFAULT","kw_DEFINITIONS","kw_EMBEDDED","kw_ENCODED",
414 "kw_END","kw_ENUMERATED","kw_EXCEPT","kw_EXPLICIT","kw_EXPORTS",
415 "kw_EXTENSIBILITY","kw_EXTERNAL","kw_FALSE","kw_FROM","kw_GeneralString",
416 "kw_GeneralizedTime","kw_GraphicString","kw_IA5String","kw_IDENTIFIER",
417 "kw_IMPLICIT","kw_IMPLIED","kw_IMPORTS","kw_INCLUDES","kw_INSTANCE",
418 "kw_INTEGER","kw_INTERSECTION","kw_ISO646String","kw_MAX","kw_MIN",
419 "kw_MINUS_INFINITY","kw_NULL","kw_NumericString","kw_OBJECT","kw_OCTET","kw_OF",
420 "kw_OPTIONAL","kw_ObjectDescriptor","kw_PATTERN","kw_PDV","kw_PLUS_INFINITY",
421 "kw_PRESENT","kw_PRIVATE","kw_PrintableString","kw_REAL","kw_RELATIVE_OID",
422 "kw_SEQUENCE","kw_SET","kw_SIZE","kw_STRING","kw_SYNTAX","kw_T61String",
423 "kw_TAGS","kw_TRUE","kw_TYPE_IDENTIFIER","kw_TeletexString","kw_UNION",
424 "kw_UNIQUE","kw_UNIVERSAL","kw_UTCTime","kw_UTF8String","kw_UniversalString",
425 "kw_VideotexString","kw_VisibleString","kw_WITH","RANGE","EEQUAL","ELLIPSIS",
426 "IDENTIFIER","referencename","STRING","NUMBER",
428 static const char *yyrule[] = {
429 "$accept : ModuleDefinition",
430 "ModuleDefinition : IDENTIFIER objid_opt kw_DEFINITIONS TagDefault ExtensionDefault EEQUAL kw_BEGIN ModuleBody kw_END",
431 "TagDefault : kw_EXPLICIT kw_TAGS",
432 "TagDefault : kw_IMPLICIT kw_TAGS",
433 "TagDefault : kw_AUTOMATIC kw_TAGS",
435 "ExtensionDefault : kw_EXTENSIBILITY kw_IMPLIED",
436 "ExtensionDefault :",
437 "ModuleBody : Exports Imports AssignmentList",
439 "Imports : kw_IMPORTS SymbolsImported ';'",
441 "SymbolsImported : SymbolsFromModuleList",
443 "SymbolsFromModuleList : SymbolsFromModule",
444 "SymbolsFromModuleList : SymbolsFromModuleList SymbolsFromModule",
445 "SymbolsFromModule : referencenames kw_FROM IDENTIFIER objid_opt",
446 "Exports : kw_EXPORTS referencenames ';'",
447 "Exports : kw_EXPORTS kw_ALL",
449 "AssignmentList : Assignment",
450 "AssignmentList : Assignment AssignmentList",
451 "Assignment : TypeAssignment",
452 "Assignment : ValueAssignment",
453 "referencenames : IDENTIFIER ',' referencenames",
454 "referencenames : IDENTIFIER",
455 "TypeAssignment : IDENTIFIER EEQUAL Type",
456 "Type : BuiltinType",
457 "Type : ReferencedType",
458 "Type : ConstrainedType",
459 "BuiltinType : BitStringType",
460 "BuiltinType : BooleanType",
461 "BuiltinType : CharacterStringType",
462 "BuiltinType : ChoiceType",
463 "BuiltinType : EnumeratedType",
464 "BuiltinType : IntegerType",
465 "BuiltinType : NullType",
466 "BuiltinType : ObjectIdentifierType",
467 "BuiltinType : OctetStringType",
468 "BuiltinType : SequenceType",
469 "BuiltinType : SequenceOfType",
470 "BuiltinType : SetType",
471 "BuiltinType : SetOfType",
472 "BuiltinType : TaggedType",
473 "BooleanType : kw_BOOLEAN",
474 "range : '(' Value RANGE Value ')'",
475 "range : '(' Value RANGE kw_MAX ')'",
476 "range : '(' kw_MIN RANGE Value ')'",
477 "range : '(' Value ')'",
478 "IntegerType : kw_INTEGER",
479 "IntegerType : kw_INTEGER range",
480 "IntegerType : kw_INTEGER '{' NamedNumberList '}'",
481 "NamedNumberList : NamedNumber",
482 "NamedNumberList : NamedNumberList ',' NamedNumber",
483 "NamedNumberList : NamedNumberList ',' ELLIPSIS",
484 "NamedNumber : IDENTIFIER '(' SignedNumber ')'",
485 "EnumeratedType : kw_ENUMERATED '{' Enumerations '}'",
486 "Enumerations : NamedNumberList",
487 "BitStringType : kw_BIT kw_STRING",
488 "BitStringType : kw_BIT kw_STRING '{' NamedBitList '}'",
489 "ObjectIdentifierType : kw_OBJECT kw_IDENTIFIER",
490 "OctetStringType : kw_OCTET kw_STRING size",
491 "NullType : kw_NULL",
493 "size : kw_SIZE range",
494 "SequenceType : kw_SEQUENCE '{' ComponentTypeList '}'",
495 "SequenceType : kw_SEQUENCE '{' '}'",
496 "SequenceOfType : kw_SEQUENCE size kw_OF Type",
497 "SetType : kw_SET '{' ComponentTypeList '}'",
498 "SetType : kw_SET '{' '}'",
499 "SetOfType : kw_SET kw_OF Type",
500 "ChoiceType : kw_CHOICE '{' ComponentTypeList '}'",
501 "ReferencedType : DefinedType",
502 "ReferencedType : UsefulType",
503 "DefinedType : IDENTIFIER",
504 "UsefulType : kw_GeneralizedTime",
505 "UsefulType : kw_UTCTime",
506 "ConstrainedType : Type Constraint",
507 "Constraint : '(' ConstraintSpec ')'",
508 "ConstraintSpec : GeneralConstraint",
509 "GeneralConstraint : ContentsConstraint",
510 "GeneralConstraint : UserDefinedConstraint",
511 "ContentsConstraint : kw_CONTAINING Type",
512 "ContentsConstraint : kw_ENCODED kw_BY Value",
513 "ContentsConstraint : kw_CONTAINING Type kw_ENCODED kw_BY Value",
514 "UserDefinedConstraint : kw_CONSTRAINED kw_BY '{' '}'",
515 "TaggedType : Tag tagenv Type",
516 "Tag : '[' Class NUMBER ']'",
518 "Class : kw_UNIVERSAL",
519 "Class : kw_APPLICATION",
520 "Class : kw_PRIVATE",
522 "tagenv : kw_EXPLICIT",
523 "tagenv : kw_IMPLICIT",
524 "ValueAssignment : IDENTIFIER Type EEQUAL Value",
525 "CharacterStringType : RestrictedCharactedStringType",
526 "RestrictedCharactedStringType : kw_GeneralString",
527 "RestrictedCharactedStringType : kw_TeletexString",
528 "RestrictedCharactedStringType : kw_UTF8String",
529 "RestrictedCharactedStringType : kw_PrintableString",
530 "RestrictedCharactedStringType : kw_VisibleString",
531 "RestrictedCharactedStringType : kw_IA5String",
532 "RestrictedCharactedStringType : kw_BMPString",
533 "RestrictedCharactedStringType : kw_UniversalString",
534 "ComponentTypeList : ComponentType",
535 "ComponentTypeList : ComponentTypeList ',' ComponentType",
536 "ComponentTypeList : ComponentTypeList ',' ELLIPSIS",
537 "NamedType : IDENTIFIER Type",
538 "ComponentType : NamedType",
539 "ComponentType : NamedType kw_OPTIONAL",
540 "ComponentType : NamedType kw_DEFAULT Value",
541 "NamedBitList : NamedBit",
542 "NamedBitList : NamedBitList ',' NamedBit",
543 "NamedBit : IDENTIFIER '(' NUMBER ')'",
546 "objid : '{' objid_list '}'",
548 "objid_list : objid_element objid_list",
549 "objid_element : IDENTIFIER '(' NUMBER ')'",
550 "objid_element : IDENTIFIER",
551 "objid_element : NUMBER",
552 "Value : BuiltinValue",
553 "Value : ReferencedValue",
554 "BuiltinValue : BooleanValue",
555 "BuiltinValue : CharacterStringValue",
556 "BuiltinValue : IntegerValue",
557 "BuiltinValue : ObjectIdentifierValue",
558 "BuiltinValue : NullValue",
559 "ReferencedValue : DefinedValue",
560 "DefinedValue : Valuereference",
561 "Valuereference : IDENTIFIER",
562 "CharacterStringValue : STRING",
563 "BooleanValue : kw_TRUE",
564 "BooleanValue : kw_FALSE",
565 "IntegerValue : SignedNumber",
566 "SignedNumber : NUMBER",
567 "NullValue : kw_NULL",
568 "ObjectIdentifierValue : objid",
576 /* define the initial stack-sizes */
579 #define YYMAXDEPTH YYSTACKSIZE
582 #define YYSTACKSIZE YYMAXDEPTH
584 #define YYSTACKSIZE 500
585 #define YYMAXDEPTH 500
589 #define YYINITSTACKSIZE 500
610 /* variables for the parser stack */
611 static YYSTACKDATA yystack;
614 yyerror (const char *s)
616 lex_error_message ("%s\n", s);
620 new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
623 if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
625 oldtype = oldtype->subtype; /* XXX */
629 t->tag.tagclass = tagclass;
630 t->tag.tagvalue = tagvalue;
631 t->tag.tagenv = tagenv;
632 t->subtype = oldtype;
636 static struct objid *
637 new_objid(const char *label, int value)
640 s = emalloc(sizeof(*s));
648 add_oid_to_tail(struct objid *head, struct objid *tail)
658 new_type (Typetype tt)
660 Type *t = ecalloc(1, sizeof(*t));
665 static struct constraint_spec *
666 new_constraint_spec(enum ctype ct)
668 struct constraint_spec *c = ecalloc(1, sizeof(*c));
673 static void fix_labels2(Type *t, const char *prefix);
674 static void fix_labels1(struct memhead *members, const char *prefix)
680 ASN1_TAILQ_FOREACH(m, members, members) {
681 if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0)
683 if (m->label == NULL)
686 fix_labels2(m->type, m->label);
690 static void fix_labels2(Type *t, const char *prefix)
692 for(; t; t = t->subtype)
693 fix_labels1(t->members, prefix);
697 fix_labels(Symbol *s)
700 if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL)
702 fix_labels2(s->type, p);
705 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
706 static int yygrowstack(YYSTACKDATA *data)
713 if ((newsize = data->stacksize) == 0)
714 newsize = YYINITSTACKSIZE;
715 else if (newsize >= YYMAXDEPTH)
717 else if ((newsize *= 2) > YYMAXDEPTH)
718 newsize = YYMAXDEPTH;
720 i = data->s_mark - data->s_base;
721 newss = (data->s_base != 0)
722 ? (short *)realloc(data->s_base, newsize * sizeof(*newss))
723 : (short *)malloc(newsize * sizeof(*newss));
727 data->s_base = newss;
728 data->s_mark = newss + i;
730 newvs = (data->l_base != 0)
731 ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs))
732 : (YYSTYPE *)malloc(newsize * sizeof(*newvs));
736 data->l_base = newvs;
737 data->l_mark = newvs + i;
739 data->stacksize = newsize;
740 data->s_last = data->s_base + newsize - 1;
744 #if YYPURE || defined(YY_NO_LEAKS)
745 static void yyfreestack(YYSTACKDATA *data)
749 memset(data, 0, sizeof(*data));
752 #define yyfreestack(data) /* nothing */
755 #define YYABORT goto yyabort
756 #define YYREJECT goto yyabort
757 #define YYACCEPT goto yyaccept
758 #define YYERROR goto yyerrlab
763 int yym, yyn, yystate;
767 if ((yys = getenv("YYDEBUG")) != 0)
770 if (yyn >= '0' && yyn <= '9')
781 memset(&yystack, 0, sizeof(yystack));
784 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
785 yystack.s_mark = yystack.s_base;
786 yystack.l_mark = yystack.l_base;
791 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
794 if ((yychar = yylex()) < 0) yychar = 0;
799 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
800 if (!yys) yys = "illegal-symbol";
801 printf("%sdebug: state %d, reading %d (%s)\n",
802 YYPREFIX, yystate, yychar, yys);
806 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
807 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
811 printf("%sdebug: state %d, shifting to state %d\n",
812 YYPREFIX, yystate, yytable[yyn]);
814 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
818 yystate = yytable[yyn];
819 *++yystack.s_mark = yytable[yyn];
820 *++yystack.l_mark = yylval;
822 if (yyerrflag > 0) --yyerrflag;
825 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
826 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
831 if (yyerrflag) goto yyinrecovery;
833 yyerror("syntax error");
846 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
847 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
851 printf("%sdebug: state %d, error recovery shifting\
852 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
854 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
858 yystate = yytable[yyn];
859 *++yystack.s_mark = yytable[yyn];
860 *++yystack.l_mark = yylval;
867 printf("%sdebug: error recovery discarding state %d\n",
868 YYPREFIX, *yystack.s_mark);
870 if (yystack.s_mark <= yystack.s_base) goto yyabort;
878 if (yychar == 0) goto yyabort;
883 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
884 if (!yys) yys = "illegal-symbol";
885 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
886 YYPREFIX, yystate, yychar, yys);
896 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
897 YYPREFIX, yystate, yyn, yyrule[yyn]);
901 yyval = yystack.l_mark[1-yym];
903 memset(&yyval, 0, sizeof yyval);
912 { lex_error_message("implicit tagging is not supported"); }
915 { lex_error_message("automatic tagging is not supported"); }
918 { lex_error_message("no extensibility options supported"); }
922 struct string_list *sl;
923 for(sl = yystack.l_mark[-3].sl; sl != NULL; sl = sl->next) {
924 Symbol *s = addsym(sl->string);
926 gen_template_import(s);
928 add_import(yystack.l_mark[-1].name);
933 struct string_list *sl;
934 for(sl = yystack.l_mark[-1].sl; sl != NULL; sl = sl->next)
935 add_export(sl->string);
940 yyval.sl = emalloc(sizeof(*yyval.sl));
941 yyval.sl->string = yystack.l_mark[-2].name;
942 yyval.sl->next = yystack.l_mark[0].sl;
947 yyval.sl = emalloc(sizeof(*yyval.sl));
948 yyval.sl->string = yystack.l_mark[0].name;
949 yyval.sl->next = NULL;
954 Symbol *s = addsym (yystack.l_mark[-2].name);
956 s->type = yystack.l_mark[0].type;
963 yyval.type = new_tag(ASN1_C_UNIV, UT_Boolean,
964 TE_EXPLICIT, new_type(TBoolean));
969 if(yystack.l_mark[-3].value->type != integervalue)
970 lex_error_message("Non-integer used in first part of range");
971 if(yystack.l_mark[-3].value->type != integervalue)
972 lex_error_message("Non-integer in second part of range");
973 yyval.range = ecalloc(1, sizeof(*yyval.range));
974 yyval.range->min = yystack.l_mark[-3].value->u.integervalue;
975 yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
980 if(yystack.l_mark[-3].value->type != integervalue)
981 lex_error_message("Non-integer in first part of range");
982 yyval.range = ecalloc(1, sizeof(*yyval.range));
983 yyval.range->min = yystack.l_mark[-3].value->u.integervalue;
984 yyval.range->max = yystack.l_mark[-3].value->u.integervalue - 1;
989 if(yystack.l_mark[-1].value->type != integervalue)
990 lex_error_message("Non-integer in second part of range");
991 yyval.range = ecalloc(1, sizeof(*yyval.range));
992 yyval.range->min = yystack.l_mark[-1].value->u.integervalue + 2;
993 yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
998 if(yystack.l_mark[-1].value->type != integervalue)
999 lex_error_message("Non-integer used in limit");
1000 yyval.range = ecalloc(1, sizeof(*yyval.range));
1001 yyval.range->min = yystack.l_mark[-1].value->u.integervalue;
1002 yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
1007 yyval.type = new_tag(ASN1_C_UNIV, UT_Integer,
1008 TE_EXPLICIT, new_type(TInteger));
1013 yyval.type = new_type(TInteger);
1014 yyval.type->range = yystack.l_mark[0].range;
1015 yyval.type = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, yyval.type);
1020 yyval.type = new_type(TInteger);
1021 yyval.type->members = yystack.l_mark[-1].members;
1022 yyval.type = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, yyval.type);
1027 yyval.members = emalloc(sizeof(*yyval.members));
1028 ASN1_TAILQ_INIT(yyval.members);
1029 ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
1034 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
1035 yyval.members = yystack.l_mark[-2].members;
1039 { yyval.members = yystack.l_mark[-2].members; }
1043 yyval.member = emalloc(sizeof(*yyval.member));
1044 yyval.member->name = yystack.l_mark[-3].name;
1045 yyval.member->gen_name = estrdup(yystack.l_mark[-3].name);
1046 output_name (yyval.member->gen_name);
1047 yyval.member->val = yystack.l_mark[-1].constant;
1048 yyval.member->optional = 0;
1049 yyval.member->ellipsis = 0;
1050 yyval.member->type = NULL;
1055 yyval.type = new_type(TInteger);
1056 yyval.type->members = yystack.l_mark[-1].members;
1057 yyval.type = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, yyval.type);
1062 yyval.type = new_type(TBitString);
1063 yyval.type->members = emalloc(sizeof(*yyval.type->members));
1064 ASN1_TAILQ_INIT(yyval.type->members);
1065 yyval.type = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, yyval.type);
1070 yyval.type = new_type(TBitString);
1071 yyval.type->members = yystack.l_mark[-1].members;
1072 yyval.type = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, yyval.type);
1077 yyval.type = new_tag(ASN1_C_UNIV, UT_OID,
1078 TE_EXPLICIT, new_type(TOID));
1083 Type *t = new_type(TOctetString);
1084 t->range = yystack.l_mark[0].range;
1085 yyval.type = new_tag(ASN1_C_UNIV, UT_OctetString,
1091 yyval.type = new_tag(ASN1_C_UNIV, UT_Null,
1092 TE_EXPLICIT, new_type(TNull));
1096 { yyval.range = NULL; }
1099 { yyval.range = yystack.l_mark[0].range; }
1103 yyval.type = new_type(TSequence);
1104 yyval.type->members = yystack.l_mark[-1].members;
1105 yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
1110 yyval.type = new_type(TSequence);
1111 yyval.type->members = NULL;
1112 yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
1117 yyval.type = new_type(TSequenceOf);
1118 yyval.type->range = yystack.l_mark[-2].range;
1119 yyval.type->subtype = yystack.l_mark[0].type;
1120 yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
1125 yyval.type = new_type(TSet);
1126 yyval.type->members = yystack.l_mark[-1].members;
1127 yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
1132 yyval.type = new_type(TSet);
1133 yyval.type->members = NULL;
1134 yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
1139 yyval.type = new_type(TSetOf);
1140 yyval.type->subtype = yystack.l_mark[0].type;
1141 yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
1146 yyval.type = new_type(TChoice);
1147 yyval.type->members = yystack.l_mark[-1].members;
1152 Symbol *s = addsym(yystack.l_mark[0].name);
1153 yyval.type = new_type(TType);
1154 if(s->stype != Stype && s->stype != SUndefined)
1155 lex_error_message ("%s is not a type\n", yystack.l_mark[0].name);
1157 yyval.type->symbol = s;
1162 yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
1163 TE_EXPLICIT, new_type(TGeneralizedTime));
1168 yyval.type = new_tag(ASN1_C_UNIV, UT_UTCTime,
1169 TE_EXPLICIT, new_type(TUTCTime));
1174 /* if (Constraint.type == contentConstrant) {
1175 assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
1176 if (Constraint.u.constraint.type) {
1177 assert((Constraint.u.constraint.type.length % 8) == 0);
1180 if (Constraint.u.constraint.encoding) {
1181 type == der-oid|ber-oid
1188 yyval.constraint_spec = yystack.l_mark[-1].constraint_spec;
1193 yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
1194 yyval.constraint_spec->u.content.type = yystack.l_mark[0].type;
1195 yyval.constraint_spec->u.content.encoding = NULL;
1200 if (yystack.l_mark[0].value->type != objectidentifiervalue)
1201 lex_error_message("Non-OID used in ENCODED BY constraint");
1202 yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
1203 yyval.constraint_spec->u.content.type = NULL;
1204 yyval.constraint_spec->u.content.encoding = yystack.l_mark[0].value;
1209 if (yystack.l_mark[0].value->type != objectidentifiervalue)
1210 lex_error_message("Non-OID used in ENCODED BY constraint");
1211 yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
1212 yyval.constraint_spec->u.content.type = yystack.l_mark[-3].type;
1213 yyval.constraint_spec->u.content.encoding = yystack.l_mark[0].value;
1218 yyval.constraint_spec = new_constraint_spec(CT_USER);
1223 yyval.type = new_type(TTag);
1224 yyval.type->tag = yystack.l_mark[-2].tag;
1225 yyval.type->tag.tagenv = yystack.l_mark[-1].constant;
1226 if(yystack.l_mark[0].type->type == TTag && yystack.l_mark[-1].constant == TE_IMPLICIT) {
1227 yyval.type->subtype = yystack.l_mark[0].type->subtype;
1228 free(yystack.l_mark[0].type);
1230 yyval.type->subtype = yystack.l_mark[0].type;
1235 yyval.tag.tagclass = yystack.l_mark[-2].constant;
1236 yyval.tag.tagvalue = yystack.l_mark[-1].constant;
1237 yyval.tag.tagenv = TE_EXPLICIT;
1242 yyval.constant = ASN1_C_CONTEXT;
1247 yyval.constant = ASN1_C_UNIV;
1252 yyval.constant = ASN1_C_APPL;
1257 yyval.constant = ASN1_C_PRIVATE;
1262 yyval.constant = TE_EXPLICIT;
1267 yyval.constant = TE_EXPLICIT;
1272 yyval.constant = TE_IMPLICIT;
1278 s = addsym (yystack.l_mark[-3].name);
1281 s->value = yystack.l_mark[0].value;
1282 generate_constant (s);
1287 yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralString,
1288 TE_EXPLICIT, new_type(TGeneralString));
1293 yyval.type = new_tag(ASN1_C_UNIV, UT_TeletexString,
1294 TE_EXPLICIT, new_type(TTeletexString));
1299 yyval.type = new_tag(ASN1_C_UNIV, UT_UTF8String,
1300 TE_EXPLICIT, new_type(TUTF8String));
1305 yyval.type = new_tag(ASN1_C_UNIV, UT_PrintableString,
1306 TE_EXPLICIT, new_type(TPrintableString));
1311 yyval.type = new_tag(ASN1_C_UNIV, UT_VisibleString,
1312 TE_EXPLICIT, new_type(TVisibleString));
1317 yyval.type = new_tag(ASN1_C_UNIV, UT_IA5String,
1318 TE_EXPLICIT, new_type(TIA5String));
1323 yyval.type = new_tag(ASN1_C_UNIV, UT_BMPString,
1324 TE_EXPLICIT, new_type(TBMPString));
1329 yyval.type = new_tag(ASN1_C_UNIV, UT_UniversalString,
1330 TE_EXPLICIT, new_type(TUniversalString));
1335 yyval.members = emalloc(sizeof(*yyval.members));
1336 ASN1_TAILQ_INIT(yyval.members);
1337 ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
1342 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
1343 yyval.members = yystack.l_mark[-2].members;
1348 struct member *m = ecalloc(1, sizeof(*m));
1349 m->name = estrdup("...");
1350 m->gen_name = estrdup("asn1_ellipsis");
1352 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, m, members);
1353 yyval.members = yystack.l_mark[-2].members;
1358 yyval.member = emalloc(sizeof(*yyval.member));
1359 yyval.member->name = yystack.l_mark[-1].name;
1360 yyval.member->gen_name = estrdup(yystack.l_mark[-1].name);
1361 output_name (yyval.member->gen_name);
1362 yyval.member->type = yystack.l_mark[0].type;
1363 yyval.member->ellipsis = 0;
1368 yyval.member = yystack.l_mark[0].member;
1369 yyval.member->optional = 0;
1370 yyval.member->defval = NULL;
1375 yyval.member = yystack.l_mark[-1].member;
1376 yyval.member->optional = 1;
1377 yyval.member->defval = NULL;
1382 yyval.member = yystack.l_mark[-2].member;
1383 yyval.member->optional = 0;
1384 yyval.member->defval = yystack.l_mark[0].value;
1389 yyval.members = emalloc(sizeof(*yyval.members));
1390 ASN1_TAILQ_INIT(yyval.members);
1391 ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
1396 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
1397 yyval.members = yystack.l_mark[-2].members;
1402 yyval.member = emalloc(sizeof(*yyval.member));
1403 yyval.member->name = yystack.l_mark[-3].name;
1404 yyval.member->gen_name = estrdup(yystack.l_mark[-3].name);
1405 output_name (yyval.member->gen_name);
1406 yyval.member->val = yystack.l_mark[-1].constant;
1407 yyval.member->optional = 0;
1408 yyval.member->ellipsis = 0;
1409 yyval.member->type = NULL;
1413 { yyval.objid = NULL; }
1417 yyval.objid = yystack.l_mark[-1].objid;
1427 if (yystack.l_mark[0].objid) {
1428 yyval.objid = yystack.l_mark[0].objid;
1429 add_oid_to_tail(yystack.l_mark[0].objid, yystack.l_mark[-1].objid);
1431 yyval.objid = yystack.l_mark[-1].objid;
1437 yyval.objid = new_objid(yystack.l_mark[-3].name, yystack.l_mark[-1].constant);
1442 Symbol *s = addsym(yystack.l_mark[0].name);
1443 if(s->stype != SValue ||
1444 s->value->type != objectidentifiervalue) {
1445 lex_error_message("%s is not an object identifier\n",
1449 yyval.objid = s->value->u.objectidentifiervalue;
1454 yyval.objid = new_objid(NULL, yystack.l_mark[0].constant);
1459 Symbol *s = addsym(yystack.l_mark[0].name);
1460 if(s->stype != SValue)
1461 lex_error_message ("%s is not a value\n",
1464 yyval.value = s->value;
1469 yyval.value = emalloc(sizeof(*yyval.value));
1470 yyval.value->type = stringvalue;
1471 yyval.value->u.stringvalue = yystack.l_mark[0].name;
1476 yyval.value = emalloc(sizeof(*yyval.value));
1477 yyval.value->type = booleanvalue;
1478 yyval.value->u.booleanvalue = 0;
1483 yyval.value = emalloc(sizeof(*yyval.value));
1484 yyval.value->type = booleanvalue;
1485 yyval.value->u.booleanvalue = 0;
1490 yyval.value = emalloc(sizeof(*yyval.value));
1491 yyval.value->type = integervalue;
1492 yyval.value->u.integervalue = yystack.l_mark[0].constant;
1501 yyval.value = emalloc(sizeof(*yyval.value));
1502 yyval.value->type = objectidentifiervalue;
1503 yyval.value->u.objectidentifiervalue = yystack.l_mark[0].objid;
1507 yystack.s_mark -= yym;
1508 yystate = *yystack.s_mark;
1509 yystack.l_mark -= yym;
1511 if (yystate == 0 && yym == 0)
1515 printf("%sdebug: after reduction, shifting from state 0 to\
1516 state %d\n", YYPREFIX, YYFINAL);
1519 *++yystack.s_mark = YYFINAL;
1520 *++yystack.l_mark = yyval;
1523 if ((yychar = yylex()) < 0) yychar = 0;
1528 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1529 if (!yys) yys = "illegal-symbol";
1530 printf("%sdebug: state %d, reading %d (%s)\n",
1531 YYPREFIX, YYFINAL, yychar, yys);
1535 if (yychar == 0) goto yyaccept;
1538 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1539 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1540 yystate = yytable[yyn];
1542 yystate = yydgoto[yym];
1545 printf("%sdebug: after reduction, shifting from state %d \
1546 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1548 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
1552 *++yystack.s_mark = (short) yystate;
1553 *++yystack.l_mark = yyval;
1557 yyerror("yacc stack overflow");
1560 yyfreestack(&yystack);
1564 yyfreestack(&yystack);