libsmbclient: Remove unused cli_session_setup_ntlmssp()
[Samba/gebeck_regimport.git] / source4 / heimdal / lib / asn1 / asn1parse.c
blob22c8f289f4c07753ed4517cab9c46ff6573b2ae7
1 #ifndef lint
2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
3 #endif
5 #define YYBYACC 1
6 #define YYMAJOR 1
7 #define YYMINOR 9
8 #define YYPATCH 20101229
10 #define YYEMPTY (-1)
11 #define yyclearin (yychar = YYEMPTY)
12 #define yyerrok (yyerrflag = 0)
13 #define YYRECOVERING() (yyerrflag != 0)
15 #define YYPREFIX "yy"
17 #define YYPURE 0
20 #include <config.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include "symbol.h"
26 #include "lex.h"
27 #include "gen_locl.h"
28 #include "der.h"
30 RCSID("$Id$");
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);
40 struct string_list {
41 char *string;
42 struct string_list *next;
45 /* Declarations for Bison */
46 #define YYMALLOC malloc
47 #define YYFREE free
49 #ifdef YYSTYPE
50 #undef YYSTYPE_IS_DECLARED
51 #define YYSTYPE_IS_DECLARED 1
52 #endif
53 #ifndef YYSTYPE_IS_DECLARED
54 #define YYSTYPE_IS_DECLARED 1
55 typedef union {
56 int constant;
57 struct value *value;
58 struct range *range;
59 char *name;
60 Type *type;
61 Member *member;
62 struct objid *objid;
63 char *defval;
64 struct string_list *sl;
65 struct tagtype tag;
66 struct memhead *members;
67 struct constraint_spec *constraint_spec;
68 } YYSTYPE;
69 #endif /* !YYSTYPE_IS_DECLARED */
70 /* compatibility with bison */
71 #ifdef YYPARSE_PARAM
72 /* compatibility with FreeBSD */
73 # ifdef YYPARSE_PARAM_TYPE
74 # define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
75 # else
76 # define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
77 # endif
78 #else
79 # define YYPARSE_DECL() yyparse(void)
80 #endif
82 /* Parameters sent to lex. */
83 #ifdef YYLEX_PARAM
84 # define YYLEX_DECL() yylex(void *YYLEX_PARAM)
85 # define YYLEX yylex(YYLEX_PARAM)
86 #else
87 # define YYLEX_DECL() yylex(void)
88 # define YYLEX yylex()
89 #endif
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();
97 #define kw_ABSENT 257
98 #define kw_ABSTRACT_SYNTAX 258
99 #define kw_ALL 259
100 #define kw_APPLICATION 260
101 #define kw_AUTOMATIC 261
102 #define kw_BEGIN 262
103 #define kw_BIT 263
104 #define kw_BMPString 264
105 #define kw_BOOLEAN 265
106 #define kw_BY 266
107 #define kw_CHARACTER 267
108 #define kw_CHOICE 268
109 #define kw_CLASS 269
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
118 #define kw_END 278
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
125 #define kw_FALSE 285
126 #define kw_FROM 286
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
140 #define kw_MAX 300
141 #define kw_MIN 301
142 #define kw_MINUS_INFINITY 302
143 #define kw_NULL 303
144 #define kw_NumericString 304
145 #define kw_OBJECT 305
146 #define kw_OCTET 306
147 #define kw_OF 307
148 #define kw_OPTIONAL 308
149 #define kw_ObjectDescriptor 309
150 #define kw_PATTERN 310
151 #define kw_PDV 311
152 #define kw_PLUS_INFINITY 312
153 #define kw_PRESENT 313
154 #define kw_PRIVATE 314
155 #define kw_PrintableString 315
156 #define kw_REAL 316
157 #define kw_RELATIVE_OID 317
158 #define kw_SEQUENCE 318
159 #define kw_SET 319
160 #define kw_SIZE 320
161 #define kw_STRING 321
162 #define kw_SYNTAX 322
163 #define kw_T61String 323
164 #define kw_TAGS 324
165 #define kw_TRUE 325
166 #define kw_TYPE_IDENTIFIER 326
167 #define kw_TeletexString 327
168 #define kw_UNION 328
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
176 #define kw_WITH 336
177 #define RANGE 337
178 #define EEQUAL 338
179 #define ELLIPSIS 339
180 #define IDENTIFIER 340
181 #define referencename 341
182 #define STRING 342
183 #define NUMBER 343
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,
414 #define YYFINAL 2
415 #ifndef YYDEBUG
416 #define YYDEBUG 0
417 #endif
418 #define YYMAXTOKEN 343
419 #if YYDEBUG
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",
453 "TagDefault :",
454 "ExtensionDefault : kw_EXTENSIBILITY kw_IMPLIED",
455 "ExtensionDefault :",
456 "ModuleBody : Exports Imports AssignmentList",
457 "ModuleBody :",
458 "Imports : kw_IMPORTS SymbolsImported ';'",
459 "Imports :",
460 "SymbolsImported : SymbolsFromModuleList",
461 "SymbolsImported :",
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",
467 "Exports :",
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",
511 "size :",
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 ']'",
536 "Class :",
537 "Class : kw_UNIVERSAL",
538 "Class : kw_APPLICATION",
539 "Class : kw_PRIVATE",
540 "tagenv :",
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 ')'",
563 "objid_opt : objid",
564 "objid_opt :",
565 "objid : '{' objid_list '}'",
566 "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",
590 #endif
591 /* define the initial stack-sizes */
592 #ifdef YYSTACKSIZE
593 #undef YYMAXDEPTH
594 #define YYMAXDEPTH YYSTACKSIZE
595 #else
596 #ifdef YYMAXDEPTH
597 #define YYSTACKSIZE YYMAXDEPTH
598 #else
599 #define YYSTACKSIZE 500
600 #define YYMAXDEPTH 500
601 #endif
602 #endif
604 #define YYINITSTACKSIZE 500
606 int yydebug;
607 int yynerrs;
609 typedef struct {
610 unsigned stacksize;
611 short *s_base;
612 short *s_mark;
613 short *s_last;
614 YYSTYPE *l_base;
615 YYSTYPE *l_mark;
616 } YYSTACKDATA;
617 int yyerrflag;
618 int yychar;
619 YYSTYPE yyval;
620 YYSTYPE yylval;
622 /* variables for the parser stack */
623 static YYSTACKDATA yystack;
625 void
626 yyerror (const char *s)
628 lex_error_message ("%s\n", s);
631 static Type *
632 new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype)
634 Type *t;
635 if(oldtype->type == TTag && oldtype->tag.tagenv == TE_IMPLICIT) {
636 t = oldtype;
637 oldtype = oldtype->subtype; /* XXX */
638 } else
639 t = new_type (TTag);
641 t->tag.tagclass = tagclass;
642 t->tag.tagvalue = tagvalue;
643 t->tag.tagenv = tagenv;
644 t->subtype = oldtype;
645 return t;
648 static struct objid *
649 new_objid(const char *label, int value)
651 struct objid *s;
652 s = emalloc(sizeof(*s));
653 s->label = label;
654 s->value = value;
655 s->next = NULL;
656 return s;
659 static void
660 add_oid_to_tail(struct objid *head, struct objid *tail)
662 struct objid *o;
663 o = head;
664 while (o->next)
665 o = o->next;
666 o->next = tail;
669 static Type *
670 new_type (Typetype tt)
672 Type *t = ecalloc(1, sizeof(*t));
673 t->type = tt;
674 return t;
677 static struct constraint_spec *
678 new_constraint_spec(enum ctype ct)
680 struct constraint_spec *c = ecalloc(1, sizeof(*c));
681 c->ctype = ct;
682 return c;
685 static void fix_labels2(Type *t, const char *prefix);
686 static void fix_labels1(struct memhead *members, const char *prefix)
688 Member *m;
690 if(members == NULL)
691 return;
692 ASN1_TAILQ_FOREACH(m, members, members) {
693 if (asprintf(&m->label, "%s_%s", prefix, m->gen_name) < 0)
694 errx(1, "malloc");
695 if (m->label == NULL)
696 errx(1, "malloc");
697 if(m->type != 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);
708 static void
709 fix_labels(Symbol *s)
711 char *p = NULL;
712 if (asprintf(&p, "choice_%s", s->gen_name) < 0 || p == NULL)
713 errx(1, "malloc");
714 fix_labels2(s->type, p);
715 free(p);
718 #if YYDEBUG
719 #include <stdio.h> /* needed for printf */
720 #endif
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)
728 int i;
729 unsigned newsize;
730 short *newss;
731 YYSTYPE *newvs;
733 if ((newsize = data->stacksize) == 0)
734 newsize = YYINITSTACKSIZE;
735 else if (newsize >= YYMAXDEPTH)
736 return -1;
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));
742 if (newss == 0)
743 return -1;
745 data->s_base = newss;
746 data->s_mark = newss + i;
748 newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
749 if (newvs == 0)
750 return -1;
752 data->l_base = newvs;
753 data->l_mark = newvs + i;
755 data->stacksize = newsize;
756 data->s_last = data->s_base + newsize - 1;
757 return 0;
760 #if YYPURE || defined(YY_NO_LEAKS)
761 static void yyfreestack(YYSTACKDATA *data)
763 free(data->s_base);
764 free(data->l_base);
765 memset(data, 0, sizeof(*data));
767 #else
768 #define yyfreestack(data) /* nothing */
769 #endif
771 #define YYABORT goto yyabort
772 #define YYREJECT goto yyabort
773 #define YYACCEPT goto yyaccept
774 #define YYERROR goto yyerrlab
777 YYPARSE_DECL()
779 int yym, yyn, yystate;
780 #if YYDEBUG
781 const char *yys;
783 if ((yys = getenv("YYDEBUG")) != 0)
785 yyn = *yys;
786 if (yyn >= '0' && yyn <= '9')
787 yydebug = yyn - '0';
789 #endif
791 yynerrs = 0;
792 yyerrflag = 0;
793 yychar = YYEMPTY;
794 yystate = 0;
796 #if YYPURE
797 memset(&yystack, 0, sizeof(yystack));
798 #endif
800 if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow;
801 yystack.s_mark = yystack.s_base;
802 yystack.l_mark = yystack.l_base;
803 yystate = 0;
804 *yystack.s_mark = 0;
806 yyloop:
807 if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
808 if (yychar < 0)
810 if ((yychar = YYLEX) < 0) yychar = 0;
811 #if YYDEBUG
812 if (yydebug)
814 yys = 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);
820 #endif
822 if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
823 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
825 #if YYDEBUG
826 if (yydebug)
827 printf("%sdebug: state %d, shifting to state %d\n",
828 YYPREFIX, yystate, yytable[yyn]);
829 #endif
830 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
832 goto yyoverflow;
834 yystate = yytable[yyn];
835 *++yystack.s_mark = yytable[yyn];
836 *++yystack.l_mark = yylval;
837 yychar = YYEMPTY;
838 if (yyerrflag > 0) --yyerrflag;
839 goto yyloop;
841 if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
842 yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
844 yyn = yytable[yyn];
845 goto yyreduce;
847 if (yyerrflag) goto yyinrecovery;
849 yyerror("syntax error");
851 goto yyerrlab;
853 yyerrlab:
854 ++yynerrs;
856 yyinrecovery:
857 if (yyerrflag < 3)
859 yyerrflag = 3;
860 for (;;)
862 if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 &&
863 yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
865 #if YYDEBUG
866 if (yydebug)
867 printf("%sdebug: state %d, error recovery shifting\
868 to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]);
869 #endif
870 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
872 goto yyoverflow;
874 yystate = yytable[yyn];
875 *++yystack.s_mark = yytable[yyn];
876 *++yystack.l_mark = yylval;
877 goto yyloop;
879 else
881 #if YYDEBUG
882 if (yydebug)
883 printf("%sdebug: error recovery discarding state %d\n",
884 YYPREFIX, *yystack.s_mark);
885 #endif
886 if (yystack.s_mark <= yystack.s_base) goto yyabort;
887 --yystack.s_mark;
888 --yystack.l_mark;
892 else
894 if (yychar == 0) goto yyabort;
895 #if YYDEBUG
896 if (yydebug)
898 yys = 0;
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);
904 #endif
905 yychar = YYEMPTY;
906 goto yyloop;
909 yyreduce:
910 #if YYDEBUG
911 if (yydebug)
912 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
913 YYPREFIX, yystate, yyn, yyrule[yyn]);
914 #endif
915 yym = yylen[yyn];
916 if (yym)
917 yyval = yystack.l_mark[1-yym];
918 else
919 memset(&yyval, 0, sizeof yyval);
920 switch (yyn)
922 case 1:
924 checkundefined();
926 break;
927 case 3:
928 { lex_error_message("implicit tagging is not supported"); }
929 break;
930 case 4:
931 { lex_error_message("automatic tagging is not supported"); }
932 break;
933 case 6:
934 { lex_error_message("no extensibility options supported"); }
935 break;
936 case 16:
938 struct string_list *sl;
939 for(sl = yystack.l_mark[-3].sl; sl != NULL; sl = sl->next) {
940 Symbol *s = addsym(sl->string);
941 s->stype = Stype;
942 gen_template_import(s);
944 add_import(yystack.l_mark[-1].name);
946 break;
947 case 17:
949 struct string_list *sl;
950 for(sl = yystack.l_mark[-1].sl; sl != NULL; sl = sl->next)
951 add_export(sl->string);
953 break;
954 case 24:
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;
960 break;
961 case 25:
963 yyval.sl = emalloc(sizeof(*yyval.sl));
964 yyval.sl->string = yystack.l_mark[0].name;
965 yyval.sl->next = NULL;
967 break;
968 case 26:
970 Symbol *s = addsym (yystack.l_mark[-2].name);
971 s->stype = Stype;
972 s->type = yystack.l_mark[0].type;
973 fix_labels(s);
974 generate_type (s);
976 break;
977 case 44:
979 yyval.type = new_tag(ASN1_C_UNIV, UT_Boolean,
980 TE_EXPLICIT, new_type(TBoolean));
982 break;
983 case 45:
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;
993 break;
994 case 46:
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;
1002 break;
1003 case 47:
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;
1011 break;
1012 case 48:
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;
1020 break;
1021 case 49:
1023 yyval.type = new_tag(ASN1_C_UNIV, UT_Integer,
1024 TE_EXPLICIT, new_type(TInteger));
1026 break;
1027 case 50:
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);
1033 break;
1034 case 51:
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);
1040 break;
1041 case 52:
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);
1047 break;
1048 case 53:
1050 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
1051 yyval.members = yystack.l_mark[-2].members;
1053 break;
1054 case 54:
1055 { yyval.members = yystack.l_mark[-2].members; }
1056 break;
1057 case 55:
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;
1068 break;
1069 case 56:
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);
1075 break;
1076 case 58:
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);
1083 break;
1084 case 59:
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);
1090 break;
1091 case 60:
1093 yyval.type = new_tag(ASN1_C_UNIV, UT_OID,
1094 TE_EXPLICIT, new_type(TOID));
1096 break;
1097 case 61:
1099 Type *t = new_type(TOctetString);
1100 t->range = yystack.l_mark[0].range;
1101 yyval.type = new_tag(ASN1_C_UNIV, UT_OctetString,
1102 TE_EXPLICIT, t);
1104 break;
1105 case 62:
1107 yyval.type = new_tag(ASN1_C_UNIV, UT_Null,
1108 TE_EXPLICIT, new_type(TNull));
1110 break;
1111 case 63:
1112 { yyval.range = NULL; }
1113 break;
1114 case 64:
1115 { yyval.range = yystack.l_mark[0].range; }
1116 break;
1117 case 65:
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);
1123 break;
1124 case 66:
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);
1130 break;
1131 case 67:
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);
1138 break;
1139 case 68:
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);
1145 break;
1146 case 69:
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);
1152 break;
1153 case 70:
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);
1159 break;
1160 case 71:
1162 yyval.type = new_type(TChoice);
1163 yyval.type->members = yystack.l_mark[-1].members;
1165 break;
1166 case 74:
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);
1172 else
1173 yyval.type->symbol = s;
1175 break;
1176 case 75:
1178 yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralizedTime,
1179 TE_EXPLICIT, new_type(TGeneralizedTime));
1181 break;
1182 case 76:
1184 yyval.type = new_tag(ASN1_C_UNIV, UT_UTCTime,
1185 TE_EXPLICIT, new_type(TUTCTime));
1187 break;
1188 case 77:
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
1201 break;
1202 case 78:
1204 yyval.constraint_spec = yystack.l_mark[-1].constraint_spec;
1206 break;
1207 case 82:
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;
1213 break;
1214 case 83:
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;
1222 break;
1223 case 84:
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;
1231 break;
1232 case 85:
1234 yyval.constraint_spec = new_constraint_spec(CT_USER);
1236 break;
1237 case 86:
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);
1245 } else
1246 yyval.type->subtype = yystack.l_mark[0].type;
1248 break;
1249 case 87:
1251 yyval.tag.tagclass = yystack.l_mark[-2].constant;
1252 yyval.tag.tagvalue = yystack.l_mark[-1].constant;
1253 yyval.tag.tagenv = TE_EXPLICIT;
1255 break;
1256 case 88:
1258 yyval.constant = ASN1_C_CONTEXT;
1260 break;
1261 case 89:
1263 yyval.constant = ASN1_C_UNIV;
1265 break;
1266 case 90:
1268 yyval.constant = ASN1_C_APPL;
1270 break;
1271 case 91:
1273 yyval.constant = ASN1_C_PRIVATE;
1275 break;
1276 case 92:
1278 yyval.constant = TE_EXPLICIT;
1280 break;
1281 case 93:
1283 yyval.constant = TE_EXPLICIT;
1285 break;
1286 case 94:
1288 yyval.constant = TE_IMPLICIT;
1290 break;
1291 case 95:
1293 Symbol *s;
1294 s = addsym (yystack.l_mark[-3].name);
1296 s->stype = SValue;
1297 s->value = yystack.l_mark[0].value;
1298 generate_constant (s);
1300 break;
1301 case 97:
1303 yyval.type = new_tag(ASN1_C_UNIV, UT_GeneralString,
1304 TE_EXPLICIT, new_type(TGeneralString));
1306 break;
1307 case 98:
1309 yyval.type = new_tag(ASN1_C_UNIV, UT_TeletexString,
1310 TE_EXPLICIT, new_type(TTeletexString));
1312 break;
1313 case 99:
1315 yyval.type = new_tag(ASN1_C_UNIV, UT_UTF8String,
1316 TE_EXPLICIT, new_type(TUTF8String));
1318 break;
1319 case 100:
1321 yyval.type = new_tag(ASN1_C_UNIV, UT_PrintableString,
1322 TE_EXPLICIT, new_type(TPrintableString));
1324 break;
1325 case 101:
1327 yyval.type = new_tag(ASN1_C_UNIV, UT_VisibleString,
1328 TE_EXPLICIT, new_type(TVisibleString));
1330 break;
1331 case 102:
1333 yyval.type = new_tag(ASN1_C_UNIV, UT_IA5String,
1334 TE_EXPLICIT, new_type(TIA5String));
1336 break;
1337 case 103:
1339 yyval.type = new_tag(ASN1_C_UNIV, UT_BMPString,
1340 TE_EXPLICIT, new_type(TBMPString));
1342 break;
1343 case 104:
1345 yyval.type = new_tag(ASN1_C_UNIV, UT_UniversalString,
1346 TE_EXPLICIT, new_type(TUniversalString));
1348 break;
1349 case 105:
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);
1355 break;
1356 case 106:
1358 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
1359 yyval.members = yystack.l_mark[-2].members;
1361 break;
1362 case 107:
1364 struct member *m = ecalloc(1, sizeof(*m));
1365 m->name = estrdup("...");
1366 m->gen_name = estrdup("asn1_ellipsis");
1367 m->ellipsis = 1;
1368 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, m, members);
1369 yyval.members = yystack.l_mark[-2].members;
1371 break;
1372 case 108:
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;
1381 break;
1382 case 109:
1384 yyval.member = yystack.l_mark[0].member;
1385 yyval.member->optional = 0;
1386 yyval.member->defval = NULL;
1388 break;
1389 case 110:
1391 yyval.member = yystack.l_mark[-1].member;
1392 yyval.member->optional = 1;
1393 yyval.member->defval = NULL;
1395 break;
1396 case 111:
1398 yyval.member = yystack.l_mark[-2].member;
1399 yyval.member->optional = 0;
1400 yyval.member->defval = yystack.l_mark[0].value;
1402 break;
1403 case 112:
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);
1409 break;
1410 case 113:
1412 ASN1_TAILQ_INSERT_TAIL(yystack.l_mark[-2].members, yystack.l_mark[0].member, members);
1413 yyval.members = yystack.l_mark[-2].members;
1415 break;
1416 case 114:
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;
1427 break;
1428 case 116:
1429 { yyval.objid = NULL; }
1430 break;
1431 case 117:
1433 yyval.objid = yystack.l_mark[-1].objid;
1435 break;
1436 case 118:
1438 yyval.objid = NULL;
1440 break;
1441 case 119:
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);
1446 } else {
1447 yyval.objid = yystack.l_mark[-1].objid;
1450 break;
1451 case 120:
1453 yyval.objid = new_objid(yystack.l_mark[-3].name, yystack.l_mark[-1].constant);
1455 break;
1456 case 121:
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",
1462 s->name);
1463 exit(1);
1465 yyval.objid = s->value->u.objectidentifiervalue;
1467 break;
1468 case 122:
1470 yyval.objid = new_objid(NULL, yystack.l_mark[0].constant);
1472 break;
1473 case 132:
1475 Symbol *s = addsym(yystack.l_mark[0].name);
1476 if(s->stype != SValue)
1477 lex_error_message ("%s is not a value\n",
1478 s->name);
1479 else
1480 yyval.value = s->value;
1482 break;
1483 case 133:
1485 yyval.value = emalloc(sizeof(*yyval.value));
1486 yyval.value->type = stringvalue;
1487 yyval.value->u.stringvalue = yystack.l_mark[0].name;
1489 break;
1490 case 134:
1492 yyval.value = emalloc(sizeof(*yyval.value));
1493 yyval.value->type = booleanvalue;
1494 yyval.value->u.booleanvalue = 0;
1496 break;
1497 case 135:
1499 yyval.value = emalloc(sizeof(*yyval.value));
1500 yyval.value->type = booleanvalue;
1501 yyval.value->u.booleanvalue = 0;
1503 break;
1504 case 136:
1506 yyval.value = emalloc(sizeof(*yyval.value));
1507 yyval.value->type = integervalue;
1508 yyval.value->u.integervalue = yystack.l_mark[0].constant;
1510 break;
1511 case 138:
1514 break;
1515 case 139:
1517 yyval.value = emalloc(sizeof(*yyval.value));
1518 yyval.value->type = objectidentifiervalue;
1519 yyval.value->u.objectidentifiervalue = yystack.l_mark[0].objid;
1521 break;
1523 yystack.s_mark -= yym;
1524 yystate = *yystack.s_mark;
1525 yystack.l_mark -= yym;
1526 yym = yylhs[yyn];
1527 if (yystate == 0 && yym == 0)
1529 #if YYDEBUG
1530 if (yydebug)
1531 printf("%sdebug: after reduction, shifting from state 0 to\
1532 state %d\n", YYPREFIX, YYFINAL);
1533 #endif
1534 yystate = YYFINAL;
1535 *++yystack.s_mark = YYFINAL;
1536 *++yystack.l_mark = yyval;
1537 if (yychar < 0)
1539 if ((yychar = YYLEX) < 0) yychar = 0;
1540 #if YYDEBUG
1541 if (yydebug)
1543 yys = 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);
1549 #endif
1551 if (yychar == 0) goto yyaccept;
1552 goto yyloop;
1554 if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
1555 yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
1556 yystate = yytable[yyn];
1557 else
1558 yystate = yydgoto[yym];
1559 #if YYDEBUG
1560 if (yydebug)
1561 printf("%sdebug: after reduction, shifting from state %d \
1562 to state %d\n", YYPREFIX, *yystack.s_mark, yystate);
1563 #endif
1564 if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack))
1566 goto yyoverflow;
1568 *++yystack.s_mark = (short) yystate;
1569 *++yystack.l_mark = yyval;
1570 goto yyloop;
1572 yyoverflow:
1573 yyerror("yacc stack overflow");
1575 yyabort:
1576 yyfreestack(&yystack);
1577 return (1);
1579 yyaccept:
1580 yyfreestack(&yystack);
1581 return (0);