2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
8 #define YYPATCH 20101229
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
19 #line 39 "asn1parse.c"
33 static Type *new_type (Typetype t);
34 static struct constraint_spec *new_constraint_spec(enum ctype);
35 static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
36 void yyerror (const char *);
37 static struct objid *new_objid(const char *label, int value);
38 static void add_oid_to_tail(struct objid *, struct objid *);
39 static void fix_labels(Symbol *s);
43 struct string_list *next;
46 /* Declarations for Bison */
47 #define YYMALLOC malloc
50 #line 71 "asn1parse.c"
52 #undef YYSTYPE_IS_DECLARED
53 #define YYSTYPE_IS_DECLARED 1
55 #ifndef YYSTYPE_IS_DECLARED
56 #define YYSTYPE_IS_DECLARED 1
66 struct string_list *sl;
68 struct memhead *members;
69 struct constraint_spec *constraint_spec;
71 #endif /* !YYSTYPE_IS_DECLARED */
72 #line 72 "asn1parse.c"
73 /* compatibility with bison */
75 /* compatibility with FreeBSD */
76 # ifdef YYPARSE_PARAM_TYPE
77 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
79 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
82 # define YYPARSE_DECL() yyparse(void)
85 /* Parameters sent to lex. */
87 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
88 # define YYLEX yylex(YYLEX_PARAM)
90 # define YYLEX_DECL() yylex(void)
91 # define YYLEX yylex()
94 /* Parameters sent to yyerror. */
95 #define YYERROR_DECL() yyerror(const char *s)
96 #define YYERROR_CALL(msg) yyerror(msg)
98 extern int YYPARSE_DECL();
100 #define kw_ABSENT 257
101 #define kw_ABSTRACT_SYNTAX 258
103 #define kw_APPLICATION 260
104 #define kw_AUTOMATIC 261
107 #define kw_BMPString 264
108 #define kw_BOOLEAN 265
110 #define kw_CHARACTER 267
111 #define kw_CHOICE 268
113 #define kw_COMPONENT 270
114 #define kw_COMPONENTS 271
115 #define kw_CONSTRAINED 272
116 #define kw_CONTAINING 273
117 #define kw_DEFAULT 274
118 #define kw_DEFINITIONS 275
119 #define kw_EMBEDDED 276
120 #define kw_ENCODED 277
122 #define kw_ENUMERATED 279
123 #define kw_EXCEPT 280
124 #define kw_EXPLICIT 281
125 #define kw_EXPORTS 282
126 #define kw_EXTENSIBILITY 283
127 #define kw_EXTERNAL 284
130 #define kw_GeneralString 287
131 #define kw_GeneralizedTime 288
132 #define kw_GraphicString 289
133 #define kw_IA5String 290
134 #define kw_IDENTIFIER 291
135 #define kw_IMPLICIT 292
136 #define kw_IMPLIED 293
137 #define kw_IMPORTS 294
138 #define kw_INCLUDES 295
139 #define kw_INSTANCE 296
140 #define kw_INTEGER 297
141 #define kw_INTERSECTION 298
142 #define kw_ISO646String 299
145 #define kw_MINUS_INFINITY 302
147 #define kw_NumericString 304
148 #define kw_OBJECT 305
151 #define kw_OPTIONAL 308
152 #define kw_ObjectDescriptor 309
153 #define kw_PATTERN 310
155 #define kw_PLUS_INFINITY 312
156 #define kw_PRESENT 313
157 #define kw_PRIVATE 314
158 #define kw_PrintableString 315
160 #define kw_RELATIVE_OID 317
161 #define kw_SEQUENCE 318
164 #define kw_STRING 321
165 #define kw_SYNTAX 322
166 #define kw_T61String 323
169 #define kw_TYPE_IDENTIFIER 326
170 #define kw_TeletexString 327
172 #define kw_UNIQUE 329
173 #define kw_UNIVERSAL 330
174 #define kw_UTCTime 331
175 #define kw_UTF8String 332
176 #define kw_UniversalString 333
177 #define kw_VideotexString 334
178 #define kw_VisibleString 335
183 #define IDENTIFIER 340
184 #define referencename 341
187 #define YYERRCODE 256
188 static const short yylhs[] = { -1,
189 0, 56, 56, 56, 56, 57, 57, 58, 58, 60,
190 60, 62, 62, 63, 63, 64, 59, 59, 59, 61,
191 61, 65, 65, 50, 50, 66, 14, 14, 14, 15,
192 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
193 15, 15, 15, 17, 48, 48, 48, 48, 21, 21,
194 21, 43, 43, 43, 38, 20, 41, 16, 16, 32,
195 23, 22, 49, 49, 24, 24, 25, 26, 26, 27,
196 18, 29, 29, 30, 31, 31, 19, 51, 52, 53,
197 53, 54, 54, 54, 55, 28, 35, 2, 2, 2,
198 2, 3, 3, 3, 67, 33, 34, 34, 34, 34,
199 34, 34, 34, 34, 40, 40, 40, 39, 36, 36,
200 36, 42, 42, 37, 47, 47, 44, 45, 45, 46,
201 46, 46, 4, 4, 5, 5, 5, 5, 5, 12,
202 11, 13, 9, 7, 7, 6, 1, 10, 8,
204 static const short yylen[] = { 2,
205 9, 2, 2, 2, 0, 2, 0, 3, 0, 3,
206 0, 1, 0, 1, 2, 4, 3, 2, 0, 1,
207 2, 1, 1, 3, 1, 3, 1, 1, 1, 1,
208 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
209 1, 1, 1, 1, 5, 5, 5, 3, 1, 2,
210 4, 1, 3, 3, 4, 4, 1, 2, 5, 2,
211 3, 1, 0, 2, 4, 3, 4, 4, 3, 3,
212 4, 1, 1, 1, 1, 1, 2, 3, 1, 1,
213 1, 2, 3, 5, 4, 3, 4, 0, 1, 1,
214 1, 0, 1, 1, 4, 1, 1, 1, 1, 1,
215 1, 1, 1, 1, 1, 3, 3, 2, 1, 2,
216 3, 1, 3, 4, 1, 0, 3, 0, 2, 4,
217 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
218 1, 1, 1, 1, 1, 1, 1, 1, 1,
220 static const short yydefred[] = { 0,
221 0, 0, 0, 115, 0, 0, 122, 0, 0, 0,
222 0, 117, 119, 0, 0, 0, 0, 0, 4, 2,
223 3, 0, 0, 120, 6, 0, 0, 0, 0, 0,
224 18, 0, 0, 1, 0, 0, 0, 17, 0, 0,
225 0, 14, 0, 8, 0, 22, 23, 24, 0, 10,
226 15, 0, 103, 44, 0, 0, 97, 75, 102, 0,
227 62, 0, 0, 100, 0, 0, 98, 76, 99, 104,
228 101, 0, 74, 0, 0, 27, 30, 31, 33, 29,
229 34, 35, 36, 38, 39, 40, 41, 42, 43, 28,
230 72, 73, 37, 32, 96, 0, 21, 0, 0, 0,
231 0, 0, 0, 50, 60, 0, 0, 0, 0, 0,
232 0, 0, 90, 91, 89, 0, 0, 0, 77, 93,
233 94, 0, 16, 0, 0, 105, 0, 0, 0, 52,
234 0, 0, 135, 0, 138, 134, 132, 133, 137, 136,
235 0, 123, 127, 125, 128, 126, 129, 130, 124, 131,
236 139, 0, 61, 64, 66, 0, 0, 0, 69, 0,
237 0, 95, 0, 0, 0, 0, 79, 80, 81, 0,
238 0, 112, 0, 0, 0, 110, 0, 71, 0, 56,
239 0, 0, 0, 48, 51, 65, 0, 68, 87, 0,
240 0, 0, 78, 0, 0, 59, 111, 107, 106, 0,
241 54, 53, 0, 0, 0, 0, 0, 83, 0, 113,
242 55, 47, 46, 45, 85, 0, 114, 84,
244 static const short yydgoto[] = { 2,
245 140, 116, 122, 141, 142, 143, 144, 145, 146, 147,
246 148, 149, 150, 75, 76, 77, 78, 79, 80, 81,
247 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
248 92, 93, 94, 95, 96, 126, 172, 130, 127, 128,
249 131, 173, 132, 151, 8, 9, 5, 104, 109, 39,
250 119, 166, 167, 168, 169, 17, 23, 29, 30, 36,
251 44, 40, 41, 42, 45, 46, 47,
253 static const short yysindex[] = { -295,
254 -74, 0, -289, 0, -216, 23, 0, -61, -289, -221,
255 -277, 0, 0, -259, -257, -256, -214, 31, 0, 0,
256 0, -220, -264, 0, 0, -187, -206, -232, -201, -213,
257 0, 34, 25, 0, -258, -251, -258, 0, -188, 40,
258 -258, 0, 63, 0, -251, 0, 0, 0, -239, 0,
259 0, -218, 0, 0, -19, -17, 0, 0, 0, -12,
260 0, -184, -212, 0, -106, -111, 0, 0, 0, 0,
261 0, 112, 0, -228, -37, 0, 0, 0, 0, 0,
262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
263 0, 0, 0, 0, 0, -242, 0, -74, -10, -223,
264 -215, -116, -215, 0, 0, -198, 87, -105, -179, 112,
265 -100, 89, 0, 0, 0, -211, -4, -225, 0, 0,
266 0, 112, 0, -210, 112, 0, -238, -13, 91, 0,
267 9, 92, 0, -202, 0, 0, 0, 0, 0, 0,
268 -33, 0, 0, 0, 0, 0, 0, 0, 0, 0,
269 0, -11, 0, 0, 0, -9, 112, 89, 0, -7,
270 44, 0, -128, 112, -127, 99, 0, 0, 0, 89,
271 101, 0, -2, 89, -4, 0, -283, 0, -200, 0,
272 -278, -4, -8, 0, 0, 0, 89, 0, 0, 19,
273 -27, -4, 0, -199, -210, 0, 0, 0, 0, 104,
274 0, 0, 105, 106, 107, 24, -115, 0, 109, 0,
275 0, 0, 0, 0, 0, -4, 0, 0,
277 static const short yyrindex[] = { 0,
278 -123, 0, 28, 0, 0, -110, 0, 0, 28, -245,
279 0, 0, 0, 0, 0, 0, -183, 0, 0, 0,
280 0, 0, 0, 0, 0, 0, -248, 0, 0, -182,
281 0, -41, 0, 0, 97, 0, 0, 0, 0, 0,
282 98, 0, 0, 0, -119, 0, 0, 0, 0, 0,
283 0, 0, 0, 0, 0, 0, 0, 0, 0, -30,
284 0, 0, 0, 0, -147, 0, 0, 0, 0, 0,
285 0, 0, 0, -181, 0, 0, 0, 0, 0, 0,
286 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
287 0, 0, 0, 0, 0, 169, 0, -49, -40, 0,
288 0, 0, 0, 0, 0, -35, 0, 0, 0, 0,
289 0, -244, 0, 0, 0, 0, 0, 0, 0, 0,
290 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
291 0, 36, 0, 0, 0, 0, 0, 0, 0, 0,
292 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
293 0, 0, 0, 0, 0, 0, 0, -25, 0, 0,
294 0, 0, 0, 0, 0, 0, 0, 0, 0, -20,
295 0, 0, 0, -42, 0, 0, 0, 0, 0, 0,
296 0, 0, 0, 0, 0, 0, -15, 0, 0, 0,
297 122, 0, 0, 0, 0, 0, 0, 0, 0, 0,
298 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
299 0, 0, 0, 0, 0, 0, 0, 0,
301 static const short yygindex[] = { 0,
302 -14, 0, 0, -95, 0, 0, 0, 0, 0, 0,
303 0, 0, 0, -31, 0, 0, 0, 0, 0, 0,
304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
305 0, 0, 0, 0, 0, -6, -29, -5, 0, -53,
306 0, 0, 61, 22, 158, 0, 70, 65, 64, 16,
307 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
308 128, 0, 0, 133, 0, 0, 0,
310 #define YYTABLESIZE 509
311 static const short yytable[] = { 58,
312 58, 108, 118, 58, 63, 63, 3, 184, 63, 116,
313 49, 111, 118, 49, 121, 70, 108, 25, 70, 155,
314 86, 162, 4, 86, 159, 67, 31, 102, 67, 9,
315 177, 113, 181, 26, 177, 175, 177, 5, 120, 14,
316 112, 195, 109, 33, 1, 19, 163, 164, 3, 121,
317 6, 165, 48, 7, 156, 198, 125, 160, 10, 15,
318 201, 129, 11, 12, 19, 18, 20, 21, 22, 176,
319 16, 24, 25, 26, 27, 28, 34, 37, 158, 197,
320 35, 32, 108, 38, 58, 114, 203, 205, 43, 63,
321 170, 19, 5, 174, 49, 26, 208, 49, 50, 70,
322 98, 115, 99, 100, 86, 101, 105, 32, 106, 67,
323 103, 178, 124, 185, 3, 186, 125, 188, 3, 4,
324 218, 107, 196, 109, 129, 187, 102, 157, 118, 171,
325 179, 161, 191, 180, 182, 181, 189, 190, 192, 193,
326 194, 206, 139, 209, 211, 212, 213, 214, 215, 217,
327 216, 116, 118, 74, 7, 13, 12, 11, 20, 63,
328 57, 88, 82, 152, 200, 210, 13, 123, 133, 153,
329 199, 154, 97, 51, 0, 202, 0, 0, 0, 0,
330 0, 0, 0, 0, 134, 0, 135, 0, 0, 0,
331 0, 0, 0, 0, 0, 110, 0, 0, 0, 0,
332 0, 0, 74, 0, 0, 0, 0, 0, 136, 0,
333 0, 0, 0, 107, 0, 0, 0, 0, 0, 0,
334 0, 0, 0, 137, 0, 138, 139, 0, 0, 121,
335 0, 108, 121, 58, 125, 0, 58, 58, 63, 125,
336 0, 63, 63, 49, 25, 0, 49, 49, 70, 207,
337 0, 70, 70, 86, 0, 0, 86, 86, 67, 92,
338 0, 67, 67, 0, 0, 108, 0, 58, 0, 0,
339 0, 0, 63, 0, 0, 0, 133, 49, 0, 0,
340 133, 0, 70, 0, 0, 0, 0, 86, 0, 0,
341 116, 204, 67, 0, 135, 0, 0, 58, 135, 58,
342 117, 0, 63, 183, 63, 0, 0, 49, 0, 49,
343 0, 0, 70, 0, 70, 0, 136, 86, 0, 86,
344 136, 0, 67, 0, 67, 52, 53, 54, 0, 0,
345 55, 137, 0, 138, 139, 137, 0, 138, 139, 0,
346 0, 56, 0, 0, 0, 0, 0, 0, 0, 57,
347 58, 0, 59, 0, 0, 0, 0, 0, 0, 60,
348 0, 0, 0, 0, 0, 61, 0, 62, 63, 0,
349 0, 0, 0, 0, 52, 53, 54, 64, 0, 55,
350 65, 66, 0, 0, 0, 0, 0, 0, 0, 67,
351 56, 0, 0, 68, 69, 70, 0, 71, 57, 58,
352 72, 59, 73, 0, 0, 0, 0, 0, 60, 0,
353 0, 0, 0, 0, 61, 0, 62, 63, 0, 0,
354 0, 0, 0, 0, 0, 0, 64, 0, 0, 65,
355 66, 92, 92, 92, 0, 0, 92, 0, 67, 0,
356 0, 0, 68, 69, 70, 0, 71, 92, 0, 0,
357 0, 73, 0, 0, 0, 92, 92, 0, 92, 0,
358 0, 0, 0, 0, 0, 92, 0, 0, 0, 0,
359 0, 92, 0, 92, 92, 0, 0, 0, 0, 0,
360 0, 0, 0, 92, 0, 0, 92, 92, 0, 0,
361 0, 0, 0, 0, 0, 92, 0, 0, 0, 92,
362 92, 92, 0, 92, 0, 0, 0, 0, 92,
364 static const short yycheck[] = { 40,
365 41, 44, 40, 44, 40, 41, 123, 41, 44, 59,
366 41, 123, 40, 44, 125, 41, 123, 59, 44, 125,
367 41, 117, 1, 44, 125, 41, 259, 40, 44, 278,
368 44, 260, 44, 278, 44, 274, 44, 283, 281, 261,
369 72, 44, 44, 28, 340, 294, 272, 273, 123, 292,
370 340, 277, 37, 343, 108, 339, 340, 111, 275, 281,
371 339, 340, 40, 125, 324, 343, 324, 324, 283, 308,
372 292, 41, 293, 338, 262, 282, 278, 44, 110, 175,
373 294, 340, 125, 59, 125, 314, 182, 183, 340, 125,
374 122, 340, 338, 125, 125, 340, 192, 286, 59, 125,
375 340, 330, 321, 123, 125, 123, 291, 340, 321, 125,
376 123, 125, 123, 125, 123, 125, 340, 125, 123, 98,
377 216, 320, 125, 125, 340, 157, 40, 307, 40, 340,
378 40, 343, 164, 125, 337, 44, 93, 266, 266, 41,
379 40, 123, 343, 343, 41, 41, 41, 41, 125, 41,
380 266, 275, 125, 91, 338, 59, 59, 340, 278, 307,
381 125, 343, 41, 103, 179, 195, 9, 98, 285, 106,
382 177, 107, 45, 41, -1, 181, -1, -1, -1, -1,
383 -1, -1, -1, -1, 301, -1, 303, -1, -1, -1,
384 -1, -1, -1, -1, -1, 307, -1, -1, -1, -1,
385 -1, -1, 91, -1, -1, -1, -1, -1, 325, -1,
386 -1, -1, -1, 320, -1, -1, -1, -1, -1, -1,
387 -1, -1, -1, 340, -1, 342, 343, -1, -1, 340,
388 -1, 274, 343, 274, 340, -1, 277, 278, 274, 340,
389 -1, 277, 278, 274, 286, -1, 277, 278, 274, 277,
390 -1, 277, 278, 274, -1, -1, 277, 278, 274, 91,
391 -1, 277, 278, -1, -1, 308, -1, 308, -1, -1,
392 -1, -1, 308, -1, -1, -1, 285, 308, -1, -1,
393 285, -1, 308, -1, -1, -1, -1, 308, -1, -1,
394 340, 300, 308, -1, 303, -1, -1, 338, 303, 340,
395 338, -1, 338, 337, 340, -1, -1, 338, -1, 340,
396 -1, -1, 338, -1, 340, -1, 325, 338, -1, 340,
397 325, -1, 338, -1, 340, 263, 264, 265, -1, -1,
398 268, 340, -1, 342, 343, 340, -1, 342, 343, -1,
399 -1, 279, -1, -1, -1, -1, -1, -1, -1, 287,
400 288, -1, 290, -1, -1, -1, -1, -1, -1, 297,
401 -1, -1, -1, -1, -1, 303, -1, 305, 306, -1,
402 -1, -1, -1, -1, 263, 264, 265, 315, -1, 268,
403 318, 319, -1, -1, -1, -1, -1, -1, -1, 327,
404 279, -1, -1, 331, 332, 333, -1, 335, 287, 288,
405 338, 290, 340, -1, -1, -1, -1, -1, 297, -1,
406 -1, -1, -1, -1, 303, -1, 305, 306, -1, -1,
407 -1, -1, -1, -1, -1, -1, 315, -1, -1, 318,
408 319, 263, 264, 265, -1, -1, 268, -1, 327, -1,
409 -1, -1, 331, 332, 333, -1, 335, 279, -1, -1,
410 -1, 340, -1, -1, -1, 287, 288, -1, 290, -1,
411 -1, -1, -1, -1, -1, 297, -1, -1, -1, -1,
412 -1, 303, -1, 305, 306, -1, -1, -1, -1, -1,
413 -1, -1, -1, 315, -1, -1, 318, 319, -1, -1,
414 -1, -1, -1, -1, -1, 327, -1, -1, -1, 331,
415 332, 333, -1, 335, -1, -1, -1, -1, 340,
421 #define YYMAXTOKEN 343
423 static const char *yyname[] = {
425 "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,
426 0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,0,0,0,0,0,
427 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,
428 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,0,0,0,0,0,0,0,0,0,0,0,
429 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
430 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
431 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
432 "kw_ABSENT","kw_ABSTRACT_SYNTAX","kw_ALL","kw_APPLICATION","kw_AUTOMATIC",
433 "kw_BEGIN","kw_BIT","kw_BMPString","kw_BOOLEAN","kw_BY","kw_CHARACTER",
434 "kw_CHOICE","kw_CLASS","kw_COMPONENT","kw_COMPONENTS","kw_CONSTRAINED",
435 "kw_CONTAINING","kw_DEFAULT","kw_DEFINITIONS","kw_EMBEDDED","kw_ENCODED",
436 "kw_END","kw_ENUMERATED","kw_EXCEPT","kw_EXPLICIT","kw_EXPORTS",
437 "kw_EXTENSIBILITY","kw_EXTERNAL","kw_FALSE","kw_FROM","kw_GeneralString",
438 "kw_GeneralizedTime","kw_GraphicString","kw_IA5String","kw_IDENTIFIER",
439 "kw_IMPLICIT","kw_IMPLIED","kw_IMPORTS","kw_INCLUDES","kw_INSTANCE",
440 "kw_INTEGER","kw_INTERSECTION","kw_ISO646String","kw_MAX","kw_MIN",
441 "kw_MINUS_INFINITY","kw_NULL","kw_NumericString","kw_OBJECT","kw_OCTET","kw_OF",
442 "kw_OPTIONAL","kw_ObjectDescriptor","kw_PATTERN","kw_PDV","kw_PLUS_INFINITY",
443 "kw_PRESENT","kw_PRIVATE","kw_PrintableString","kw_REAL","kw_RELATIVE_OID",
444 "kw_SEQUENCE","kw_SET","kw_SIZE","kw_STRING","kw_SYNTAX","kw_T61String",
445 "kw_TAGS","kw_TRUE","kw_TYPE_IDENTIFIER","kw_TeletexString","kw_UNION",
446 "kw_UNIQUE","kw_UNIVERSAL","kw_UTCTime","kw_UTF8String","kw_UniversalString",
447 "kw_VideotexString","kw_VisibleString","kw_WITH","RANGE","EEQUAL","ELLIPSIS",
448 "IDENTIFIER","referencename","STRING","NUMBER",
450 static const char *yyrule[] = {
451 "$accept : ModuleDefinition",
452 "ModuleDefinition : IDENTIFIER objid_opt kw_DEFINITIONS TagDefault ExtensionDefault EEQUAL kw_BEGIN ModuleBody kw_END",
453 "TagDefault : kw_EXPLICIT kw_TAGS",
454 "TagDefault : kw_IMPLICIT kw_TAGS",
455 "TagDefault : kw_AUTOMATIC kw_TAGS",
457 "ExtensionDefault : kw_EXTENSIBILITY kw_IMPLIED",
458 "ExtensionDefault :",
459 "ModuleBody : Exports Imports AssignmentList",
461 "Imports : kw_IMPORTS SymbolsImported ';'",
463 "SymbolsImported : SymbolsFromModuleList",
465 "SymbolsFromModuleList : SymbolsFromModule",
466 "SymbolsFromModuleList : SymbolsFromModuleList SymbolsFromModule",
467 "SymbolsFromModule : referencenames kw_FROM IDENTIFIER objid_opt",
468 "Exports : kw_EXPORTS referencenames ';'",
469 "Exports : kw_EXPORTS kw_ALL",
471 "AssignmentList : Assignment",
472 "AssignmentList : Assignment AssignmentList",
473 "Assignment : TypeAssignment",
474 "Assignment : ValueAssignment",
475 "referencenames : IDENTIFIER ',' referencenames",
476 "referencenames : IDENTIFIER",
477 "TypeAssignment : IDENTIFIER EEQUAL Type",
478 "Type : BuiltinType",
479 "Type : ReferencedType",
480 "Type : ConstrainedType",
481 "BuiltinType : BitStringType",
482 "BuiltinType : BooleanType",
483 "BuiltinType : CharacterStringType",
484 "BuiltinType : ChoiceType",
485 "BuiltinType : EnumeratedType",
486 "BuiltinType : IntegerType",
487 "BuiltinType : NullType",
488 "BuiltinType : ObjectIdentifierType",
489 "BuiltinType : OctetStringType",
490 "BuiltinType : SequenceType",
491 "BuiltinType : SequenceOfType",
492 "BuiltinType : SetType",
493 "BuiltinType : SetOfType",
494 "BuiltinType : TaggedType",
495 "BooleanType : kw_BOOLEAN",
496 "range : '(' Value RANGE Value ')'",
497 "range : '(' Value RANGE kw_MAX ')'",
498 "range : '(' kw_MIN RANGE Value ')'",
499 "range : '(' Value ')'",
500 "IntegerType : kw_INTEGER",
501 "IntegerType : kw_INTEGER range",
502 "IntegerType : kw_INTEGER '{' NamedNumberList '}'",
503 "NamedNumberList : NamedNumber",
504 "NamedNumberList : NamedNumberList ',' NamedNumber",
505 "NamedNumberList : NamedNumberList ',' ELLIPSIS",
506 "NamedNumber : IDENTIFIER '(' SignedNumber ')'",
507 "EnumeratedType : kw_ENUMERATED '{' Enumerations '}'",
508 "Enumerations : NamedNumberList",
509 "BitStringType : kw_BIT kw_STRING",
510 "BitStringType : kw_BIT kw_STRING '{' NamedBitList '}'",
511 "ObjectIdentifierType : kw_OBJECT kw_IDENTIFIER",
512 "OctetStringType : kw_OCTET kw_STRING size",
513 "NullType : kw_NULL",
515 "size : kw_SIZE range",
516 "SequenceType : kw_SEQUENCE '{' ComponentTypeList '}'",
517 "SequenceType : kw_SEQUENCE '{' '}'",
518 "SequenceOfType : kw_SEQUENCE size kw_OF Type",
519 "SetType : kw_SET '{' ComponentTypeList '}'",
520 "SetType : kw_SET '{' '}'",
521 "SetOfType : kw_SET kw_OF Type",
522 "ChoiceType : kw_CHOICE '{' ComponentTypeList '}'",
523 "ReferencedType : DefinedType",
524 "ReferencedType : UsefulType",
525 "DefinedType : IDENTIFIER",
526 "UsefulType : kw_GeneralizedTime",
527 "UsefulType : kw_UTCTime",
528 "ConstrainedType : Type Constraint",
529 "Constraint : '(' ConstraintSpec ')'",
530 "ConstraintSpec : GeneralConstraint",
531 "GeneralConstraint : ContentsConstraint",
532 "GeneralConstraint : UserDefinedConstraint",
533 "ContentsConstraint : kw_CONTAINING Type",
534 "ContentsConstraint : kw_ENCODED kw_BY Value",
535 "ContentsConstraint : kw_CONTAINING Type kw_ENCODED kw_BY Value",
536 "UserDefinedConstraint : kw_CONSTRAINED kw_BY '{' '}'",
537 "TaggedType : Tag tagenv Type",
538 "Tag : '[' Class NUMBER ']'",
540 "Class : kw_UNIVERSAL",
541 "Class : kw_APPLICATION",
542 "Class : kw_PRIVATE",
544 "tagenv : kw_EXPLICIT",
545 "tagenv : kw_IMPLICIT",
546 "ValueAssignment : IDENTIFIER Type EEQUAL Value",
547 "CharacterStringType : RestrictedCharactedStringType",
548 "RestrictedCharactedStringType : kw_GeneralString",
549 "RestrictedCharactedStringType : kw_TeletexString",
550 "RestrictedCharactedStringType : kw_UTF8String",
551 "RestrictedCharactedStringType : kw_PrintableString",
552 "RestrictedCharactedStringType : kw_VisibleString",
553 "RestrictedCharactedStringType : kw_IA5String",
554 "RestrictedCharactedStringType : kw_BMPString",
555 "RestrictedCharactedStringType : kw_UniversalString",
556 "ComponentTypeList : ComponentType",
557 "ComponentTypeList : ComponentTypeList ',' ComponentType",
558 "ComponentTypeList : ComponentTypeList ',' ELLIPSIS",
559 "NamedType : IDENTIFIER Type",
560 "ComponentType : NamedType",
561 "ComponentType : NamedType kw_OPTIONAL",
562 "ComponentType : NamedType kw_DEFAULT Value",
563 "NamedBitList : NamedBit",
564 "NamedBitList : NamedBitList ',' NamedBit",
565 "NamedBit : IDENTIFIER '(' NUMBER ')'",
568 "objid : '{' objid_list '}'",
570 "objid_list : objid_element objid_list",
571 "objid_element : IDENTIFIER '(' NUMBER ')'",
572 "objid_element : IDENTIFIER",
573 "objid_element : NUMBER",
574 "Value : BuiltinValue",
575 "Value : ReferencedValue",
576 "BuiltinValue : BooleanValue",
577 "BuiltinValue : CharacterStringValue",
578 "BuiltinValue : IntegerValue",
579 "BuiltinValue : ObjectIdentifierValue",
580 "BuiltinValue : NullValue",
581 "ReferencedValue : DefinedValue",
582 "DefinedValue : Valuereference",
583 "Valuereference : IDENTIFIER",
584 "CharacterStringValue : STRING",
585 "BooleanValue : kw_TRUE",
586 "BooleanValue : kw_FALSE",
587 "IntegerValue : SignedNumber",
588 "SignedNumber : NUMBER",
589 "NullValue : kw_NULL",
590 "ObjectIdentifierValue : objid",
594 /* define the initial stack-sizes */
597 #define YYMAXDEPTH YYSTACKSIZE
600 #define YYSTACKSIZE YYMAXDEPTH
602 #define YYSTACKSIZE 500
603 #define YYMAXDEPTH 500
607 #define YYINITSTACKSIZE 500
625 /* variables for the parser stack */
626 static YYSTACKDATA yystack;
627 #line 945 "asn1parse.c"
630 yyerror (const char *s)
632 lex_error_message ("%s\n", s);
636 new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
639 if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
641 oldtype = oldtype->subtype; /* XXX */
645 t->tag.tagclass = tagclass;
646 t->tag.tagvalue = tagvalue;
647 t->tag.tagenv = tagenv;
648 t->subtype = oldtype;
652 static struct objid *
653 new_objid(const char *label, int value)
656 s = emalloc(sizeof(*s));
664 add_oid_to_tail(struct objid *head, struct objid *tail)
674 new_type (Typetype tt)
676 Type *t = ecalloc(1, sizeof(*t));
681 static struct constraint_spec *
682 new_constraint_spec(enum ctype ct)
684 struct constraint_spec *c = ecalloc(1, sizeof(*c));
689 static void fix_labels2(Type *t, const char *prefix);
690 static void fix_labels1(struct memhead *members, const char *prefix)
696 ASN1_TAILQ_FOREACH(m, members, members) {
697 if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0)
699 if (m->label == NULL)
702 fix_labels2(m->type, m->label);
706 static void fix_labels2(Type *t, const char *prefix)
708 for(; t; t = t->subtype)
709 fix_labels1(t->members, prefix);
713 fix_labels(Symbol *s)
716 if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL)
718 fix_labels2(s->type, p);
721 #line 721 "asn1parse.c"
724 #include <stdio.h> /* needed for printf */
727 #include <stdlib.h> /* needed for malloc, etc */
728 #include <string.h> /* needed for memset */
730 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
731 static int yygrowstack(YYSTACKDATA *data)
738 if ((newsize = data->stacksize) == 0)
739 newsize = YYINITSTACKSIZE;
740 else if (newsize >= YYMAXDEPTH)
742 else if ((newsize *= 2) > YYMAXDEPTH)
743 newsize = YYMAXDEPTH;
745 i = data->s_mark - data->s_base;
746 newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
750 data->s_base = newss;
751 data->s_mark = newss + i;
753 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
757 data->l_base = newvs;
758 data->l_mark = newvs + i;
760 data->stacksize = newsize;
761 data->s_last = data->s_base + newsize - 1;
765 #if YYPURE || defined(YY_NO_LEAKS)
766 static void yyfreestack(YYSTACKDATA *data)
770 memset(data, 0, sizeof(*data));
773 #define yyfreestack(data) /* nothing */
776 #define YYABORT goto yyabort
777 #define YYREJECT goto yyabort
778 #define YYACCEPT goto yyaccept
779 #define YYERROR goto yyerrlab
784 int yym, yyn, yystate;
788 if ((yys = getenv("YYDEBUG")) != 0)
791 if (yyn >= '0' && yyn <= '9')
802 memset(&yystack, 0, sizeof(yystack));
805 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
806 yystack.s_mark = yystack.s_base;
807 yystack.l_mark = yystack.l_base;
812 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
815 if ((yychar = YYLEX) < 0) yychar = 0;
820 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
821 if (!yys) yys = "illegal-symbol";
822 printf("%sdebug: state %d, reading %d (%s)\n",
823 YYPREFIX, yystate, yychar, yys);
827 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
828 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
832 printf("%sdebug: state %d, shifting to state %d\n",
833 YYPREFIX, yystate, yytable[yyn]);
835 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
839 yystate = yytable[yyn];
840 *++yystack.s_mark = yytable[yyn];
841 *++yystack.l_mark = yylval;
843 if (yyerrflag > 0) --yyerrflag;
846 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
847 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
852 if (yyerrflag) goto yyinrecovery;
854 yyerror("syntax error");
867 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
868 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
872 printf("%sdebug: state %d, error recovery shifting\
873 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
875 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
879 yystate = yytable[yyn];
880 *++yystack.s_mark = yytable[yyn];
881 *++yystack.l_mark = yylval;
888 printf("%sdebug: error recovery discarding state %d\n",
889 YYPREFIX, *yystack.s_mark);
891 if (yystack.s_mark <= yystack.s_base) goto yyabort;
899 if (yychar == 0) goto yyabort;
904 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
905 if (!yys) yys = "illegal-symbol";
906 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
907 YYPREFIX, yystate, yychar, yys);
917 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
918 YYPREFIX, yystate, yyn, yyrule[yyn]);
922 yyval = yystack.l_mark[1-yym];
924 memset(&yyval, 0, sizeof yyval);
928 #line 241 "asn1parse.c"
934 #line 248 "asn1parse.c"
935 { lex_error_message("implicit tagging is not supported"); }
938 #line 250 "asn1parse.c"
939 { lex_error_message("automatic tagging is not supported"); }
942 #line 255 "asn1parse.c"
943 { lex_error_message("no extensibility options supported"); }
946 #line 276 "asn1parse.c"
948 struct string_list *sl;
949 for(sl = yystack.l_mark[-3].sl; sl != NULL; sl = sl->next) {
950 Symbol *s = addsym(sl->string);
952 gen_template_import(s);
954 add_import(yystack.l_mark[-1].name);
958 #line 288 "asn1parse.c"
960 struct string_list *sl;
961 for(sl = yystack.l_mark[-1].sl; sl != NULL; sl = sl->next)
962 add_export(sl->string);
966 #line 306 "asn1parse.c"
968 yyval.sl = emalloc(sizeof(*yyval.sl));
969 yyval.sl->string = yystack.l_mark[-2].name;
970 yyval.sl->next = yystack.l_mark[0].sl;
974 #line 312 "asn1parse.c"
976 yyval.sl = emalloc(sizeof(*yyval.sl));
977 yyval.sl->string = yystack.l_mark[0].name;
978 yyval.sl->next = NULL;
982 #line 320 "asn1parse.c"
984 Symbol *s = addsym (yystack.l_mark[-2].name);
986 s->type = yystack.l_mark[0].type;
992 #line 351 "asn1parse.c"
994 yyval.type = new_tag(ASN1_C_UNIV, UT_Boolean,
995 TE_EXPLICIT, new_type(TBoolean));
999 #line 358 "asn1parse.c"
1001 if(yystack.l_mark[-3].value->type != integervalue)
1002 lex_error_message("Non-integer used in first part of range");
1003 if(yystack.l_mark[-3].value->type != integervalue)
1004 lex_error_message("Non-integer in second part of range");
1005 yyval.range = ecalloc(1, sizeof(*yyval.range));
1006 yyval.range->min = yystack.l_mark[-3].value->u.integervalue;
1007 yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
1011 #line 368 "asn1parse.c"
1013 if(yystack.l_mark[-3].value->type != integervalue)
1014 lex_error_message("Non-integer in first part of range");
1015 yyval.range = ecalloc(1, sizeof(*yyval.range));
1016 yyval.range->min = yystack.l_mark[-3].value->u.integervalue;
1017 yyval.range->max = yystack.l_mark[-3].value->u.integervalue - 1;
1021 #line 376 "asn1parse.c"
1023 if(yystack.l_mark[-1].value->type != integervalue)
1024 lex_error_message("Non-integer in second part of range");
1025 yyval.range = ecalloc(1, sizeof(*yyval.range));
1026 yyval.range->min = yystack.l_mark[-1].value->u.integervalue + 2;
1027 yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
1031 #line 384 "asn1parse.c"
1033 if(yystack.l_mark[-1].value->type != integervalue)
1034 lex_error_message("Non-integer used in limit");
1035 yyval.range = ecalloc(1, sizeof(*yyval.range));
1036 yyval.range->min = yystack.l_mark[-1].value->u.integervalue;
1037 yyval.range->max = yystack.l_mark[-1].value->u.integervalue;
1041 #line 395 "asn1parse.c"
1043 yyval.type = new_tag(ASN1_C_UNIV, UT_Integer,
1044 TE_EXPLICIT, new_type(TInteger));
1048 #line 400 "asn1parse.c"
1050 yyval.type = new_type(TInteger);
1051 yyval.type->range = yystack.l_mark[0].range;
1052 yyval.type = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, yyval.type);
1056 #line 406 "asn1parse.c"
1058 yyval.type = new_type(TInteger);
1059 yyval.type->members = yystack.l_mark[-1].members;
1060 yyval.type = new_tag(ASN1_C_UNIV, UT_Integer, TE_EXPLICIT, yyval.type);
1064 #line 414 "asn1parse.c"
1066 yyval.members = emalloc(sizeof(*yyval.members));
1067 ASN1_TAILQ_INIT(yyval.members);
1068 ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
1072 #line 420 "asn1parse.c"
1074 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
1075 yyval.members = yystack.l_mark[-2].members;
1079 #line 425 "asn1parse.c"
1080 { yyval.members = yystack.l_mark[-2].members; }
1083 #line 429 "asn1parse.c"
1085 yyval.member = emalloc(sizeof(*yyval.member));
1086 yyval.member->name = yystack.l_mark[-3].name;
1087 yyval.member->gen_name = estrdup(yystack.l_mark[-3].name);
1088 output_name (yyval.member->gen_name);
1089 yyval.member->val = yystack.l_mark[-1].constant;
1090 yyval.member->optional = 0;
1091 yyval.member->ellipsis = 0;
1092 yyval.member->type = NULL;
1096 #line 442 "asn1parse.c"
1098 yyval.type = new_type(TInteger);
1099 yyval.type->members = yystack.l_mark[-1].members;
1100 yyval.type = new_tag(ASN1_C_UNIV, UT_Enumerated, TE_EXPLICIT, yyval.type);
1104 #line 453 "asn1parse.c"
1106 yyval.type = new_type(TBitString);
1107 yyval.type->members = emalloc(sizeof(*yyval.type->members));
1108 ASN1_TAILQ_INIT(yyval.type->members);
1109 yyval.type = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, yyval.type);
1113 #line 460 "asn1parse.c"
1115 yyval.type = new_type(TBitString);
1116 yyval.type->members = yystack.l_mark[-1].members;
1117 yyval.type = new_tag(ASN1_C_UNIV, UT_BitString, TE_EXPLICIT, yyval.type);
1121 #line 468 "asn1parse.c"
1123 yyval.type = new_tag(ASN1_C_UNIV, UT_OID,
1124 TE_EXPLICIT, new_type(TOID));
1128 #line 474 "asn1parse.c"
1130 Type *t = new_type(TOctetString);
1131 t->range = yystack.l_mark[0].range;
1132 yyval.type = new_tag(ASN1_C_UNIV, UT_OctetString,
1137 #line 483 "asn1parse.c"
1139 yyval.type = new_tag(ASN1_C_UNIV, UT_Null,
1140 TE_EXPLICIT, new_type(TNull));
1144 #line 490 "asn1parse.c"
1145 { yyval.range = NULL; }
1148 #line 492 "asn1parse.c"
1149 { yyval.range = yystack.l_mark[0].range; }
1152 #line 497 "asn1parse.c"
1154 yyval.type = new_type(TSequence);
1155 yyval.type->members = yystack.l_mark[-1].members;
1156 yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
1160 #line 503 "asn1parse.c"
1162 yyval.type = new_type(TSequence);
1163 yyval.type->members = NULL;
1164 yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
1168 #line 511 "asn1parse.c"
1170 yyval.type = new_type(TSequenceOf);
1171 yyval.type->range = yystack.l_mark[-2].range;
1172 yyval.type->subtype = yystack.l_mark[0].type;
1173 yyval.type = new_tag(ASN1_C_UNIV, UT_Sequence, TE_EXPLICIT, yyval.type);
1177 #line 520 "asn1parse.c"
1179 yyval.type = new_type(TSet);
1180 yyval.type->members = yystack.l_mark[-1].members;
1181 yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
1185 #line 526 "asn1parse.c"
1187 yyval.type = new_type(TSet);
1188 yyval.type->members = NULL;
1189 yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
1193 #line 534 "asn1parse.c"
1195 yyval.type = new_type(TSetOf);
1196 yyval.type->subtype = yystack.l_mark[0].type;
1197 yyval.type = new_tag(ASN1_C_UNIV, UT_Set, TE_EXPLICIT, yyval.type);
1201 #line 542 "asn1parse.c"
1203 yyval.type = new_type(TChoice);
1204 yyval.type->members = yystack.l_mark[-1].members;
1208 #line 553 "asn1parse.c"
1210 Symbol *s = addsym(yystack.l_mark[0].name);
1211 yyval.type = new_type(TType);
1212 if(s->stype != Stype && s->stype != SUndefined)
1213 lex_error_message ("%s is not a type\n", yystack.l_mark[0].name);
1215 yyval.type->symbol = s;
1219 #line 564 "asn1parse.c"
1221 yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
1222 TE_EXPLICIT, new_type(TGeneralizedTime));
1226 #line 569 "asn1parse.c"
1228 yyval.type = new_tag(ASN1_C_UNIV, UT_UTCTime,
1229 TE_EXPLICIT, new_type(TUTCTime));
1233 #line 576 "asn1parse.c"
1235 /* if (Constraint.type == contentConstrant) {
1236 assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
1237 if (Constraint.u.constraint.type) {
1238 assert((Constraint.u.constraint.type.length % 8) == 0);
1241 if (Constraint.u.constraint.encoding) {
1242 type == der-oid|ber-oid
1248 #line 592 "asn1parse.c"
1250 yyval.constraint_spec = yystack.l_mark[-1].constraint_spec;
1254 #line 605 "asn1parse.c"
1256 yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
1257 yyval.constraint_spec->u.content.type = yystack.l_mark[0].type;
1258 yyval.constraint_spec->u.content.encoding = NULL;
1262 #line 611 "asn1parse.c"
1264 if (yystack.l_mark[0].value->type != objectidentifiervalue)
1265 lex_error_message("Non-OID used in ENCODED BY constraint");
1266 yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
1267 yyval.constraint_spec->u.content.type = NULL;
1268 yyval.constraint_spec->u.content.encoding = yystack.l_mark[0].value;
1272 #line 619 "asn1parse.c"
1274 if (yystack.l_mark[0].value->type != objectidentifiervalue)
1275 lex_error_message("Non-OID used in ENCODED BY constraint");
1276 yyval.constraint_spec = new_constraint_spec(CT_CONTENTS);
1277 yyval.constraint_spec->u.content.type = yystack.l_mark[-3].type;
1278 yyval.constraint_spec->u.content.encoding = yystack.l_mark[0].value;
1282 #line 629 "asn1parse.c"
1284 yyval.constraint_spec = new_constraint_spec(CT_USER);
1288 #line 635 "asn1parse.c"
1290 yyval.type = new_type(TTag);
1291 yyval.type->tag = yystack.l_mark[-2].tag;
1292 yyval.type->tag.tagenv = yystack.l_mark[-1].constant;
1293 if(yystack.l_mark[0].type->type == TTag && yystack.l_mark[-1].constant == TE_IMPLICIT) {
1294 yyval.type->subtype = yystack.l_mark[0].type->subtype;
1295 free(yystack.l_mark[0].type);
1297 yyval.type->subtype = yystack.l_mark[0].type;
1301 #line 648 "asn1parse.c"
1303 yyval.tag.tagclass = yystack.l_mark[-2].constant;
1304 yyval.tag.tagvalue = yystack.l_mark[-1].constant;
1305 yyval.tag.tagenv = TE_EXPLICIT;
1309 #line 656 "asn1parse.c"
1311 yyval.constant = ASN1_C_CONTEXT;
1315 #line 660 "asn1parse.c"
1317 yyval.constant = ASN1_C_UNIV;
1321 #line 664 "asn1parse.c"
1323 yyval.constant = ASN1_C_APPL;
1327 #line 668 "asn1parse.c"
1329 yyval.constant = ASN1_C_PRIVATE;
1333 #line 674 "asn1parse.c"
1335 yyval.constant = TE_EXPLICIT;
1339 #line 678 "asn1parse.c"
1341 yyval.constant = TE_EXPLICIT;
1345 #line 682 "asn1parse.c"
1347 yyval.constant = TE_IMPLICIT;
1351 #line 689 "asn1parse.c"
1354 s = addsym (yystack.l_mark[-3].name);
1357 s->value = yystack.l_mark[0].value;
1358 generate_constant (s);
1362 #line 703 "asn1parse.c"
1364 yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralString,
1365 TE_EXPLICIT, new_type(TGeneralString));
1369 #line 708 "asn1parse.c"
1371 yyval.type = new_tag(ASN1_C_UNIV, UT_TeletexString,
1372 TE_EXPLICIT, new_type(TTeletexString));
1376 #line 713 "asn1parse.c"
1378 yyval.type = new_tag(ASN1_C_UNIV, UT_UTF8String,
1379 TE_EXPLICIT, new_type(TUTF8String));
1383 #line 718 "asn1parse.c"
1385 yyval.type = new_tag(ASN1_C_UNIV, UT_PrintableString,
1386 TE_EXPLICIT, new_type(TPrintableString));
1390 #line 723 "asn1parse.c"
1392 yyval.type = new_tag(ASN1_C_UNIV, UT_VisibleString,
1393 TE_EXPLICIT, new_type(TVisibleString));
1397 #line 728 "asn1parse.c"
1399 yyval.type = new_tag(ASN1_C_UNIV, UT_IA5String,
1400 TE_EXPLICIT, new_type(TIA5String));
1404 #line 733 "asn1parse.c"
1406 yyval.type = new_tag(ASN1_C_UNIV, UT_BMPString,
1407 TE_EXPLICIT, new_type(TBMPString));
1411 #line 738 "asn1parse.c"
1413 yyval.type = new_tag(ASN1_C_UNIV, UT_UniversalString,
1414 TE_EXPLICIT, new_type(TUniversalString));
1418 #line 746 "asn1parse.c"
1420 yyval.members = emalloc(sizeof(*yyval.members));
1421 ASN1_TAILQ_INIT(yyval.members);
1422 ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
1426 #line 752 "asn1parse.c"
1428 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
1429 yyval.members = yystack.l_mark[-2].members;
1433 #line 757 "asn1parse.c"
1435 struct member *m = ecalloc(1, sizeof(*m));
1436 m->name = estrdup("...");
1437 m->gen_name = estrdup("asn1_ellipsis");
1439 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, m, members);
1440 yyval.members = yystack.l_mark[-2].members;
1444 #line 768 "asn1parse.c"
1446 yyval.member = emalloc(sizeof(*yyval.member));
1447 yyval.member->name = yystack.l_mark[-1].name;
1448 yyval.member->gen_name = estrdup(yystack.l_mark[-1].name);
1449 output_name (yyval.member->gen_name);
1450 yyval.member->type = yystack.l_mark[0].type;
1451 yyval.member->ellipsis = 0;
1455 #line 779 "asn1parse.c"
1457 yyval.member = yystack.l_mark[0].member;
1458 yyval.member->optional = 0;
1459 yyval.member->defval = NULL;
1463 #line 785 "asn1parse.c"
1465 yyval.member = yystack.l_mark[-1].member;
1466 yyval.member->optional = 1;
1467 yyval.member->defval = NULL;
1471 #line 791 "asn1parse.c"
1473 yyval.member = yystack.l_mark[-2].member;
1474 yyval.member->optional = 0;
1475 yyval.member->defval = yystack.l_mark[0].value;
1479 #line 799 "asn1parse.c"
1481 yyval.members = emalloc(sizeof(*yyval.members));
1482 ASN1_TAILQ_INIT(yyval.members);
1483 ASN1_TAILQ_INSERT_HEAD(yyval.members, yystack.l_mark[0].member, members);
1487 #line 805 "asn1parse.c"
1489 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
1490 yyval.members = yystack.l_mark[-2].members;
1494 #line 812 "asn1parse.c"
1496 yyval.member = emalloc(sizeof(*yyval.member));
1497 yyval.member->name = yystack.l_mark[-3].name;
1498 yyval.member->gen_name = estrdup(yystack.l_mark[-3].name);
1499 output_name (yyval.member->gen_name);
1500 yyval.member->val = yystack.l_mark[-1].constant;
1501 yyval.member->optional = 0;
1502 yyval.member->ellipsis = 0;
1503 yyval.member->type = NULL;
1507 #line 825 "asn1parse.c"
1508 { yyval.objid = NULL; }
1511 #line 829 "asn1parse.c"
1513 yyval.objid = yystack.l_mark[-1].objid;
1517 #line 835 "asn1parse.c"
1523 #line 839 "asn1parse.c"
1525 if (yystack.l_mark[0].objid) {
1526 yyval.objid = yystack.l_mark[0].objid;
1527 add_oid_to_tail(yystack.l_mark[0].objid, yystack.l_mark[-1].objid);
1529 yyval.objid = yystack.l_mark[-1].objid;
1534 #line 850 "asn1parse.c"
1536 yyval.objid = new_objid(yystack.l_mark[-3].name, yystack.l_mark[-1].constant);
1540 #line 854 "asn1parse.c"
1542 Symbol *s = addsym(yystack.l_mark[0].name);
1543 if(s->stype != SValue ||
1544 s->value->type != objectidentifiervalue) {
1545 lex_error_message("%s is not an object identifier\n",
1549 yyval.objid = s->value->u.objectidentifiervalue;
1553 #line 865 "asn1parse.c"
1555 yyval.objid = new_objid(NULL, yystack.l_mark[0].constant);
1559 #line 888 "asn1parse.c"
1561 Symbol *s = addsym(yystack.l_mark[0].name);
1562 if(s->stype != SValue)
1563 lex_error_message ("%s is not a value\n",
1566 yyval.value = s->value;
1570 #line 899 "asn1parse.c"
1572 yyval.value = emalloc(sizeof(*yyval.value));
1573 yyval.value->type = stringvalue;
1574 yyval.value->u.stringvalue = yystack.l_mark[0].name;
1578 #line 907 "asn1parse.c"
1580 yyval.value = emalloc(sizeof(*yyval.value));
1581 yyval.value->type = booleanvalue;
1582 yyval.value->u.booleanvalue = 0;
1586 #line 913 "asn1parse.c"
1588 yyval.value = emalloc(sizeof(*yyval.value));
1589 yyval.value->type = booleanvalue;
1590 yyval.value->u.booleanvalue = 0;
1594 #line 921 "asn1parse.c"
1596 yyval.value = emalloc(sizeof(*yyval.value));
1597 yyval.value->type = integervalue;
1598 yyval.value->u.integervalue = yystack.l_mark[0].constant;
1602 #line 932 "asn1parse.c"
1607 #line 937 "asn1parse.c"
1609 yyval.value = emalloc(sizeof(*yyval.value));
1610 yyval.value->type = objectidentifiervalue;
1611 yyval.value->u.objectidentifiervalue = yystack.l_mark[0].objid;
1614 #line 1614 "asn1parse.c"
1616 yystack.s_mark -= yym;
1617 yystate = *yystack.s_mark;
1618 yystack.l_mark -= yym;
1620 if (yystate == 0 && yym == 0)
1624 printf("%sdebug: after reduction, shifting from state 0 to\
1625 state %d\n", YYPREFIX, YYFINAL);
1628 *++yystack.s_mark = YYFINAL;
1629 *++yystack.l_mark = yyval;
1632 if ((yychar = YYLEX) < 0) yychar = 0;
1637 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
1638 if (!yys) yys = "illegal-symbol";
1639 printf("%sdebug: state %d, reading %d (%s)\n",
1640 YYPREFIX, YYFINAL, yychar, yys);
1644 if (yychar == 0) goto yyaccept;
1647 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1648 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1649 yystate = yytable[yyn];
1651 yystate = yydgoto[yym];
1654 printf("%sdebug: after reduction, shifting from state %d \
1655 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1657 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
1661 *++yystack.s_mark = (short) yystate;
1662 *++yystack.l_mark = yyval;
1666 yyerror("yacc stack overflow");
1669 yyfreestack(&yystack);
1673 yyfreestack(&yystack);