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)
32 static Type
*new_type (Typetype t
);
33 static struct constraint_spec
*new_constraint_spec(enum ctype
);
34 static Type
*new_tag(int tagclass
, int tagvalue
, int tagenv
, Type
*oldtype
);
35 void yyerror (const char *);
36 static struct objid
*new_objid(const char *label
, int value
);
37 static void add_oid_to_tail(struct objid
*, struct objid
*);
38 static void fix_labels(Symbol
*s
);
42 struct string_list
*next
;
45 /* Declarations for Bison */
46 #define YYMALLOC malloc
50 #undef YYSTYPE_IS_DECLARED
51 #define YYSTYPE_IS_DECLARED 1
53 #ifndef YYSTYPE_IS_DECLARED
54 #define YYSTYPE_IS_DECLARED 1
64 struct string_list
*sl
;
66 struct memhead
*members
;
67 struct constraint_spec
*constraint_spec
;
69 #endif /* !YYSTYPE_IS_DECLARED */
70 /* compatibility with bison */
72 /* compatibility with FreeBSD */
73 # ifdef YYPARSE_PARAM_TYPE
74 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
76 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
79 # define YYPARSE_DECL() yyparse(void)
82 /* Parameters sent to lex. */
84 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
85 # define YYLEX yylex(YYLEX_PARAM)
87 # define YYLEX_DECL() yylex(void)
88 # define YYLEX yylex()
91 /* Parameters sent to yyerror. */
92 #define YYERROR_DECL() yyerror(const char *s)
93 #define YYERROR_CALL(msg) yyerror(msg)
95 extern int YYPARSE_DECL();
98 #define kw_ABSTRACT_SYNTAX 258
100 #define kw_APPLICATION 260
101 #define kw_AUTOMATIC 261
104 #define kw_BMPString 264
105 #define kw_BOOLEAN 265
107 #define kw_CHARACTER 267
108 #define kw_CHOICE 268
110 #define kw_COMPONENT 270
111 #define kw_COMPONENTS 271
112 #define kw_CONSTRAINED 272
113 #define kw_CONTAINING 273
114 #define kw_DEFAULT 274
115 #define kw_DEFINITIONS 275
116 #define kw_EMBEDDED 276
117 #define kw_ENCODED 277
119 #define kw_ENUMERATED 279
120 #define kw_EXCEPT 280
121 #define kw_EXPLICIT 281
122 #define kw_EXPORTS 282
123 #define kw_EXTENSIBILITY 283
124 #define kw_EXTERNAL 284
127 #define kw_GeneralString 287
128 #define kw_GeneralizedTime 288
129 #define kw_GraphicString 289
130 #define kw_IA5String 290
131 #define kw_IDENTIFIER 291
132 #define kw_IMPLICIT 292
133 #define kw_IMPLIED 293
134 #define kw_IMPORTS 294
135 #define kw_INCLUDES 295
136 #define kw_INSTANCE 296
137 #define kw_INTEGER 297
138 #define kw_INTERSECTION 298
139 #define kw_ISO646String 299
142 #define kw_MINUS_INFINITY 302
144 #define kw_NumericString 304
145 #define kw_OBJECT 305
148 #define kw_OPTIONAL 308
149 #define kw_ObjectDescriptor 309
150 #define kw_PATTERN 310
152 #define kw_PLUS_INFINITY 312
153 #define kw_PRESENT 313
154 #define kw_PRIVATE 314
155 #define kw_PrintableString 315
157 #define kw_RELATIVE_OID 317
158 #define kw_SEQUENCE 318
161 #define kw_STRING 321
162 #define kw_SYNTAX 322
163 #define kw_T61String 323
166 #define kw_TYPE_IDENTIFIER 326
167 #define kw_TeletexString 327
169 #define kw_UNIQUE 329
170 #define kw_UNIVERSAL 330
171 #define kw_UTCTime 331
172 #define kw_UTF8String 332
173 #define kw_UniversalString 333
174 #define kw_VideotexString 334
175 #define kw_VisibleString 335
180 #define IDENTIFIER 340
181 #define referencename 341
184 #define YYERRCODE 256
185 static const short yylhs
[] = { -1,
186 0, 56, 56, 56, 56, 57, 57, 58, 58, 60,
187 60, 62, 62, 63, 63, 64, 59, 59, 59, 61,
188 61, 65, 65, 50, 50, 66, 14, 14, 14, 15,
189 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
190 15, 15, 15, 17, 48, 48, 48, 48, 21, 21,
191 21, 43, 43, 43, 38, 20, 41, 16, 16, 32,
192 23, 22, 49, 49, 24, 24, 25, 26, 26, 27,
193 18, 29, 29, 30, 31, 31, 19, 51, 52, 53,
194 53, 54, 54, 54, 55, 28, 35, 2, 2, 2,
195 2, 3, 3, 3, 67, 33, 34, 34, 34, 34,
196 34, 34, 34, 34, 40, 40, 40, 39, 36, 36,
197 36, 42, 42, 37, 47, 47, 44, 45, 45, 46,
198 46, 46, 4, 4, 5, 5, 5, 5, 5, 12,
199 11, 13, 9, 7, 7, 6, 1, 10, 8,
201 static const short yylen
[] = { 2,
202 9, 2, 2, 2, 0, 2, 0, 3, 0, 3,
203 0, 1, 0, 1, 2, 4, 3, 2, 0, 1,
204 2, 1, 1, 3, 1, 3, 1, 1, 1, 1,
205 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
206 1, 1, 1, 1, 5, 5, 5, 3, 1, 2,
207 4, 1, 3, 3, 4, 4, 1, 2, 5, 2,
208 3, 1, 0, 2, 4, 3, 4, 4, 3, 3,
209 4, 1, 1, 1, 1, 1, 2, 3, 1, 1,
210 1, 2, 3, 5, 4, 3, 4, 0, 1, 1,
211 1, 0, 1, 1, 4, 1, 1, 1, 1, 1,
212 1, 1, 1, 1, 1, 3, 3, 2, 1, 2,
213 3, 1, 3, 4, 1, 0, 3, 0, 2, 4,
214 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
215 1, 1, 1, 1, 1, 1, 1, 1, 1,
217 static const short yydefred
[] = { 0,
218 0, 0, 0, 115, 0, 0, 122, 0, 0, 0,
219 0, 117, 119, 0, 0, 0, 0, 0, 4, 2,
220 3, 0, 0, 120, 6, 0, 0, 0, 0, 0,
221 18, 0, 0, 1, 0, 0, 0, 17, 0, 0,
222 0, 14, 0, 8, 0, 22, 23, 24, 0, 10,
223 15, 0, 103, 44, 0, 0, 97, 75, 102, 0,
224 62, 0, 0, 100, 0, 0, 98, 76, 99, 104,
225 101, 0, 74, 0, 0, 27, 30, 31, 33, 29,
226 34, 35, 36, 38, 39, 40, 41, 42, 43, 28,
227 72, 73, 37, 32, 96, 0, 21, 0, 0, 0,
228 0, 0, 0, 50, 60, 0, 0, 0, 0, 0,
229 0, 0, 90, 91, 89, 0, 0, 0, 77, 93,
230 94, 0, 16, 0, 0, 105, 0, 0, 0, 52,
231 0, 0, 135, 0, 138, 134, 132, 133, 137, 136,
232 0, 123, 127, 125, 128, 126, 129, 130, 124, 131,
233 139, 0, 61, 64, 66, 0, 0, 0, 69, 0,
234 0, 95, 0, 0, 0, 0, 79, 80, 81, 0,
235 0, 112, 0, 0, 0, 110, 0, 71, 0, 56,
236 0, 0, 0, 48, 51, 65, 0, 68, 87, 0,
237 0, 0, 78, 0, 0, 59, 111, 107, 106, 0,
238 54, 53, 0, 0, 0, 0, 0, 83, 0, 113,
239 55, 47, 46, 45, 85, 0, 114, 84,
241 static const short yydgoto
[] = { 2,
242 140, 116, 122, 141, 142, 143, 144, 145, 146, 147,
243 148, 149, 150, 75, 76, 77, 78, 79, 80, 81,
244 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
245 92, 93, 94, 95, 96, 126, 172, 130, 127, 128,
246 131, 173, 132, 151, 8, 9, 5, 104, 109, 39,
247 119, 166, 167, 168, 169, 17, 23, 29, 30, 36,
248 44, 40, 41, 42, 45, 46, 47,
250 static const short yysindex
[] = { -295,
251 -74, 0, -289, 0, -216, 23, 0, -61, -289, -221,
252 -277, 0, 0, -259, -257, -256, -214, 31, 0, 0,
253 0, -220, -264, 0, 0, -187, -206, -232, -201, -213,
254 0, 34, 25, 0, -258, -251, -258, 0, -188, 40,
255 -258, 0, 63, 0, -251, 0, 0, 0, -239, 0,
256 0, -218, 0, 0, -19, -17, 0, 0, 0, -12,
257 0, -184, -212, 0, -106, -111, 0, 0, 0, 0,
258 0, 112, 0, -228, -37, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
260 0, 0, 0, 0, 0, -242, 0, -74, -10, -223,
261 -215, -116, -215, 0, 0, -198, 87, -105, -179, 112,
262 -100, 89, 0, 0, 0, -211, -4, -225, 0, 0,
263 0, 112, 0, -210, 112, 0, -238, -13, 91, 0,
264 9, 92, 0, -202, 0, 0, 0, 0, 0, 0,
265 -33, 0, 0, 0, 0, 0, 0, 0, 0, 0,
266 0, -11, 0, 0, 0, -9, 112, 89, 0, -7,
267 44, 0, -128, 112, -127, 99, 0, 0, 0, 89,
268 101, 0, -2, 89, -4, 0, -283, 0, -200, 0,
269 -278, -4, -8, 0, 0, 0, 89, 0, 0, 19,
270 -27, -4, 0, -199, -210, 0, 0, 0, 0, 104,
271 0, 0, 105, 106, 107, 24, -115, 0, 109, 0,
272 0, 0, 0, 0, 0, -4, 0, 0,
274 static const short yyrindex
[] = { 0,
275 -123, 0, 28, 0, 0, -110, 0, 0, 28, -245,
276 0, 0, 0, 0, 0, 0, -183, 0, 0, 0,
277 0, 0, 0, 0, 0, 0, -248, 0, 0, -182,
278 0, -41, 0, 0, 97, 0, 0, 0, 0, 0,
279 98, 0, 0, 0, -119, 0, 0, 0, 0, 0,
280 0, 0, 0, 0, 0, 0, 0, 0, 0, -30,
281 0, 0, 0, 0, -147, 0, 0, 0, 0, 0,
282 0, 0, 0, -181, 0, 0, 0, 0, 0, 0,
283 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
284 0, 0, 0, 0, 0, 169, 0, -49, -40, 0,
285 0, 0, 0, 0, 0, -35, 0, 0, 0, 0,
286 0, -244, 0, 0, 0, 0, 0, 0, 0, 0,
287 0, 0, 0, 0, 0, 0, -1, 0, 0, 0,
288 0, 36, 0, 0, 0, 0, 0, 0, 0, 0,
289 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
290 0, 0, 0, 0, 0, 0, 0, -25, 0, 0,
291 0, 0, 0, 0, 0, 0, 0, 0, 0, -20,
292 0, 0, 0, -42, 0, 0, 0, 0, 0, 0,
293 0, 0, 0, 0, 0, 0, -15, 0, 0, 0,
294 122, 0, 0, 0, 0, 0, 0, 0, 0, 0,
295 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
296 0, 0, 0, 0, 0, 0, 0, 0,
298 static const short yygindex
[] = { 0,
299 -14, 0, 0, -95, 0, 0, 0, 0, 0, 0,
300 0, 0, 0, -31, 0, 0, 0, 0, 0, 0,
301 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
302 0, 0, 0, 0, 0, -6, -29, -5, 0, -53,
303 0, 0, 61, 22, 158, 0, 70, 65, 64, 16,
304 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
305 128, 0, 0, 133, 0, 0, 0,
307 #define YYTABLESIZE 509
308 static const short yytable
[] = { 58,
309 58, 108, 118, 58, 63, 63, 3, 184, 63, 116,
310 49, 111, 118, 49, 121, 70, 108, 25, 70, 155,
311 86, 162, 4, 86, 159, 67, 31, 102, 67, 9,
312 177, 113, 181, 26, 177, 175, 177, 5, 120, 14,
313 112, 195, 109, 33, 1, 19, 163, 164, 3, 121,
314 6, 165, 48, 7, 156, 198, 125, 160, 10, 15,
315 201, 129, 11, 12, 19, 18, 20, 21, 22, 176,
316 16, 24, 25, 26, 27, 28, 34, 37, 158, 197,
317 35, 32, 108, 38, 58, 114, 203, 205, 43, 63,
318 170, 19, 5, 174, 49, 26, 208, 49, 50, 70,
319 98, 115, 99, 100, 86, 101, 105, 32, 106, 67,
320 103, 178, 124, 185, 3, 186, 125, 188, 3, 4,
321 218, 107, 196, 109, 129, 187, 102, 157, 118, 171,
322 179, 161, 191, 180, 182, 181, 189, 190, 192, 193,
323 194, 206, 139, 209, 211, 212, 213, 214, 215, 217,
324 216, 116, 118, 74, 7, 13, 12, 11, 20, 63,
325 57, 88, 82, 152, 200, 210, 13, 123, 133, 153,
326 199, 154, 97, 51, 0, 202, 0, 0, 0, 0,
327 0, 0, 0, 0, 134, 0, 135, 0, 0, 0,
328 0, 0, 0, 0, 0, 110, 0, 0, 0, 0,
329 0, 0, 74, 0, 0, 0, 0, 0, 136, 0,
330 0, 0, 0, 107, 0, 0, 0, 0, 0, 0,
331 0, 0, 0, 137, 0, 138, 139, 0, 0, 121,
332 0, 108, 121, 58, 125, 0, 58, 58, 63, 125,
333 0, 63, 63, 49, 25, 0, 49, 49, 70, 207,
334 0, 70, 70, 86, 0, 0, 86, 86, 67, 92,
335 0, 67, 67, 0, 0, 108, 0, 58, 0, 0,
336 0, 0, 63, 0, 0, 0, 133, 49, 0, 0,
337 133, 0, 70, 0, 0, 0, 0, 86, 0, 0,
338 116, 204, 67, 0, 135, 0, 0, 58, 135, 58,
339 117, 0, 63, 183, 63, 0, 0, 49, 0, 49,
340 0, 0, 70, 0, 70, 0, 136, 86, 0, 86,
341 136, 0, 67, 0, 67, 52, 53, 54, 0, 0,
342 55, 137, 0, 138, 139, 137, 0, 138, 139, 0,
343 0, 56, 0, 0, 0, 0, 0, 0, 0, 57,
344 58, 0, 59, 0, 0, 0, 0, 0, 0, 60,
345 0, 0, 0, 0, 0, 61, 0, 62, 63, 0,
346 0, 0, 0, 0, 52, 53, 54, 64, 0, 55,
347 65, 66, 0, 0, 0, 0, 0, 0, 0, 67,
348 56, 0, 0, 68, 69, 70, 0, 71, 57, 58,
349 72, 59, 73, 0, 0, 0, 0, 0, 60, 0,
350 0, 0, 0, 0, 61, 0, 62, 63, 0, 0,
351 0, 0, 0, 0, 0, 0, 64, 0, 0, 65,
352 66, 92, 92, 92, 0, 0, 92, 0, 67, 0,
353 0, 0, 68, 69, 70, 0, 71, 92, 0, 0,
354 0, 73, 0, 0, 0, 92, 92, 0, 92, 0,
355 0, 0, 0, 0, 0, 92, 0, 0, 0, 0,
356 0, 92, 0, 92, 92, 0, 0, 0, 0, 0,
357 0, 0, 0, 92, 0, 0, 92, 92, 0, 0,
358 0, 0, 0, 0, 0, 92, 0, 0, 0, 92,
359 92, 92, 0, 92, 0, 0, 0, 0, 92,
361 static const short yycheck
[] = { 40,
362 41, 44, 40, 44, 40, 41, 123, 41, 44, 59,
363 41, 123, 40, 44, 125, 41, 123, 59, 44, 125,
364 41, 117, 1, 44, 125, 41, 259, 40, 44, 278,
365 44, 260, 44, 278, 44, 274, 44, 283, 281, 261,
366 72, 44, 44, 28, 340, 294, 272, 273, 123, 292,
367 340, 277, 37, 343, 108, 339, 340, 111, 275, 281,
368 339, 340, 40, 125, 324, 343, 324, 324, 283, 308,
369 292, 41, 293, 338, 262, 282, 278, 44, 110, 175,
370 294, 340, 125, 59, 125, 314, 182, 183, 340, 125,
371 122, 340, 338, 125, 125, 340, 192, 286, 59, 125,
372 340, 330, 321, 123, 125, 123, 291, 340, 321, 125,
373 123, 125, 123, 125, 123, 125, 340, 125, 123, 98,
374 216, 320, 125, 125, 340, 157, 40, 307, 40, 340,
375 40, 343, 164, 125, 337, 44, 93, 266, 266, 41,
376 40, 123, 343, 343, 41, 41, 41, 41, 125, 41,
377 266, 275, 125, 91, 338, 59, 59, 340, 278, 307,
378 125, 343, 41, 103, 179, 195, 9, 98, 285, 106,
379 177, 107, 45, 41, -1, 181, -1, -1, -1, -1,
380 -1, -1, -1, -1, 301, -1, 303, -1, -1, -1,
381 -1, -1, -1, -1, -1, 307, -1, -1, -1, -1,
382 -1, -1, 91, -1, -1, -1, -1, -1, 325, -1,
383 -1, -1, -1, 320, -1, -1, -1, -1, -1, -1,
384 -1, -1, -1, 340, -1, 342, 343, -1, -1, 340,
385 -1, 274, 343, 274, 340, -1, 277, 278, 274, 340,
386 -1, 277, 278, 274, 286, -1, 277, 278, 274, 277,
387 -1, 277, 278, 274, -1, -1, 277, 278, 274, 91,
388 -1, 277, 278, -1, -1, 308, -1, 308, -1, -1,
389 -1, -1, 308, -1, -1, -1, 285, 308, -1, -1,
390 285, -1, 308, -1, -1, -1, -1, 308, -1, -1,
391 340, 300, 308, -1, 303, -1, -1, 338, 303, 340,
392 338, -1, 338, 337, 340, -1, -1, 338, -1, 340,
393 -1, -1, 338, -1, 340, -1, 325, 338, -1, 340,
394 325, -1, 338, -1, 340, 263, 264, 265, -1, -1,
395 268, 340, -1, 342, 343, 340, -1, 342, 343, -1,
396 -1, 279, -1, -1, -1, -1, -1, -1, -1, 287,
397 288, -1, 290, -1, -1, -1, -1, -1, -1, 297,
398 -1, -1, -1, -1, -1, 303, -1, 305, 306, -1,
399 -1, -1, -1, -1, 263, 264, 265, 315, -1, 268,
400 318, 319, -1, -1, -1, -1, -1, -1, -1, 327,
401 279, -1, -1, 331, 332, 333, -1, 335, 287, 288,
402 338, 290, 340, -1, -1, -1, -1, -1, 297, -1,
403 -1, -1, -1, -1, 303, -1, 305, 306, -1, -1,
404 -1, -1, -1, -1, -1, -1, 315, -1, -1, 318,
405 319, 263, 264, 265, -1, -1, 268, -1, 327, -1,
406 -1, -1, 331, 332, 333, -1, 335, 279, -1, -1,
407 -1, 340, -1, -1, -1, 287, 288, -1, 290, -1,
408 -1, -1, -1, -1, -1, 297, -1, -1, -1, -1,
409 -1, 303, -1, 305, 306, -1, -1, -1, -1, -1,
410 -1, -1, -1, 315, -1, -1, 318, 319, -1, -1,
411 -1, -1, -1, -1, -1, 327, -1, -1, -1, 331,
412 332, 333, -1, 335, -1, -1, -1, -1, 340,
418 #define YYMAXTOKEN 343
420 static const char *yyname
[] = {
422 "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,
423 0,0,0,0,0,0,"'('","')'",0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,0,0,0,0,0,
424 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,
425 0,0,0,0,0,0,0,0,0,0,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,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,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,0,0,0,0,0,
429 "kw_ABSENT","kw_ABSTRACT_SYNTAX","kw_ALL","kw_APPLICATION","kw_AUTOMATIC",
430 "kw_BEGIN","kw_BIT","kw_BMPString","kw_BOOLEAN","kw_BY","kw_CHARACTER",
431 "kw_CHOICE","kw_CLASS","kw_COMPONENT","kw_COMPONENTS","kw_CONSTRAINED",
432 "kw_CONTAINING","kw_DEFAULT","kw_DEFINITIONS","kw_EMBEDDED","kw_ENCODED",
433 "kw_END","kw_ENUMERATED","kw_EXCEPT","kw_EXPLICIT","kw_EXPORTS",
434 "kw_EXTENSIBILITY","kw_EXTERNAL","kw_FALSE","kw_FROM","kw_GeneralString",
435 "kw_GeneralizedTime","kw_GraphicString","kw_IA5String","kw_IDENTIFIER",
436 "kw_IMPLICIT","kw_IMPLIED","kw_IMPORTS","kw_INCLUDES","kw_INSTANCE",
437 "kw_INTEGER","kw_INTERSECTION","kw_ISO646String","kw_MAX","kw_MIN",
438 "kw_MINUS_INFINITY","kw_NULL","kw_NumericString","kw_OBJECT","kw_OCTET","kw_OF",
439 "kw_OPTIONAL","kw_ObjectDescriptor","kw_PATTERN","kw_PDV","kw_PLUS_INFINITY",
440 "kw_PRESENT","kw_PRIVATE","kw_PrintableString","kw_REAL","kw_RELATIVE_OID",
441 "kw_SEQUENCE","kw_SET","kw_SIZE","kw_STRING","kw_SYNTAX","kw_T61String",
442 "kw_TAGS","kw_TRUE","kw_TYPE_IDENTIFIER","kw_TeletexString","kw_UNION",
443 "kw_UNIQUE","kw_UNIVERSAL","kw_UTCTime","kw_UTF8String","kw_UniversalString",
444 "kw_VideotexString","kw_VisibleString","kw_WITH","RANGE","EEQUAL","ELLIPSIS",
445 "IDENTIFIER","referencename","STRING","NUMBER",
447 static const char *yyrule
[] = {
448 "$accept : ModuleDefinition",
449 "ModuleDefinition : IDENTIFIER objid_opt kw_DEFINITIONS TagDefault ExtensionDefault EEQUAL kw_BEGIN ModuleBody kw_END",
450 "TagDefault : kw_EXPLICIT kw_TAGS",
451 "TagDefault : kw_IMPLICIT kw_TAGS",
452 "TagDefault : kw_AUTOMATIC kw_TAGS",
454 "ExtensionDefault : kw_EXTENSIBILITY kw_IMPLIED",
455 "ExtensionDefault :",
456 "ModuleBody : Exports Imports AssignmentList",
458 "Imports : kw_IMPORTS SymbolsImported ';'",
460 "SymbolsImported : SymbolsFromModuleList",
462 "SymbolsFromModuleList : SymbolsFromModule",
463 "SymbolsFromModuleList : SymbolsFromModuleList SymbolsFromModule",
464 "SymbolsFromModule : referencenames kw_FROM IDENTIFIER objid_opt",
465 "Exports : kw_EXPORTS referencenames ';'",
466 "Exports : kw_EXPORTS kw_ALL",
468 "AssignmentList : Assignment",
469 "AssignmentList : Assignment AssignmentList",
470 "Assignment : TypeAssignment",
471 "Assignment : ValueAssignment",
472 "referencenames : IDENTIFIER ',' referencenames",
473 "referencenames : IDENTIFIER",
474 "TypeAssignment : IDENTIFIER EEQUAL Type",
475 "Type : BuiltinType",
476 "Type : ReferencedType",
477 "Type : ConstrainedType",
478 "BuiltinType : BitStringType",
479 "BuiltinType : BooleanType",
480 "BuiltinType : CharacterStringType",
481 "BuiltinType : ChoiceType",
482 "BuiltinType : EnumeratedType",
483 "BuiltinType : IntegerType",
484 "BuiltinType : NullType",
485 "BuiltinType : ObjectIdentifierType",
486 "BuiltinType : OctetStringType",
487 "BuiltinType : SequenceType",
488 "BuiltinType : SequenceOfType",
489 "BuiltinType : SetType",
490 "BuiltinType : SetOfType",
491 "BuiltinType : TaggedType",
492 "BooleanType : kw_BOOLEAN",
493 "range : '(' Value RANGE Value ')'",
494 "range : '(' Value RANGE kw_MAX ')'",
495 "range : '(' kw_MIN RANGE Value ')'",
496 "range : '(' Value ')'",
497 "IntegerType : kw_INTEGER",
498 "IntegerType : kw_INTEGER range",
499 "IntegerType : kw_INTEGER '{' NamedNumberList '}'",
500 "NamedNumberList : NamedNumber",
501 "NamedNumberList : NamedNumberList ',' NamedNumber",
502 "NamedNumberList : NamedNumberList ',' ELLIPSIS",
503 "NamedNumber : IDENTIFIER '(' SignedNumber ')'",
504 "EnumeratedType : kw_ENUMERATED '{' Enumerations '}'",
505 "Enumerations : NamedNumberList",
506 "BitStringType : kw_BIT kw_STRING",
507 "BitStringType : kw_BIT kw_STRING '{' NamedBitList '}'",
508 "ObjectIdentifierType : kw_OBJECT kw_IDENTIFIER",
509 "OctetStringType : kw_OCTET kw_STRING size",
510 "NullType : kw_NULL",
512 "size : kw_SIZE range",
513 "SequenceType : kw_SEQUENCE '{' ComponentTypeList '}'",
514 "SequenceType : kw_SEQUENCE '{' '}'",
515 "SequenceOfType : kw_SEQUENCE size kw_OF Type",
516 "SetType : kw_SET '{' ComponentTypeList '}'",
517 "SetType : kw_SET '{' '}'",
518 "SetOfType : kw_SET kw_OF Type",
519 "ChoiceType : kw_CHOICE '{' ComponentTypeList '}'",
520 "ReferencedType : DefinedType",
521 "ReferencedType : UsefulType",
522 "DefinedType : IDENTIFIER",
523 "UsefulType : kw_GeneralizedTime",
524 "UsefulType : kw_UTCTime",
525 "ConstrainedType : Type Constraint",
526 "Constraint : '(' ConstraintSpec ')'",
527 "ConstraintSpec : GeneralConstraint",
528 "GeneralConstraint : ContentsConstraint",
529 "GeneralConstraint : UserDefinedConstraint",
530 "ContentsConstraint : kw_CONTAINING Type",
531 "ContentsConstraint : kw_ENCODED kw_BY Value",
532 "ContentsConstraint : kw_CONTAINING Type kw_ENCODED kw_BY Value",
533 "UserDefinedConstraint : kw_CONSTRAINED kw_BY '{' '}'",
534 "TaggedType : Tag tagenv Type",
535 "Tag : '[' Class NUMBER ']'",
537 "Class : kw_UNIVERSAL",
538 "Class : kw_APPLICATION",
539 "Class : kw_PRIVATE",
541 "tagenv : kw_EXPLICIT",
542 "tagenv : kw_IMPLICIT",
543 "ValueAssignment : IDENTIFIER Type EEQUAL Value",
544 "CharacterStringType : RestrictedCharactedStringType",
545 "RestrictedCharactedStringType : kw_GeneralString",
546 "RestrictedCharactedStringType : kw_TeletexString",
547 "RestrictedCharactedStringType : kw_UTF8String",
548 "RestrictedCharactedStringType : kw_PrintableString",
549 "RestrictedCharactedStringType : kw_VisibleString",
550 "RestrictedCharactedStringType : kw_IA5String",
551 "RestrictedCharactedStringType : kw_BMPString",
552 "RestrictedCharactedStringType : kw_UniversalString",
553 "ComponentTypeList : ComponentType",
554 "ComponentTypeList : ComponentTypeList ',' ComponentType",
555 "ComponentTypeList : ComponentTypeList ',' ELLIPSIS",
556 "NamedType : IDENTIFIER Type",
557 "ComponentType : NamedType",
558 "ComponentType : NamedType kw_OPTIONAL",
559 "ComponentType : NamedType kw_DEFAULT Value",
560 "NamedBitList : NamedBit",
561 "NamedBitList : NamedBitList ',' NamedBit",
562 "NamedBit : IDENTIFIER '(' NUMBER ')'",
565 "objid : '{' objid_list '}'",
567 "objid_list : objid_element objid_list",
568 "objid_element : IDENTIFIER '(' NUMBER ')'",
569 "objid_element : IDENTIFIER",
570 "objid_element : NUMBER",
571 "Value : BuiltinValue",
572 "Value : ReferencedValue",
573 "BuiltinValue : BooleanValue",
574 "BuiltinValue : CharacterStringValue",
575 "BuiltinValue : IntegerValue",
576 "BuiltinValue : ObjectIdentifierValue",
577 "BuiltinValue : NullValue",
578 "ReferencedValue : DefinedValue",
579 "DefinedValue : Valuereference",
580 "Valuereference : IDENTIFIER",
581 "CharacterStringValue : STRING",
582 "BooleanValue : kw_TRUE",
583 "BooleanValue : kw_FALSE",
584 "IntegerValue : SignedNumber",
585 "SignedNumber : NUMBER",
586 "NullValue : kw_NULL",
587 "ObjectIdentifierValue : objid",
591 /* define the initial stack-sizes */
594 #define YYMAXDEPTH YYSTACKSIZE
597 #define YYSTACKSIZE YYMAXDEPTH
599 #define YYSTACKSIZE 500
600 #define YYMAXDEPTH 500
604 #define YYINITSTACKSIZE 500
622 /* variables for the parser stack */
623 static YYSTACKDATA yystack
;
626 yyerror (const char *s
)
628 lex_error_message ("%s\n", s
);
632 new_tag(int tagclass
, int tagvalue
, int tagenv
, Type
*oldtype
)
635 if(oldtype
->type
== TTag
&& oldtype
->tag
.tagenv
== TE_IMPLICIT
) {
637 oldtype
= oldtype
->subtype
; /* XXX */
641 t
->tag
.tagclass
= tagclass
;
642 t
->tag
.tagvalue
= tagvalue
;
643 t
->tag
.tagenv
= tagenv
;
644 t
->subtype
= oldtype
;
648 static struct objid
*
649 new_objid(const char *label
, int value
)
652 s
= emalloc(sizeof(*s
));
660 add_oid_to_tail(struct objid
*head
, struct objid
*tail
)
670 new_type (Typetype tt
)
672 Type
*t
= ecalloc(1, sizeof(*t
));
677 static struct constraint_spec
*
678 new_constraint_spec(enum ctype ct
)
680 struct constraint_spec
*c
= ecalloc(1, sizeof(*c
));
685 static void fix_labels2(Type
*t
, const char *prefix
);
686 static void fix_labels1(struct memhead
*members
, const char *prefix
)
692 ASN1_TAILQ_FOREACH(m
, members
, members
) {
693 if (asprintf(&m
->label
, "%s_%s", prefix
, m
->gen_name
) < 0)
695 if (m
->label
== NULL
)
698 fix_labels2(m
->type
, m
->label
);
702 static void fix_labels2(Type
*t
, const char *prefix
)
704 for(; t
; t
= t
->subtype
)
705 fix_labels1(t
->members
, prefix
);
709 fix_labels(Symbol
*s
)
712 if (asprintf(&p
, "choice_%s", s
->gen_name
) < 0 || p
== NULL
)
714 fix_labels2(s
->type
, p
);
719 #include <stdio.h> /* needed for printf */
722 #include <stdlib.h> /* needed for malloc, etc */
723 #include <string.h> /* needed for memset */
725 /* allocate initial stack or double stack size, up to YYMAXDEPTH */
726 static int yygrowstack(YYSTACKDATA
*data
)
733 if ((newsize
= data
->stacksize
) == 0)
734 newsize
= YYINITSTACKSIZE
;
735 else if (newsize
>= YYMAXDEPTH
)
737 else if ((newsize
*= 2) > YYMAXDEPTH
)
738 newsize
= YYMAXDEPTH
;
740 i
= data
->s_mark
- data
->s_base
;
741 newss
= (short *)realloc(data
->s_base
, newsize
* sizeof(*newss
));
745 data
->s_base
= newss
;
746 data
->s_mark
= newss
+ i
;
748 newvs
= (YYSTYPE
*)realloc(data
->l_base
, newsize
* sizeof(*newvs
));
752 data
->l_base
= newvs
;
753 data
->l_mark
= newvs
+ i
;
755 data
->stacksize
= newsize
;
756 data
->s_last
= data
->s_base
+ newsize
- 1;
760 #if YYPURE || defined(YY_NO_LEAKS)
761 static void yyfreestack(YYSTACKDATA
*data
)
765 memset(data
, 0, sizeof(*data
));
768 #define yyfreestack(data) /* nothing */
771 #define YYABORT goto yyabort
772 #define YYREJECT goto yyabort
773 #define YYACCEPT goto yyaccept
774 #define YYERROR goto yyerrlab
779 int yym
, yyn
, yystate
;
783 if ((yys
= getenv("YYDEBUG")) != 0)
786 if (yyn
>= '0' && yyn
<= '9')
797 memset(&yystack
, 0, sizeof(yystack
));
800 if (yystack
.s_base
== NULL
&& yygrowstack(&yystack
)) goto yyoverflow
;
801 yystack
.s_mark
= yystack
.s_base
;
802 yystack
.l_mark
= yystack
.l_base
;
807 if ((yyn
= yydefred
[yystate
]) != 0) goto yyreduce
;
810 if ((yychar
= YYLEX
) < 0) yychar
= 0;
815 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
816 if (!yys
) yys
= "illegal-symbol";
817 printf("%sdebug: state %d, reading %d (%s)\n",
818 YYPREFIX
, yystate
, yychar
, yys
);
822 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
823 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
827 printf("%sdebug: state %d, shifting to state %d\n",
828 YYPREFIX
, yystate
, yytable
[yyn
]);
830 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
834 yystate
= yytable
[yyn
];
835 *++yystack
.s_mark
= yytable
[yyn
];
836 *++yystack
.l_mark
= yylval
;
838 if (yyerrflag
> 0) --yyerrflag
;
841 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
842 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
847 if (yyerrflag
) goto yyinrecovery
;
849 yyerror("syntax error");
862 if ((yyn
= yysindex
[*yystack
.s_mark
]) && (yyn
+= YYERRCODE
) >= 0 &&
863 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
867 printf("%sdebug: state %d, error recovery shifting\
868 to state %d\n", YYPREFIX
, *yystack
.s_mark
, yytable
[yyn
]);
870 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
874 yystate
= yytable
[yyn
];
875 *++yystack
.s_mark
= yytable
[yyn
];
876 *++yystack
.l_mark
= yylval
;
883 printf("%sdebug: error recovery discarding state %d\n",
884 YYPREFIX
, *yystack
.s_mark
);
886 if (yystack
.s_mark
<= yystack
.s_base
) goto yyabort
;
894 if (yychar
== 0) goto yyabort
;
899 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
900 if (!yys
) yys
= "illegal-symbol";
901 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
902 YYPREFIX
, yystate
, yychar
, yys
);
912 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
913 YYPREFIX
, yystate
, yyn
, yyrule
[yyn
]);
917 yyval
= yystack
.l_mark
[1-yym
];
919 memset(&yyval
, 0, sizeof yyval
);
928 { lex_error_message("implicit tagging is not supported"); }
931 { lex_error_message("automatic tagging is not supported"); }
934 { lex_error_message("no extensibility options supported"); }
938 struct string_list
*sl
;
939 for(sl
= yystack
.l_mark
[-3].sl
; sl
!= NULL
; sl
= sl
->next
) {
940 Symbol
*s
= addsym(sl
->string
);
942 gen_template_import(s
);
944 add_import(yystack
.l_mark
[-1].name
);
949 struct string_list
*sl
;
950 for(sl
= yystack
.l_mark
[-1].sl
; sl
!= NULL
; sl
= sl
->next
)
951 add_export(sl
->string
);
956 yyval
.sl
= emalloc(sizeof(*yyval
.sl
));
957 yyval
.sl
->string
= yystack
.l_mark
[-2].name
;
958 yyval
.sl
->next
= yystack
.l_mark
[0].sl
;
963 yyval
.sl
= emalloc(sizeof(*yyval
.sl
));
964 yyval
.sl
->string
= yystack
.l_mark
[0].name
;
965 yyval
.sl
->next
= NULL
;
970 Symbol
*s
= addsym (yystack
.l_mark
[-2].name
);
972 s
->type
= yystack
.l_mark
[0].type
;
979 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Boolean
,
980 TE_EXPLICIT
, new_type(TBoolean
));
985 if(yystack
.l_mark
[-3].value
->type
!= integervalue
)
986 lex_error_message("Non-integer used in first part of range");
987 if(yystack
.l_mark
[-3].value
->type
!= integervalue
)
988 lex_error_message("Non-integer in second part of range");
989 yyval
.range
= ecalloc(1, sizeof(*yyval
.range
));
990 yyval
.range
->min
= yystack
.l_mark
[-3].value
->u
.integervalue
;
991 yyval
.range
->max
= yystack
.l_mark
[-1].value
->u
.integervalue
;
996 if(yystack
.l_mark
[-3].value
->type
!= integervalue
)
997 lex_error_message("Non-integer in first part of range");
998 yyval
.range
= ecalloc(1, sizeof(*yyval
.range
));
999 yyval
.range
->min
= yystack
.l_mark
[-3].value
->u
.integervalue
;
1000 yyval
.range
->max
= yystack
.l_mark
[-3].value
->u
.integervalue
- 1;
1005 if(yystack
.l_mark
[-1].value
->type
!= integervalue
)
1006 lex_error_message("Non-integer in second part of range");
1007 yyval
.range
= ecalloc(1, sizeof(*yyval
.range
));
1008 yyval
.range
->min
= yystack
.l_mark
[-1].value
->u
.integervalue
+ 2;
1009 yyval
.range
->max
= yystack
.l_mark
[-1].value
->u
.integervalue
;
1014 if(yystack
.l_mark
[-1].value
->type
!= integervalue
)
1015 lex_error_message("Non-integer used in limit");
1016 yyval
.range
= ecalloc(1, sizeof(*yyval
.range
));
1017 yyval
.range
->min
= yystack
.l_mark
[-1].value
->u
.integervalue
;
1018 yyval
.range
->max
= yystack
.l_mark
[-1].value
->u
.integervalue
;
1023 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Integer
,
1024 TE_EXPLICIT
, new_type(TInteger
));
1029 yyval
.type
= new_type(TInteger
);
1030 yyval
.type
->range
= yystack
.l_mark
[0].range
;
1031 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Integer
, TE_EXPLICIT
, yyval
.type
);
1036 yyval
.type
= new_type(TInteger
);
1037 yyval
.type
->members
= yystack
.l_mark
[-1].members
;
1038 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Integer
, TE_EXPLICIT
, yyval
.type
);
1043 yyval
.members
= emalloc(sizeof(*yyval
.members
));
1044 ASN1_TAILQ_INIT(yyval
.members
);
1045 ASN1_TAILQ_INSERT_HEAD(yyval
.members
, yystack
.l_mark
[0].member
, members
);
1050 ASN1_TAILQ_INSERT_TAIL(yystack
.l_mark
[-2].members
, yystack
.l_mark
[0].member
, members
);
1051 yyval
.members
= yystack
.l_mark
[-2].members
;
1055 { yyval
.members
= yystack
.l_mark
[-2].members
; }
1059 yyval
.member
= emalloc(sizeof(*yyval
.member
));
1060 yyval
.member
->name
= yystack
.l_mark
[-3].name
;
1061 yyval
.member
->gen_name
= estrdup(yystack
.l_mark
[-3].name
);
1062 output_name (yyval
.member
->gen_name
);
1063 yyval
.member
->val
= yystack
.l_mark
[-1].constant
;
1064 yyval
.member
->optional
= 0;
1065 yyval
.member
->ellipsis
= 0;
1066 yyval
.member
->type
= NULL
;
1071 yyval
.type
= new_type(TInteger
);
1072 yyval
.type
->members
= yystack
.l_mark
[-1].members
;
1073 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Enumerated
, TE_EXPLICIT
, yyval
.type
);
1078 yyval
.type
= new_type(TBitString
);
1079 yyval
.type
->members
= emalloc(sizeof(*yyval
.type
->members
));
1080 ASN1_TAILQ_INIT(yyval
.type
->members
);
1081 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_BitString
, TE_EXPLICIT
, yyval
.type
);
1086 yyval
.type
= new_type(TBitString
);
1087 yyval
.type
->members
= yystack
.l_mark
[-1].members
;
1088 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_BitString
, TE_EXPLICIT
, yyval
.type
);
1093 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_OID
,
1094 TE_EXPLICIT
, new_type(TOID
));
1099 Type
*t
= new_type(TOctetString
);
1100 t
->range
= yystack
.l_mark
[0].range
;
1101 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_OctetString
,
1107 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Null
,
1108 TE_EXPLICIT
, new_type(TNull
));
1112 { yyval
.range
= NULL
; }
1115 { yyval
.range
= yystack
.l_mark
[0].range
; }
1119 yyval
.type
= new_type(TSequence
);
1120 yyval
.type
->members
= yystack
.l_mark
[-1].members
;
1121 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Sequence
, TE_EXPLICIT
, yyval
.type
);
1126 yyval
.type
= new_type(TSequence
);
1127 yyval
.type
->members
= NULL
;
1128 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Sequence
, TE_EXPLICIT
, yyval
.type
);
1133 yyval
.type
= new_type(TSequenceOf
);
1134 yyval
.type
->range
= yystack
.l_mark
[-2].range
;
1135 yyval
.type
->subtype
= yystack
.l_mark
[0].type
;
1136 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Sequence
, TE_EXPLICIT
, yyval
.type
);
1141 yyval
.type
= new_type(TSet
);
1142 yyval
.type
->members
= yystack
.l_mark
[-1].members
;
1143 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Set
, TE_EXPLICIT
, yyval
.type
);
1148 yyval
.type
= new_type(TSet
);
1149 yyval
.type
->members
= NULL
;
1150 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Set
, TE_EXPLICIT
, yyval
.type
);
1155 yyval
.type
= new_type(TSetOf
);
1156 yyval
.type
->subtype
= yystack
.l_mark
[0].type
;
1157 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_Set
, TE_EXPLICIT
, yyval
.type
);
1162 yyval
.type
= new_type(TChoice
);
1163 yyval
.type
->members
= yystack
.l_mark
[-1].members
;
1168 Symbol
*s
= addsym(yystack
.l_mark
[0].name
);
1169 yyval
.type
= new_type(TType
);
1170 if(s
->stype
!= Stype
&& s
->stype
!= SUndefined
)
1171 lex_error_message ("%s is not a type\n", yystack
.l_mark
[0].name
);
1173 yyval
.type
->symbol
= s
;
1178 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_GeneralizedTime
,
1179 TE_EXPLICIT
, new_type(TGeneralizedTime
));
1184 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_UTCTime
,
1185 TE_EXPLICIT
, new_type(TUTCTime
));
1190 /* if (Constraint.type == contentConstrant) {
1191 assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too
1192 if (Constraint.u.constraint.type) {
1193 assert((Constraint.u.constraint.type.length % 8) == 0);
1196 if (Constraint.u.constraint.encoding) {
1197 type == der-oid|ber-oid
1204 yyval
.constraint_spec
= yystack
.l_mark
[-1].constraint_spec
;
1209 yyval
.constraint_spec
= new_constraint_spec(CT_CONTENTS
);
1210 yyval
.constraint_spec
->u
.content
.type
= yystack
.l_mark
[0].type
;
1211 yyval
.constraint_spec
->u
.content
.encoding
= NULL
;
1216 if (yystack
.l_mark
[0].value
->type
!= objectidentifiervalue
)
1217 lex_error_message("Non-OID used in ENCODED BY constraint");
1218 yyval
.constraint_spec
= new_constraint_spec(CT_CONTENTS
);
1219 yyval
.constraint_spec
->u
.content
.type
= NULL
;
1220 yyval
.constraint_spec
->u
.content
.encoding
= yystack
.l_mark
[0].value
;
1225 if (yystack
.l_mark
[0].value
->type
!= objectidentifiervalue
)
1226 lex_error_message("Non-OID used in ENCODED BY constraint");
1227 yyval
.constraint_spec
= new_constraint_spec(CT_CONTENTS
);
1228 yyval
.constraint_spec
->u
.content
.type
= yystack
.l_mark
[-3].type
;
1229 yyval
.constraint_spec
->u
.content
.encoding
= yystack
.l_mark
[0].value
;
1234 yyval
.constraint_spec
= new_constraint_spec(CT_USER
);
1239 yyval
.type
= new_type(TTag
);
1240 yyval
.type
->tag
= yystack
.l_mark
[-2].tag
;
1241 yyval
.type
->tag
.tagenv
= yystack
.l_mark
[-1].constant
;
1242 if(yystack
.l_mark
[0].type
->type
== TTag
&& yystack
.l_mark
[-1].constant
== TE_IMPLICIT
) {
1243 yyval
.type
->subtype
= yystack
.l_mark
[0].type
->subtype
;
1244 free(yystack
.l_mark
[0].type
);
1246 yyval
.type
->subtype
= yystack
.l_mark
[0].type
;
1251 yyval
.tag
.tagclass
= yystack
.l_mark
[-2].constant
;
1252 yyval
.tag
.tagvalue
= yystack
.l_mark
[-1].constant
;
1253 yyval
.tag
.tagenv
= TE_EXPLICIT
;
1258 yyval
.constant
= ASN1_C_CONTEXT
;
1263 yyval
.constant
= ASN1_C_UNIV
;
1268 yyval
.constant
= ASN1_C_APPL
;
1273 yyval
.constant
= ASN1_C_PRIVATE
;
1278 yyval
.constant
= TE_EXPLICIT
;
1283 yyval
.constant
= TE_EXPLICIT
;
1288 yyval
.constant
= TE_IMPLICIT
;
1294 s
= addsym (yystack
.l_mark
[-3].name
);
1297 s
->value
= yystack
.l_mark
[0].value
;
1298 generate_constant (s
);
1303 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_GeneralString
,
1304 TE_EXPLICIT
, new_type(TGeneralString
));
1309 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_TeletexString
,
1310 TE_EXPLICIT
, new_type(TTeletexString
));
1315 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_UTF8String
,
1316 TE_EXPLICIT
, new_type(TUTF8String
));
1321 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_PrintableString
,
1322 TE_EXPLICIT
, new_type(TPrintableString
));
1327 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_VisibleString
,
1328 TE_EXPLICIT
, new_type(TVisibleString
));
1333 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_IA5String
,
1334 TE_EXPLICIT
, new_type(TIA5String
));
1339 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_BMPString
,
1340 TE_EXPLICIT
, new_type(TBMPString
));
1345 yyval
.type
= new_tag(ASN1_C_UNIV
, UT_UniversalString
,
1346 TE_EXPLICIT
, new_type(TUniversalString
));
1351 yyval
.members
= emalloc(sizeof(*yyval
.members
));
1352 ASN1_TAILQ_INIT(yyval
.members
);
1353 ASN1_TAILQ_INSERT_HEAD(yyval
.members
, yystack
.l_mark
[0].member
, members
);
1358 ASN1_TAILQ_INSERT_TAIL(yystack
.l_mark
[-2].members
, yystack
.l_mark
[0].member
, members
);
1359 yyval
.members
= yystack
.l_mark
[-2].members
;
1364 struct member
*m
= ecalloc(1, sizeof(*m
));
1365 m
->name
= estrdup("...");
1366 m
->gen_name
= estrdup("asn1_ellipsis");
1368 ASN1_TAILQ_INSERT_TAIL(yystack
.l_mark
[-2].members
, m
, members
);
1369 yyval
.members
= yystack
.l_mark
[-2].members
;
1374 yyval
.member
= emalloc(sizeof(*yyval
.member
));
1375 yyval
.member
->name
= yystack
.l_mark
[-1].name
;
1376 yyval
.member
->gen_name
= estrdup(yystack
.l_mark
[-1].name
);
1377 output_name (yyval
.member
->gen_name
);
1378 yyval
.member
->type
= yystack
.l_mark
[0].type
;
1379 yyval
.member
->ellipsis
= 0;
1384 yyval
.member
= yystack
.l_mark
[0].member
;
1385 yyval
.member
->optional
= 0;
1386 yyval
.member
->defval
= NULL
;
1391 yyval
.member
= yystack
.l_mark
[-1].member
;
1392 yyval
.member
->optional
= 1;
1393 yyval
.member
->defval
= NULL
;
1398 yyval
.member
= yystack
.l_mark
[-2].member
;
1399 yyval
.member
->optional
= 0;
1400 yyval
.member
->defval
= yystack
.l_mark
[0].value
;
1405 yyval
.members
= emalloc(sizeof(*yyval
.members
));
1406 ASN1_TAILQ_INIT(yyval
.members
);
1407 ASN1_TAILQ_INSERT_HEAD(yyval
.members
, yystack
.l_mark
[0].member
, members
);
1412 ASN1_TAILQ_INSERT_TAIL(yystack
.l_mark
[-2].members
, yystack
.l_mark
[0].member
, members
);
1413 yyval
.members
= yystack
.l_mark
[-2].members
;
1418 yyval
.member
= emalloc(sizeof(*yyval
.member
));
1419 yyval
.member
->name
= yystack
.l_mark
[-3].name
;
1420 yyval
.member
->gen_name
= estrdup(yystack
.l_mark
[-3].name
);
1421 output_name (yyval
.member
->gen_name
);
1422 yyval
.member
->val
= yystack
.l_mark
[-1].constant
;
1423 yyval
.member
->optional
= 0;
1424 yyval
.member
->ellipsis
= 0;
1425 yyval
.member
->type
= NULL
;
1429 { yyval
.objid
= NULL
; }
1433 yyval
.objid
= yystack
.l_mark
[-1].objid
;
1443 if (yystack
.l_mark
[0].objid
) {
1444 yyval
.objid
= yystack
.l_mark
[0].objid
;
1445 add_oid_to_tail(yystack
.l_mark
[0].objid
, yystack
.l_mark
[-1].objid
);
1447 yyval
.objid
= yystack
.l_mark
[-1].objid
;
1453 yyval
.objid
= new_objid(yystack
.l_mark
[-3].name
, yystack
.l_mark
[-1].constant
);
1458 Symbol
*s
= addsym(yystack
.l_mark
[0].name
);
1459 if(s
->stype
!= SValue
||
1460 s
->value
->type
!= objectidentifiervalue
) {
1461 lex_error_message("%s is not an object identifier\n",
1465 yyval
.objid
= s
->value
->u
.objectidentifiervalue
;
1470 yyval
.objid
= new_objid(NULL
, yystack
.l_mark
[0].constant
);
1475 Symbol
*s
= addsym(yystack
.l_mark
[0].name
);
1476 if(s
->stype
!= SValue
)
1477 lex_error_message ("%s is not a value\n",
1480 yyval
.value
= s
->value
;
1485 yyval
.value
= emalloc(sizeof(*yyval
.value
));
1486 yyval
.value
->type
= stringvalue
;
1487 yyval
.value
->u
.stringvalue
= yystack
.l_mark
[0].name
;
1492 yyval
.value
= emalloc(sizeof(*yyval
.value
));
1493 yyval
.value
->type
= booleanvalue
;
1494 yyval
.value
->u
.booleanvalue
= 0;
1499 yyval
.value
= emalloc(sizeof(*yyval
.value
));
1500 yyval
.value
->type
= booleanvalue
;
1501 yyval
.value
->u
.booleanvalue
= 0;
1506 yyval
.value
= emalloc(sizeof(*yyval
.value
));
1507 yyval
.value
->type
= integervalue
;
1508 yyval
.value
->u
.integervalue
= yystack
.l_mark
[0].constant
;
1517 yyval
.value
= emalloc(sizeof(*yyval
.value
));
1518 yyval
.value
->type
= objectidentifiervalue
;
1519 yyval
.value
->u
.objectidentifiervalue
= yystack
.l_mark
[0].objid
;
1523 yystack
.s_mark
-= yym
;
1524 yystate
= *yystack
.s_mark
;
1525 yystack
.l_mark
-= yym
;
1527 if (yystate
== 0 && yym
== 0)
1531 printf("%sdebug: after reduction, shifting from state 0 to\
1532 state %d\n", YYPREFIX
, YYFINAL
);
1535 *++yystack
.s_mark
= YYFINAL
;
1536 *++yystack
.l_mark
= yyval
;
1539 if ((yychar
= YYLEX
) < 0) yychar
= 0;
1544 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
1545 if (!yys
) yys
= "illegal-symbol";
1546 printf("%sdebug: state %d, reading %d (%s)\n",
1547 YYPREFIX
, YYFINAL
, yychar
, yys
);
1551 if (yychar
== 0) goto yyaccept
;
1554 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
1555 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
1556 yystate
= yytable
[yyn
];
1558 yystate
= yydgoto
[yym
];
1561 printf("%sdebug: after reduction, shifting from state %d \
1562 to state %d\n", YYPREFIX
, *yystack
.s_mark
, yystate
);
1564 if (yystack
.s_mark
>= yystack
.s_last
&& yygrowstack(&yystack
))
1568 *++yystack
.s_mark
= (short) yystate
;
1569 *++yystack
.l_mark
= yyval
;
1573 yyerror("yacc stack overflow");
1576 yyfreestack(&yystack
);
1580 yyfreestack(&yystack
);