blob: 095c9041fa764fe23880ac15ddcf73b549d16ca8 [file] [log] [blame]
vlmfa67ddc2004-06-03 03:38:44 +00001
2/* A Bison parser, made from asn1p_y.y
3 by GNU Bison version 1.28 */
4
5#define YYBISON 1 /* Identify Bison output. */
6
7#define yyparse asn1p_parse
8#define yylex asn1p_lex
9#define yyerror asn1p_error
10#define yylval asn1p_lval
11#define yychar asn1p_char
12#define yydebug asn1p_debug
13#define yynerrs asn1p_nerrs
14#define TOK_PPEQ 257
15#define TOK_opaque 258
16#define TOK_bstring 259
17#define TOK_cstring 260
18#define TOK_hstring 261
19#define TOK_identifier 262
20#define TOK_number 263
21#define TOK_number_negative 264
22#define TOK_typereference 265
23#define TOK_objectclassreference 266
24#define TOK_typefieldreference 267
25#define TOK_valuefieldreference 268
26#define TOK_ABSENT 269
27#define TOK_ABSTRACT_SYNTAX 270
28#define TOK_ALL 271
29#define TOK_ANY 272
30#define TOK_APPLICATION 273
31#define TOK_AUTOMATIC 274
32#define TOK_BEGIN 275
33#define TOK_BIT 276
34#define TOK_BMPString 277
35#define TOK_BOOLEAN 278
36#define TOK_BY 279
37#define TOK_CHARACTER 280
38#define TOK_CHOICE 281
39#define TOK_CLASS 282
40#define TOK_COMPONENT 283
41#define TOK_COMPONENTS 284
42#define TOK_CONSTRAINED 285
43#define TOK_CONTAINING 286
44#define TOK_DEFAULT 287
45#define TOK_DEFINITIONS 288
46#define TOK_DEFINED 289
47#define TOK_EMBEDDED 290
48#define TOK_ENCODED 291
49#define TOK_END 292
50#define TOK_ENUMERATED 293
51#define TOK_EXPLICIT 294
52#define TOK_EXPORTS 295
53#define TOK_EXTENSIBILITY 296
54#define TOK_EXTERNAL 297
55#define TOK_FALSE 298
56#define TOK_FROM 299
57#define TOK_GeneralizedTime 300
58#define TOK_GeneralString 301
59#define TOK_GraphicString 302
60#define TOK_IA5String 303
61#define TOK_IDENTIFIER 304
62#define TOK_IMPLICIT 305
63#define TOK_IMPLIED 306
64#define TOK_IMPORTS 307
65#define TOK_INCLUDES 308
66#define TOK_INSTANCE 309
67#define TOK_INTEGER 310
68#define TOK_ISO646String 311
69#define TOK_MAX 312
70#define TOK_MIN 313
71#define TOK_MINUS_INFINITY 314
72#define TOK_NULL 315
73#define TOK_NumericString 316
74#define TOK_OBJECT 317
75#define TOK_ObjectDescriptor 318
76#define TOK_OCTET 319
77#define TOK_OF 320
78#define TOK_OPTIONAL 321
79#define TOK_PATTERN 322
80#define TOK_PDV 323
81#define TOK_PLUS_INFINITY 324
82#define TOK_PRESENT 325
83#define TOK_PrintableString 326
84#define TOK_PRIVATE 327
85#define TOK_REAL 328
86#define TOK_RELATIVE_OID 329
87#define TOK_SEQUENCE 330
88#define TOK_SET 331
89#define TOK_SIZE 332
90#define TOK_STRING 333
91#define TOK_SYNTAX 334
92#define TOK_T61String 335
93#define TOK_TAGS 336
94#define TOK_TeletexString 337
95#define TOK_TRUE 338
96#define TOK_TYPE_IDENTIFIER 339
97#define TOK_UNIQUE 340
98#define TOK_UNIVERSAL 341
99#define TOK_UniversalString 342
100#define TOK_UTCTime 343
101#define TOK_UTF8String 344
102#define TOK_VideotexString 345
103#define TOK_VisibleString 346
104#define TOK_WITH 347
105#define TOK_UNION 348
106#define TOK_INTERSECTION 349
107#define TOK_EXCEPT 350
108#define TOK_TwoDots 351
109#define TOK_ThreeDots 352
110#define TOK_tag 353
111
112#line 1 "asn1p_y.y"
113
114
115#include <stdlib.h>
116#include <stdio.h>
117#include <string.h>
118#include <errno.h>
119#include <assert.h>
120
121#include "asn1parser.h"
122
123#define YYPARSE_PARAM param
124#define YYERROR_VERBOSE
125
126int yylex(void);
127int yyerror(const char *msg);
128void asn1p_lexer_hack_push_opaque_state(void);
129void asn1p_lexer_hack_enable_with_syntax(void);
130#define yylineno asn1p_lineno
131extern int asn1p_lineno;
132
133
134static asn1p_value_t *
135 _convert_bitstring2binary(char *str, int base);
136
137#define checkmem(ptr) do { \
138 if(!(ptr)) \
139 return yyerror("Memory failure"); \
140 } while(0)
141
142#define CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do { \
143 if(arg1->type != constr_type) { \
144 int __ret; \
145 root = asn1p_constraint_new(yylineno); \
146 checkmem(root); \
147 root->type = constr_type; \
148 __ret = asn1p_constraint_insert(root, \
149 arg1); \
150 checkmem(__ret == 0); \
151 } else { \
152 root = arg1; \
153 } \
154 if(arg2) { \
155 int __ret \
156 = asn1p_constraint_insert(root, arg2); \
157 checkmem(__ret == 0); \
158 } \
159 } while(0)
160
161
162#line 57 "asn1p_y.y"
163typedef union {
164 asn1p_t *a_grammar;
165 asn1p_module_flags_e a_module_flags;
166 asn1p_module_t *a_module;
167 asn1p_expr_type_e a_type; /* ASN.1 Type */
168 asn1p_expr_t *a_expr; /* Constructed collection */
169 asn1p_constraint_t *a_constr; /* Constraint */
170 enum asn1p_constraint_type_e a_ctype;/* Constraint type */
171 asn1p_xports_t *a_xports; /* IMports/EXports */
172 asn1p_oid_t *a_oid; /* Object Identifier */
173 asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */
174 struct asn1p_type_tag_s a_tag; /* A tag */
175 asn1p_ref_t *a_ref; /* Reference to custom type */
176 asn1p_wsyntx_t *a_wsynt; /* WITH SYNTAX contents */
177 asn1p_wsyntx_chunk_t *a_wchunk; /* WITH SYNTAX chunk */
178 struct asn1p_ref_component_s a_refcomp; /* Component of a reference */
179 asn1p_value_t *a_value; /* Number, DefinedValue, etc */
180 struct asn1p_param_s a_parg; /* A parameter argument */
181 asn1p_paramlist_t *a_plist; /* A pargs list */
182 enum asn1p_expr_marker_e a_marker; /* OPTIONAL/DEFAULT */
183 enum asn1p_constr_pres_e a_pres; /* PRESENT/ABSENT/OPTIONAL */
184 asn1_integer_t a_int;
185 char *tv_str;
186 struct {
187 char *buf;
188 int len;
189 } tv_opaque;
190 struct {
191 char *name;
192 struct asn1p_type_tag_s tag;
193 } tv_nametag;
194} YYSTYPE;
195#include <stdio.h>
196
197#ifndef __cplusplus
198#ifndef __STDC__
199#define const
200#endif
201#endif
202
203
204
205#define YYFINAL 375
206#define YYFLAG -32768
207#define YYNTBASE 113
208
209#define YYTRANSLATE(x) ((unsigned)(x) <= 353 ? yytranslate[x] : 211)
210
211static const char yytranslate[] = { 0,
212 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
213 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
214 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
215 2, 2, 109, 2, 2, 2, 2, 2, 2, 104,
216 105, 2, 2, 107, 2, 110, 2, 2, 2, 2,
217 2, 2, 2, 2, 2, 2, 2, 108, 106, 111,
218 2, 2, 2, 112, 2, 2, 2, 2, 2, 2,
219 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
220 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
221 2, 2, 2, 96, 2, 2, 2, 2, 2, 2,
222 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
223 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
224 2, 2, 102, 94, 103, 2, 2, 2, 2, 2,
225 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
226 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
227 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
228 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
229 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
230 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
231 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
232 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
233 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
234 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
235 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
236 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
237 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
238 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
239 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
240 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
241 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
242 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
243 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
244 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
245 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
246 87, 88, 89, 90, 91, 92, 93, 95, 97, 98,
247 99, 100, 101
248};
249
250#if YYDEBUG != 0
251static const short yyprhs[] = { 0,
252 0, 2, 4, 7, 16, 17, 19, 23, 26, 28,
253 31, 33, 38, 40, 41, 43, 45, 48, 51, 54,
254 57, 60, 61, 63, 65, 68, 70, 72, 74, 76,
255 78, 80, 84, 87, 89, 92, 97, 99, 103, 105,
256 107, 111, 115, 118, 120, 124, 126, 128, 135, 137,
257 139, 140, 142, 147, 152, 156, 163, 165, 169, 171,
258 175, 179, 181, 185, 187, 189, 191, 195, 201, 202,
259 204, 206, 210, 213, 217, 222, 223, 225, 226, 233,
260 235, 238, 240, 242, 245, 247, 251, 253, 257, 261,
261 263, 265, 267, 272, 274, 278, 280, 284, 288, 290,
262 294, 296, 300, 302, 304, 306, 308, 313, 314, 318,
263 320, 322, 324, 326, 328, 330, 334, 336, 339, 341,
264 343, 345, 347, 350, 353, 355, 357, 360, 363, 365,
265 367, 369, 371, 374, 376, 379, 381, 383, 385, 387,
266 389, 391, 393, 395, 397, 399, 401, 403, 405, 407,
267 412, 417, 422, 427, 432, 434, 439, 440, 442, 444,
268 446, 448, 450, 452, 457, 459, 462, 466, 468, 472,
269 478, 480, 484, 486, 488, 492, 494, 498, 500, 504,
270 506, 510, 515, 517, 519, 521, 524, 527, 531, 533,
271 535, 537, 539, 541, 543, 545, 547, 549, 555, 557,
272 561, 563, 567, 568, 570, 572, 574, 576, 578, 580,
273 584, 589, 591, 595, 598, 602, 604, 608, 609, 611,
274 613, 616, 618, 620, 621, 625, 628, 632, 634, 638,
275 640, 645, 650, 652, 654, 656, 658, 659, 661, 663,
276 666, 669, 671, 673, 675, 677, 679
277};
278
279static const short yyrhs[] = { 114,
280 0, 115, 0, 114, 115, 0, 207, 116, 34, 120,
281 3, 21, 123, 38, 0, 0, 117, 0, 102, 118,
282 103, 0, 102, 103, 0, 119, 0, 118, 119, 0,
283 209, 0, 209, 104, 9, 105, 0, 9, 0, 0,
284 121, 0, 122, 0, 121, 122, 0, 40, 82, 0,
285 51, 82, 0, 20, 82, 0, 42, 52, 0, 0,
286 124, 0, 125, 0, 124, 125, 0, 126, 0, 131,
287 0, 137, 0, 161, 0, 134, 0, 169, 0, 53,
288 127, 106, 0, 53, 45, 0, 128, 0, 127, 128,
289 0, 129, 45, 207, 116, 0, 130, 0, 129, 107,
290 130, 0, 207, 0, 209, 0, 41, 132, 106, 0,
291 41, 17, 106, 0, 41, 106, 0, 133, 0, 132,
292 107, 133, 0, 207, 0, 209, 0, 207, 135, 3,
293 102, 136, 103, 0, 156, 0, 166, 0, 0, 177,
294 0, 207, 3, 205, 85, 0, 207, 3, 205, 153,
295 0, 207, 3, 143, 0, 207, 102, 138, 103, 3,
296 153, 0, 139, 0, 138, 107, 139, 0, 207, 0,
297 207, 108, 209, 0, 166, 108, 209, 0, 141, 0,
298 140, 107, 141, 0, 155, 0, 209, 0, 152, 0,
299 142, 107, 152, 0, 28, 102, 145, 103, 147, 0,
300 0, 86, 0, 146, 0, 145, 107, 146, 0, 159,
301 197, 0, 159, 153, 144, 0, 159, 159, 197, 144,
302 0, 0, 148, 0, 0, 93, 80, 102, 149, 150,
303 103, 0, 151, 0, 150, 151, 0, 4, 0, 159,
304 0, 210, 153, 0, 154, 0, 155, 171, 197, 0,
305 100, 0, 100, 109, 164, 0, 100, 109, 204, 0,
306 168, 0, 169, 0, 170, 0, 207, 102, 140, 103,
307 0, 156, 0, 55, 66, 156, 0, 11, 0, 11,
308 110, 207, 0, 11, 110, 209, 0, 208, 0, 208,
309 110, 157, 0, 158, 0, 157, 110, 158, 0, 160,
310 0, 160, 0, 13, 0, 14, 0, 209, 135, 3,
311 162, 0, 0, 102, 163, 165, 0, 5, 0, 7,
312 0, 6, 0, 204, 0, 164, 0, 209, 0, 207,
313 110, 209, 0, 4, 0, 165, 4, 0, 24, 0,
314 61, 0, 74, 0, 167, 0, 65, 79, 0, 63,
315 50, 0, 75, 0, 43, 0, 36, 69, 0, 26,
316 79, 0, 89, 0, 46, 0, 56, 0, 39, 0,
317 22, 79, 0, 166, 0, 167, 201, 0, 23, 0,
318 47, 0, 48, 0, 49, 0, 57, 0, 62, 0,
319 72, 0, 81, 0, 83, 0, 88, 0, 90, 0,
320 91, 0, 92, 0, 64, 0, 27, 102, 142, 103,
321 0, 76, 102, 142, 103, 0, 77, 102, 142, 103,
322 0, 76, 171, 66, 155, 0, 77, 171, 66, 155,
323 0, 18, 0, 18, 35, 25, 209, 0, 0, 175,
324 0, 94, 0, 95, 0, 96, 0, 97, 0, 98,
325 0, 78, 104, 177, 105, 0, 176, 0, 175, 176,
326 0, 104, 177, 105, 0, 178, 0, 178, 107, 100,
327 0, 178, 107, 100, 107, 178, 0, 100, 0, 100,
328 107, 178, 0, 179, 0, 180, 0, 179, 172, 180,
329 0, 181, 0, 180, 173, 181, 0, 182, 0, 181,
330 174, 182, 0, 185, 0, 185, 183, 185, 0, 184,
331 104, 177, 105, 0, 191, 0, 186, 0, 99, 0,
332 99, 111, 0, 111, 99, 0, 111, 99, 111, 0,
333 78, 0, 45, 0, 204, 0, 209, 0, 6, 0,
334 59, 0, 58, 0, 44, 0, 84, 0, 93, 30,
335 102, 187, 103, 0, 188, 0, 187, 107, 188, 0,
336 100, 0, 209, 171, 189, 0, 0, 190, 0, 71,
337 0, 15, 0, 67, 0, 192, 0, 193, 0, 102,
338 207, 103, 0, 192, 102, 194, 103, 0, 195, 0,
339 194, 107, 195, 0, 112, 196, 0, 112, 110, 196,
340 0, 209, 0, 196, 110, 209, 0, 0, 198, 0,
341 67, 0, 33, 199, 0, 185, 0, 166, 0, 0,
342 102, 200, 165, 0, 102, 103, 0, 102, 202, 103,
343 0, 203, 0, 202, 107, 203, 0, 209, 0, 209,
344 104, 204, 105, 0, 209, 104, 164, 105, 0, 204,
345 0, 100, 0, 9, 0, 10, 0, 0, 206, 0,
346 101, 0, 101, 51, 0, 101, 40, 0, 11, 0,
347 12, 0, 12, 0, 8, 0, 209, 0, 209, 206,
348 0
349};
350
351#endif
352
353#if YYDEBUG != 0
354static const short yyrline[] = { 0,
355 297, 303, 309, 325, 350, 352, 355, 359, 364, 371,
356 379, 384, 388, 397, 399, 407, 411, 419, 423, 426,
357 429, 437, 439, 448, 452, 477, 481, 490, 497, 510,
358 521, 534, 541, 546, 552, 558, 567, 573, 579, 586,
359 594, 598, 601, 608, 614, 620, 627, 636, 646, 654,
360 662, 664, 676, 688, 695, 711, 721, 731, 741, 746,
361 753, 763, 769, 775, 779, 791, 797, 803, 813, 815,
362 818, 826, 832, 841, 846, 863, 865, 870, 874, 879,
363 884, 890, 894, 919, 926, 931, 939, 948, 957, 968,
364 972, 978, 986, 1010, 1017, 1031, 1040, 1050, 1060, 1068,
365 1089, 1098, 1107, 1108, 1110, 1117, 1129, 1139, 1141, 1146,
366 1150, 1154, 1158, 1161, 1166, 1178, 1194, 1205, 1219, 1221,
367 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, 1231,
368 1237, 1239, 1240, 1243, 1250, 1262, 1264, 1268, 1272, 1273,
369 1274, 1275, 1276, 1280, 1281, 1282, 1283, 1287, 1288, 1291,
370 1298, 1304, 1310, 1318, 1326, 1332, 1348, 1350, 1353, 1353,
371 1354, 1354, 1355, 1357, 1370, 1373, 1378, 1384, 1388, 1395,
372 1403, 1408, 1417, 1419, 1421, 1426, 1428, 1434, 1436, 1441,
373 1448, 1455, 1463, 1466, 1471, 1473, 1474, 1475, 1478, 1482,
374 1487, 1491, 1502, 1506, 1511, 1516, 1521, 1528, 1534, 1538,
375 1543, 1549, 1561, 1563, 1566, 1570, 1573, 1578, 1582, 1590,
376 1605, 1611, 1618, 1631, 1643, 1658, 1662, 1679, 1681, 1684,
377 1688, 1694, 1697, 1699, 1699, 1719, 1724, 1729, 1735, 1741,
378 1749, 1757, 1765, 1772, 1782, 1787, 1817, 1819, 1822, 1827,
379 1831, 1837, 1842, 1848, 1855, 1862, 1867
380};
381#endif
382
383
384#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
385
386static const char * const yytname[] = { "$","error","$undefined.","TOK_PPEQ",
387"TOK_opaque","TOK_bstring","TOK_cstring","TOK_hstring","TOK_identifier","TOK_number",
388"TOK_number_negative","TOK_typereference","TOK_objectclassreference","TOK_typefieldreference",
389"TOK_valuefieldreference","TOK_ABSENT","TOK_ABSTRACT_SYNTAX","TOK_ALL","TOK_ANY",
390"TOK_APPLICATION","TOK_AUTOMATIC","TOK_BEGIN","TOK_BIT","TOK_BMPString","TOK_BOOLEAN",
391"TOK_BY","TOK_CHARACTER","TOK_CHOICE","TOK_CLASS","TOK_COMPONENT","TOK_COMPONENTS",
392"TOK_CONSTRAINED","TOK_CONTAINING","TOK_DEFAULT","TOK_DEFINITIONS","TOK_DEFINED",
393"TOK_EMBEDDED","TOK_ENCODED","TOK_END","TOK_ENUMERATED","TOK_EXPLICIT","TOK_EXPORTS",
394"TOK_EXTENSIBILITY","TOK_EXTERNAL","TOK_FALSE","TOK_FROM","TOK_GeneralizedTime",
395"TOK_GeneralString","TOK_GraphicString","TOK_IA5String","TOK_IDENTIFIER","TOK_IMPLICIT",
396"TOK_IMPLIED","TOK_IMPORTS","TOK_INCLUDES","TOK_INSTANCE","TOK_INTEGER","TOK_ISO646String",
397"TOK_MAX","TOK_MIN","TOK_MINUS_INFINITY","TOK_NULL","TOK_NumericString","TOK_OBJECT",
398"TOK_ObjectDescriptor","TOK_OCTET","TOK_OF","TOK_OPTIONAL","TOK_PATTERN","TOK_PDV",
399"TOK_PLUS_INFINITY","TOK_PRESENT","TOK_PrintableString","TOK_PRIVATE","TOK_REAL",
400"TOK_RELATIVE_OID","TOK_SEQUENCE","TOK_SET","TOK_SIZE","TOK_STRING","TOK_SYNTAX",
401"TOK_T61String","TOK_TAGS","TOK_TeletexString","TOK_TRUE","TOK_TYPE_IDENTIFIER",
402"TOK_UNIQUE","TOK_UNIVERSAL","TOK_UniversalString","TOK_UTCTime","TOK_UTF8String",
403"TOK_VideotexString","TOK_VisibleString","TOK_WITH","'|'","TOK_UNION","'^'",
404"TOK_INTERSECTION","TOK_EXCEPT","TOK_TwoDots","TOK_ThreeDots","TOK_tag","'{'",
405"'}'","'('","')'","';'","','","':'","'!'","'.'","'<'","'@'","ParsedGrammar",
406"ModuleList","ModuleSpecification","optObjectIdentifier","ObjectIdentifier",
407"ObjectIdentifierBody","ObjectIdentifierElement","optModuleSpecificationFlags",
408"ModuleSpecificationFlags","ModuleSpecificationFlag","optModuleSpecificationBody",
409"ModuleSpecificationBody","ModuleSpecificationElement","ImportsDefinition","ImportsBundleSet",
410"ImportsBundle","ImportsList","ImportsElement","ExportsDefinition","ExportsBody",
411"ExportsElement","ValueSetDefinition","DefinedTypeRef","optValueSetBody","DataTypeReference",
412"ParameterArgumentList","ParameterArgumentName","ActualParameterList","ActualParameter",
413"ConstructedDataTypeDefinition","ClassDeclaration","optUnique","ClassFieldList",
414"ClassField","optWithSyntax","WithSyntax","@1","WithSyntaxFormat","WithSyntaxFormatToken",
415"DataTypeMember","ConstrainedTypeDeclaration","ExtensionAndException","TypeDeclaration",
416"ComplexTypeReference","ComplexTypeReferenceAmpList","ComplexTypeReferenceElement",
417"ClassFieldIdentifier","ClassFieldName","ValueDefinition","InlineOrDefinedValue",
418"@2","DefinedValue","Opaque","BasicTypeId","BasicTypeId_UniverationCompatible",
419"BasicType","BasicString","ConstructedType","optConstraints","Union","Intersection",
420"Except","Constraints","SingleConstraint","ConstraintElementSet","ConstraintElement",
421"ConstraintElementUnion","ConstraintElementIntersection","ConstraintElementException",
422"ConstraintSubtypeElement","ConstraintRangeSpec","ConstraintSpec","ConstraintValue",
423"WithComponents","WithComponentsList","WithComponentsElement","optPresenceConstraint",
424"PresenceConstraint","TableConstraint","SimpleTableConstraint","ComponentRelationConstraint",
425"AtNotationList","AtNotationElement","ComponentIdList","optMarker","Marker",
426"DefaultValue","@3","UniverationDefinition","UniverationList","UniverationElement",
427"SignedNumber","optTag","Tag","TypeRefName","ObjectClassReference","Identifier",
428"TaggedIdentifier", NULL
429};
430#endif
431
432static const short yyr1[] = { 0,
433 113, 114, 114, 115, 116, 116, 117, 117, 118, 118,
434 119, 119, 119, 120, 120, 121, 121, 122, 122, 122,
435 122, 123, 123, 124, 124, 125, 125, 125, 125, 125,
436 125, 126, 126, 127, 127, 128, 129, 129, 130, 130,
437 131, 131, 131, 132, 132, 133, 133, 134, 135, 135,
438 136, 136, 137, 137, 137, 137, 138, 138, 139, 139,
439 139, 140, 140, 141, 141, 142, 142, 143, 144, 144,
440 145, 145, 146, 146, 146, 147, 147, 149, 148, 150,
441 150, 151, 151, 152, 152, 153, 154, 154, 154, 155,
442 155, 155, 155, 155, 155, 156, 156, 156, 156, 156,
443 157, 157, 158, 159, 160, 160, 161, 163, 162, 162,
444 162, 162, 162, 162, 164, 164, 165, 165, 166, 166,
445 166, 166, 166, 166, 166, 166, 166, 166, 166, 166,
446 167, 167, 167, 168, 168, 169, 169, 169, 169, 169,
447 169, 169, 169, 169, 169, 169, 169, 169, 169, 170,
448 170, 170, 170, 170, 170, 170, 171, 171, 172, 172,
449 173, 173, 174, 175, 175, 175, 176, 177, 177, 177,
450 177, 177, 178, 179, 179, 180, 180, 181, 181, 182,
451 182, 182, 182, 182, 183, 183, 183, 183, 184, 184,
452 185, 185, 185, 185, 185, 185, 185, 186, 187, 187,
453 188, 188, 189, 189, 190, 190, 190, 191, 191, 192,
454 193, 194, 194, 195, 195, 196, 196, 197, 197, 198,
455 198, 199, 199, 200, 199, 201, 201, 202, 202, 203,
456 203, 203, 203, 203, 204, 204, 205, 205, 206, 206,
457 206, 207, 207, 208, 209, 210, 210
458};
459
460static const short yyr2[] = { 0,
461 1, 1, 2, 8, 0, 1, 3, 2, 1, 2,
462 1, 4, 1, 0, 1, 1, 2, 2, 2, 2,
463 2, 0, 1, 1, 2, 1, 1, 1, 1, 1,
464 1, 3, 2, 1, 2, 4, 1, 3, 1, 1,
465 3, 3, 2, 1, 3, 1, 1, 6, 1, 1,
466 0, 1, 4, 4, 3, 6, 1, 3, 1, 3,
467 3, 1, 3, 1, 1, 1, 3, 5, 0, 1,
468 1, 3, 2, 3, 4, 0, 1, 0, 6, 1,
469 2, 1, 1, 2, 1, 3, 1, 3, 3, 1,
470 1, 1, 4, 1, 3, 1, 3, 3, 1, 3,
471 1, 3, 1, 1, 1, 1, 4, 0, 3, 1,
472 1, 1, 1, 1, 1, 3, 1, 2, 1, 1,
473 1, 1, 2, 2, 1, 1, 2, 2, 1, 1,
474 1, 1, 2, 1, 2, 1, 1, 1, 1, 1,
475 1, 1, 1, 1, 1, 1, 1, 1, 1, 4,
476 4, 4, 4, 4, 1, 4, 0, 1, 1, 1,
477 1, 1, 1, 4, 1, 2, 3, 1, 3, 5,
478 1, 3, 1, 1, 3, 1, 3, 1, 3, 1,
479 3, 4, 1, 1, 1, 2, 2, 3, 1, 1,
480 1, 1, 1, 1, 1, 1, 1, 5, 1, 3,
481 1, 3, 0, 1, 1, 1, 1, 1, 1, 3,
482 4, 1, 3, 2, 3, 1, 3, 0, 1, 1,
483 2, 1, 1, 0, 3, 2, 3, 1, 3, 1,
484 4, 4, 1, 1, 1, 1, 0, 1, 1, 2,
485 2, 1, 1, 1, 1, 1, 2
486};
487
488static const short yydefact[] = { 0,
489 242, 243, 1, 2, 5, 3, 0, 0, 6, 245,
490 13, 8, 0, 9, 11, 14, 7, 10, 0, 0,
491 0, 0, 0, 0, 15, 16, 0, 20, 18, 21,
492 19, 0, 17, 12, 22, 136, 0, 137, 138, 139,
493 0, 140, 141, 149, 142, 143, 144, 145, 146, 147,
494 148, 0, 23, 24, 26, 27, 30, 28, 29, 31,
495 0, 0, 0, 43, 0, 44, 46, 47, 33, 0,
496 34, 0, 37, 39, 40, 4, 25, 237, 96, 244,
497 0, 119, 0, 0, 132, 126, 130, 131, 120, 0,
498 0, 121, 125, 129, 0, 0, 49, 50, 122, 99,
499 0, 42, 41, 0, 32, 35, 0, 0, 0, 239,
500 55, 0, 238, 0, 133, 128, 127, 124, 123, 0,
501 57, 0, 59, 0, 0, 0, 45, 5, 38, 0,
502 241, 240, 96, 244, 155, 0, 0, 157, 157, 53,
503 54, 157, 94, 134, 122, 90, 91, 92, 0, 97,
504 98, 0, 0, 0, 0, 51, 105, 106, 100, 101,
505 103, 110, 112, 111, 235, 236, 108, 107, 114, 113,
506 0, 115, 36, 0, 71, 218, 104, 0, 0, 0,
507 0, 0, 0, 0, 158, 165, 0, 0, 218, 0,
508 135, 0, 0, 58, 61, 60, 193, 196, 190, 195,
509 194, 189, 197, 0, 171, 0, 0, 52, 168, 173,
510 174, 176, 178, 0, 180, 184, 183, 208, 209, 191,
511 192, 0, 0, 0, 76, 0, 0, 220, 69, 218,
512 73, 219, 0, 87, 0, 66, 85, 246, 0, 95,
513 0, 0, 0, 0, 166, 0, 0, 86, 234, 226,
514 0, 228, 233, 230, 0, 62, 64, 65, 56, 0,
515 0, 0, 48, 0, 159, 160, 0, 161, 162, 0,
516 163, 0, 0, 185, 0, 0, 0, 102, 117, 109,
517 116, 0, 68, 77, 72, 224, 223, 222, 221, 70,
518 74, 69, 156, 0, 150, 0, 247, 84, 0, 151,
519 167, 153, 152, 154, 227, 0, 0, 93, 0, 0,
520 172, 210, 169, 175, 177, 179, 0, 186, 187, 181,
521 0, 0, 212, 118, 0, 0, 75, 88, 89, 67,
522 164, 229, 0, 0, 63, 201, 0, 199, 157, 0,
523 182, 188, 0, 214, 216, 211, 0, 78, 225, 232,
524 231, 198, 0, 203, 170, 215, 0, 213, 0, 200,
525 206, 207, 205, 202, 204, 217, 82, 0, 80, 83,
526 79, 81, 0, 0, 0
527};
528
529static const short yydefgoto[] = { 373,
530 3, 4, 8, 9, 13, 14, 24, 25, 26, 52,
531 53, 54, 55, 70, 71, 72, 73, 56, 65, 66,
532 57, 96, 207, 58, 120, 121, 255, 256, 235, 111,
533 291, 174, 175, 283, 284, 359, 368, 369, 236, 141,
534 237, 142, 143, 159, 160, 176, 177, 59, 168, 223,
535 169, 280, 144, 145, 146, 147, 148, 184, 267, 270,
536 272, 185, 186, 208, 209, 210, 211, 212, 213, 276,
537 214, 215, 216, 337, 338, 364, 365, 217, 218, 219,
538 322, 323, 344, 231, 232, 289, 326, 191, 251, 252,
539 220, 112, 113, 149, 100, 221, 239
540};
541
542static const short yypact[] = { 81,
543-32768,-32768, 81,-32768, -45,-32768, 23, 70,-32768,-32768,
544-32768,-32768, 47,-32768, 31, 190,-32768,-32768, 132, 61,
545 69, 108, 86, 176, 190,-32768, 76,-32768,-32768,-32768,
546-32768, 166,-32768,-32768, 442,-32768, 32,-32768,-32768,-32768,
547 121,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
548-32768, 168, 442,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
549 179, 732, 103,-32768, 52,-32768,-32768,-32768,-32768, 39,
550-32768, 16,-32768,-32768,-32768,-32768,-32768, -11, 111,-32768,
551 150,-32768, 152, 142,-32768,-32768,-32768,-32768,-32768, 184,
552 159,-32768,-32768,-32768, 748, 240,-32768,-32768,-32768, 135,
553 243,-32768,-32768, 141,-32768,-32768, 81, 141, 145, 60,
554-32768, 599,-32768, 141,-32768,-32768,-32768,-32768,-32768, -1,
555-32768, 143, 144, 147, 206, 68,-32768, -45,-32768, 206,
556-32768,-32768, -42, 148, 221, 161, 198, 40, 53,-32768,
557-32768, -37,-32768,-32768, 163,-32768,-32768,-32768, 164,-32768,
558-32768, 264, 748, 261, 261, 155,-32768,-32768, 160,-32768,
559-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
560 162,-32768,-32768, 64,-32768, 524,-32768, 246, 21, 212,
561 169, 21, 155, 208, 171,-32768, 21, 210, 2, 17,
562-32768, 383, 674,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
563-32768,-32768,-32768, 247, 172, 81, 175,-32768, 173, 133,
564 140, 185,-32768, 178, 35,-32768,-32768, 182,-32768,-32768,
565-32768, 206, 281, 261, 193, 206, 301,-32768, 202, 2,
566-32768,-32768, 261, 181, 66,-32768,-32768, 191, 674,-32768,
567 155, 71, 186, 674,-32768, 89, 674,-32768,-32768,-32768,
568 90,-32768,-32768, 189, 91,-32768,-32768,-32768,-32768, 192,
569 309, 194,-32768, 196,-32768,-32768, 309,-32768,-32768, 309,
570-32768, 309, 155, 187, 205, 78, 200,-32768,-32768, 297,
571-32768, 225,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
572-32768, 202,-32768, 250,-32768, 21,-32768,-32768, 201,-32768,
573-32768,-32768,-32768,-32768,-32768, 56, 250,-32768, 383, 25,
574-32768,-32768, 209, 140, 185,-32768, 215,-32768, 211,-32768,
575 6, 101,-32768,-32768, 219, 281,-32768,-32768,-32768,-32768,
576-32768,-32768, 223, 224,-32768,-32768, 109,-32768, -37, 309,
577-32768,-32768, 261, 203,-32768,-32768, 200,-32768, 297,-32768,
578-32768,-32768, 25, 24,-32768, 203, 261,-32768, 126,-32768,
579-32768,-32768,-32768,-32768,-32768,-32768,-32768, 9,-32768,-32768,
580-32768,-32768, 324, 326,-32768
581};
582
583static const short yypgoto[] = {-32768,
584-32768, 327, 204,-32768,-32768, 318,-32768,-32768, 308,-32768,
585-32768, 282,-32768,-32768, 268,-32768, 226,-32768,-32768, 235,
586-32768, 279,-32768,-32768,-32768, 195,-32768, 33, -129,-32768,
587 51,-32768, 123,-32768,-32768,-32768,-32768, -17, 59, -156,
588-32768, -185, -52,-32768, 130, -173, -109,-32768,-32768,-32768,
589 -209, 30, -50, -43,-32768, 46,-32768, -137,-32768,-32768,
590-32768,-32768, 180, -159, -246,-32768, 94, 88, 97,-32768,
591-32768, -206,-32768,-32768, 10,-32768,-32768,-32768,-32768,-32768,
592-32768, 26, 27, -141,-32768,-32768,-32768,-32768,-32768, 65,
593 -118,-32768, 134, 1,-32768, -7,-32768
594};
595
596
597#define YYLAST 837
598
599
600static const short yytable[] = { 15,
601 5, 188, 230, 5, 189, 15, 257, 170, 97, 97,
602 98, 98, 367, 10, 311, 161, 109, 99, 99, 229,
603 288, 157, 158, 243, 10, 165, 166, 62, 10, 68,
604 10, 11, 10, 75, 227, 61, 259, 67, 361, 10,
605 181, 74, 1, 2, 122, 62, 10, 248, 63, 1,
606 2, 99, 242, 61, 10, 11, 7, 246, 302, -242,
607 107, 304, 75, 10, 165, 166, 183, 114, 228, 320,
608 74, 253, 162, 163, 164, 10, 165, 166, 1, 2,
609 60, 299, 298, 197, 328, 10, 165, 166, 292, 110,
610 362, 1, 2, 355, 363, 123, 68, 333, 60, 131,
611 75, 152, 122, 16, 67, 153, 151, 128, 74, 99,
612 132, 371, 161, 317, 150, 343, 249, 181, 172, 250,
613 234, 198, 108, 257, 336, 12, 171, 240, 10, 367,
614 181, 1, 2, 274, 19, 200, 201, 64, 157, 158,
615 27, 182, 28, 183, 105, 275, 195, 196, 10, 17,
616 29, 1, 2, 123, 187, 249, 183, 103, 104, 30,
617 197, 203, 10, 165, 166, 69, 225, 31, 295, 167,
618 226, 238, 296, 300, 238, 329, 287, 296, 32, 238,
619 34, 78, 254, 99, 258, 370, 35, 253, 334, 79,
620 80, 303, 305, 308, 370, 296, 306, 309, 198, 199,
621 81, 354, 82, 346, 83, 76, 262, 347, 102, 20,
622 117, 352, 200, 201, 84, 353, 281, 85, 157, 158,
623 114, 86, 79, 80, 87, 293, 265, 266, 115, 21,
624 116, 22, 202, 118, 88, 268, 269, 119, 203, 89,
625 23, 90, 124, 91, 125, 126, 130, 204, 156, -243,
626 154, 155, 92, 93, 205, 178, 206, 10, 165, 166,
627 1, 2, 179, 180, 190, 192, 193, 94, 10, 222,
628 233, 224, 241, 244, 183, 247, 260, 263, 261, 264,
629 95, 273, 271, 277, 279, 282, 172, 290, 238, 294,
630 301, 110, 307, 310, 171, 313, 312, 318, 254, 172,
631 324, 258, 339, 319, 325, 331, 197, 171, 10, 165,
632 166, 321, 357, 345, 197, 340, 10, 165, 166, 341,
633 348, 342, 81, 374, 82, 375, 83, 350, 351, 6,
634 18, 173, 33, 129, 77, 345, 84, 106, 127, 85,
635 101, 335, 327, 86, 198, 339, 87, 194, 285, 366,
636 372, 278, 198, 199, 330, 349, 88, 315, 200, 201,
637 314, 89, 360, 90, 245, 91, 200, 201, 316, 356,
638 332, 297, 358, 0, 92, 93, 0, 0, 0, 0,
639 0, 0, 0, 0, 203, 0, 202, 0, 0, 94,
640 10, 0, 203, 133, 134, 0, 0, 0, 0, 0,
641 135, 204, 286, 0, 81, 36, 82, 0, 83, 136,
642 206, 0, 0, 0, 0, 0, 0, 0, 84, 0,
643 0, 85, 0, 0, 0, 86, 0, 0, 87, 38,
644 39, 40, 0, 0, 0, 0, 0, 137, 88, 42,
645 0, 0, 0, 89, 43, 90, 44, 91, 0, 10,
646 0, 0, 1, 2, 45, 0, 92, 93, 138, 139,
647 0, 0, 0, 46, 36, 47, 0, 0, 0, 0,
648 48, 94, 49, 50, 51, 0, 0, 0, 0, 0,
649 0, 0, 37, 0, 0, 0, 0, 0, 38, 39,
650 40, 0, 0, 0, 41, 0, 0, 0, 42, 0,
651 0, 0, 0, 43, 0, 44, 0, 0, 0, 0,
652 0, 0, 0, 45, 0, 0, 0, 0, 0, 0,
653 0, 0, 46, 0, 47, 0, 0, 0, 0, 48,
654 0, 49, 50, 51, 133, 134, 157, 158, 0, 0,
655 0, 135, 0, 0, 0, 81, 36, 82, 0, 83,
656 136, 0, 0, 0, 0, 0, 227, 0, 0, 84,
657 0, 0, 85, 0, 0, 0, 86, 0, 0, 87,
658 38, 39, 40, 0, 0, 0, 0, 0, 137, 88,
659 42, 0, 0, 0, 89, 43, 90, 44, 91, 0,
660 228, 0, 0, 0, 0, 45, 0, 92, 93, 138,
661 139, 0, 0, 0, 46, 0, 47, 0, 0, 133,
662 134, 48, 94, 49, 50, 51, 135, 0, 0, 0,
663 81, 36, 82, 0, 83, 136, 0, 0, 0, 0,
664 0, 0, 0, 0, 84, 0, 0, 85, 0, 0,
665 0, 86, 0, 0, 87, 38, 39, 40, 0, 0,
666 0, 0, 0, 137, 88, 42, 0, 0, 0, 89,
667 43, 90, 44, 91, 0, 0, 0, 0, 0, 0,
668 45, 0, 92, 93, 138, 139, 0, 0, 0, 46,
669 0, 47, 0, 140, 133, 134, 48, 94, 49, 50,
670 51, 135, 0, 0, 0, 81, 36, 82, 0, 83,
671 136, 0, 0, 0, 0, 0, 0, 0, 0, 84,
672 0, 0, 85, 0, 0, 0, 86, 0, 0, 87,
673 38, 39, 40, 0, 0, 0, 0, 0, 137, 88,
674 42, 0, 0, 0, 89, 43, 90, 44, 91, 0,
675 0, 0, 79, 80, 0, 45, 0, 92, 93, 138,
676 139, 0, 0, 81, 46, 82, 47, 83, 1, 2,
677 0, 48, 94, 49, 50, 51, 0, 84, 0, 81,
678 85, 82, 0, 83, 86, 0, 0, 87, 0, 0,
679 0, 0, 0, 84, 0, 0, 85, 88, 0, 0,
680 86, 0, 89, 87, 90, 0, 91, 0, 0, 0,
681 0, 0, 0, 88, 0, 92, 93, 0, 89, 0,
682 90, 0, 91, 0, 0, 0, 0, 0, 0, 0,
683 94, 92, 93, 0, 0, 0, 0, 0, 0, 0,
684 0, 0, 0, 0, 0, 0, 94
685};
686
687static const short yycheck[] = { 7,
688 0, 139, 176, 3, 142, 13, 192, 126, 61, 62,
689 61, 62, 4, 8, 261, 125, 28, 61, 62, 176,
690 227, 13, 14, 183, 8, 9, 10, 35, 8, 37,
691 8, 9, 8, 41, 33, 35, 193, 37, 15, 8,
692 78, 41, 11, 12, 95, 53, 8, 189, 17, 11,
693 12, 95, 182, 53, 8, 9, 102, 187, 244, 102,
694 45, 247, 70, 8, 9, 10, 104, 110, 67, 276,
695 70, 190, 5, 6, 7, 8, 9, 10, 11, 12,
696 35, 241, 239, 6, 294, 8, 9, 10, 230, 101,
697 67, 11, 12, 340, 71, 95, 104, 307, 53, 40,
698 108, 103, 153, 34, 104, 107, 114, 107, 108, 153,
699 51, 103, 222, 273, 114, 110, 100, 78, 126, 103,
700 100, 44, 107, 309, 100, 103, 126, 180, 8, 4,
701 78, 11, 12, 99, 104, 58, 59, 106, 13, 14,
702 9, 102, 82, 104, 106, 111, 154, 155, 8, 103,
703 82, 11, 12, 153, 102, 100, 104, 106, 107, 52,
704 6, 84, 8, 9, 10, 45, 103, 82, 103, 102,
705 107, 179, 107, 103, 182, 294, 227, 107, 3, 187,
706 105, 3, 190, 227, 192, 359, 21, 306, 307, 11,
707 12, 103, 103, 103, 368, 107, 107, 107, 44, 45,
708 22, 339, 24, 103, 26, 38, 206, 107, 106, 20,
709 69, 103, 58, 59, 36, 107, 224, 39, 13, 14,
710 110, 43, 11, 12, 46, 233, 94, 95, 79, 40,
711 79, 42, 78, 50, 56, 96, 97, 79, 84, 61,
712 51, 63, 3, 65, 110, 3, 102, 93, 102, 102,
713 108, 108, 74, 75, 100, 35, 102, 8, 9, 10,
714 11, 12, 102, 66, 102, 102, 3, 89, 8, 110,
715 25, 110, 104, 66, 104, 66, 30, 103, 107, 107,
716 102, 104, 98, 102, 4, 93, 294, 86, 296, 109,
717 105, 101, 104, 102, 294, 100, 103, 111, 306, 307,
718 4, 309, 310, 99, 80, 105, 6, 307, 8, 9,
719 10, 112, 110, 321, 6, 107, 8, 9, 10, 105,
720 102, 111, 22, 0, 24, 0, 26, 105, 105, 3,
721 13, 128, 25, 108, 53, 343, 36, 70, 104, 39,
722 62, 309, 292, 43, 44, 353, 46, 153, 226, 357,
723 368, 222, 44, 45, 296, 326, 56, 270, 58, 59,
724 267, 61, 353, 63, 185, 65, 58, 59, 272, 343,
725 306, 238, 347, -1, 74, 75, -1, -1, -1, -1,
726 -1, -1, -1, -1, 84, -1, 78, -1, -1, 89,
727 8, -1, 84, 11, 12, -1, -1, -1, -1, -1,
728 18, 93, 102, -1, 22, 23, 24, -1, 26, 27,
729 102, -1, -1, -1, -1, -1, -1, -1, 36, -1,
730 -1, 39, -1, -1, -1, 43, -1, -1, 46, 47,
731 48, 49, -1, -1, -1, -1, -1, 55, 56, 57,
732 -1, -1, -1, 61, 62, 63, 64, 65, -1, 8,
733 -1, -1, 11, 12, 72, -1, 74, 75, 76, 77,
734 -1, -1, -1, 81, 23, 83, -1, -1, -1, -1,
735 88, 89, 90, 91, 92, -1, -1, -1, -1, -1,
736 -1, -1, 41, -1, -1, -1, -1, -1, 47, 48,
737 49, -1, -1, -1, 53, -1, -1, -1, 57, -1,
738 -1, -1, -1, 62, -1, 64, -1, -1, -1, -1,
739 -1, -1, -1, 72, -1, -1, -1, -1, -1, -1,
740 -1, -1, 81, -1, 83, -1, -1, -1, -1, 88,
741 -1, 90, 91, 92, 11, 12, 13, 14, -1, -1,
742 -1, 18, -1, -1, -1, 22, 23, 24, -1, 26,
743 27, -1, -1, -1, -1, -1, 33, -1, -1, 36,
744 -1, -1, 39, -1, -1, -1, 43, -1, -1, 46,
745 47, 48, 49, -1, -1, -1, -1, -1, 55, 56,
746 57, -1, -1, -1, 61, 62, 63, 64, 65, -1,
747 67, -1, -1, -1, -1, 72, -1, 74, 75, 76,
748 77, -1, -1, -1, 81, -1, 83, -1, -1, 11,
749 12, 88, 89, 90, 91, 92, 18, -1, -1, -1,
750 22, 23, 24, -1, 26, 27, -1, -1, -1, -1,
751 -1, -1, -1, -1, 36, -1, -1, 39, -1, -1,
752 -1, 43, -1, -1, 46, 47, 48, 49, -1, -1,
753 -1, -1, -1, 55, 56, 57, -1, -1, -1, 61,
754 62, 63, 64, 65, -1, -1, -1, -1, -1, -1,
755 72, -1, 74, 75, 76, 77, -1, -1, -1, 81,
756 -1, 83, -1, 85, 11, 12, 88, 89, 90, 91,
757 92, 18, -1, -1, -1, 22, 23, 24, -1, 26,
758 27, -1, -1, -1, -1, -1, -1, -1, -1, 36,
759 -1, -1, 39, -1, -1, -1, 43, -1, -1, 46,
760 47, 48, 49, -1, -1, -1, -1, -1, 55, 56,
761 57, -1, -1, -1, 61, 62, 63, 64, 65, -1,
762 -1, -1, 11, 12, -1, 72, -1, 74, 75, 76,
763 77, -1, -1, 22, 81, 24, 83, 26, 11, 12,
764 -1, 88, 89, 90, 91, 92, -1, 36, -1, 22,
765 39, 24, -1, 26, 43, -1, -1, 46, -1, -1,
766 -1, -1, -1, 36, -1, -1, 39, 56, -1, -1,
767 43, -1, 61, 46, 63, -1, 65, -1, -1, -1,
768 -1, -1, -1, 56, -1, 74, 75, -1, 61, -1,
769 63, -1, 65, -1, -1, -1, -1, -1, -1, -1,
770 89, 74, 75, -1, -1, -1, -1, -1, -1, -1,
771 -1, -1, -1, -1, -1, -1, 89
772};
773/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
774#line 3 "/usr/share/bison.simple"
775/* This file comes from bison-1.28. */
776
777/* Skeleton output parser for bison,
778 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
779
780 This program is free software; you can redistribute it and/or modify
781 it under the terms of the GNU General Public License as published by
782 the Free Software Foundation; either version 2, or (at your option)
783 any later version.
784
785 This program is distributed in the hope that it will be useful,
786 but WITHOUT ANY WARRANTY; without even the implied warranty of
787 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
788 GNU General Public License for more details.
789
790 You should have received a copy of the GNU General Public License
791 along with this program; if not, write to the Free Software
792 Foundation, Inc., 59 Temple Place - Suite 330,
793 Boston, MA 02111-1307, USA. */
794
795/* As a special exception, when this file is copied by Bison into a
796 Bison output file, you may use that output file without restriction.
797 This special exception was added by the Free Software Foundation
798 in version 1.24 of Bison. */
799
800/* This is the parser code that is written into each bison parser
801 when the %semantic_parser declaration is not specified in the grammar.
802 It was written by Richard Stallman by simplifying the hairy parser
803 used when %semantic_parser is specified. */
804
805#ifndef YYSTACK_USE_ALLOCA
806#ifdef alloca
807#define YYSTACK_USE_ALLOCA
808#else /* alloca not defined */
809#ifdef __GNUC__
810#define YYSTACK_USE_ALLOCA
811#define alloca __builtin_alloca
812#else /* not GNU C. */
813#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
814#define YYSTACK_USE_ALLOCA
815#include <alloca.h>
816#else /* not sparc */
817/* We think this test detects Watcom and Microsoft C. */
818/* This used to test MSDOS, but that is a bad idea
819 since that symbol is in the user namespace. */
820#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
821#if 0 /* No need for malloc.h, which pollutes the namespace;
822 instead, just don't use alloca. */
823#include <malloc.h>
824#endif
825#else /* not MSDOS, or __TURBOC__ */
826#if defined(_AIX)
827/* I don't know what this was needed for, but it pollutes the namespace.
828 So I turned it off. rms, 2 May 1997. */
829/* #include <malloc.h> */
830 #pragma alloca
831#define YYSTACK_USE_ALLOCA
832#else /* not MSDOS, or __TURBOC__, or _AIX */
833#if 0
834#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
835 and on HPUX 10. Eventually we can turn this on. */
836#define YYSTACK_USE_ALLOCA
837#define alloca __builtin_alloca
838#endif /* __hpux */
839#endif
840#endif /* not _AIX */
841#endif /* not MSDOS, or __TURBOC__ */
842#endif /* not sparc */
843#endif /* not GNU C */
844#endif /* alloca not defined */
845#endif /* YYSTACK_USE_ALLOCA not defined */
846
847#ifdef YYSTACK_USE_ALLOCA
848#define YYSTACK_ALLOC alloca
849#else
850#define YYSTACK_ALLOC malloc
851#endif
852
853/* Note: there must be only one dollar sign in this file.
854 It is replaced by the list of actions, each action
855 as one case of the switch. */
856
857#define yyerrok (yyerrstatus = 0)
858#define yyclearin (yychar = YYEMPTY)
859#define YYEMPTY -2
860#define YYEOF 0
861#define YYACCEPT goto yyacceptlab
862#define YYABORT goto yyabortlab
863#define YYERROR goto yyerrlab1
864/* Like YYERROR except do call yyerror.
865 This remains here temporarily to ease the
866 transition to the new meaning of YYERROR, for GCC.
867 Once GCC version 2 has supplanted version 1, this can go. */
868#define YYFAIL goto yyerrlab
869#define YYRECOVERING() (!!yyerrstatus)
870#define YYBACKUP(token, value) \
871do \
872 if (yychar == YYEMPTY && yylen == 1) \
873 { yychar = (token), yylval = (value); \
874 yychar1 = YYTRANSLATE (yychar); \
875 YYPOPSTACK; \
876 goto yybackup; \
877 } \
878 else \
879 { yyerror ("syntax error: cannot back up"); YYERROR; } \
880while (0)
881
882#define YYTERROR 1
883#define YYERRCODE 256
884
885#ifndef YYPURE
886#define YYLEX yylex()
887#endif
888
889#ifdef YYPURE
890#ifdef YYLSP_NEEDED
891#ifdef YYLEX_PARAM
892#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
893#else
894#define YYLEX yylex(&yylval, &yylloc)
895#endif
896#else /* not YYLSP_NEEDED */
897#ifdef YYLEX_PARAM
898#define YYLEX yylex(&yylval, YYLEX_PARAM)
899#else
900#define YYLEX yylex(&yylval)
901#endif
902#endif /* not YYLSP_NEEDED */
903#endif
904
905/* If nonreentrant, generate the variables here */
906
907#ifndef YYPURE
908
909int yychar; /* the lookahead symbol */
910YYSTYPE yylval; /* the semantic value of the */
911 /* lookahead symbol */
912
913#ifdef YYLSP_NEEDED
914YYLTYPE yylloc; /* location data for the lookahead */
915 /* symbol */
916#endif
917
918int yynerrs; /* number of parse errors so far */
919#endif /* not YYPURE */
920
921#if YYDEBUG != 0
922int yydebug; /* nonzero means print parse trace */
923/* Since this is uninitialized, it does not stop multiple parsers
924 from coexisting. */
925#endif
926
927/* YYINITDEPTH indicates the initial size of the parser's stacks */
928
929#ifndef YYINITDEPTH
930#define YYINITDEPTH 200
931#endif
932
933/* YYMAXDEPTH is the maximum size the stacks can grow to
934 (effective only if the built-in stack extension method is used). */
935
936#if YYMAXDEPTH == 0
937#undef YYMAXDEPTH
938#endif
939
940#ifndef YYMAXDEPTH
941#define YYMAXDEPTH 10000
942#endif
943
944/* Define __yy_memcpy. Note that the size argument
945 should be passed with type unsigned int, because that is what the non-GCC
946 definitions require. With GCC, __builtin_memcpy takes an arg
947 of type size_t, but it can handle unsigned int. */
948
949#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
950#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
951#else /* not GNU C or C++ */
952#ifndef __cplusplus
953
954/* This is the most reliable way to avoid incompatibilities
955 in available built-in functions on various systems. */
956static void
957__yy_memcpy (to, from, count)
958 char *to;
959 char *from;
960 unsigned int count;
961{
962 register char *f = from;
963 register char *t = to;
964 register int i = count;
965
966 while (i-- > 0)
967 *t++ = *f++;
968}
969
970#else /* __cplusplus */
971
972/* This is the most reliable way to avoid incompatibilities
973 in available built-in functions on various systems. */
974static void
975__yy_memcpy (char *to, char *from, unsigned int count)
976{
977 register char *t = to;
978 register char *f = from;
979 register int i = count;
980
981 while (i-- > 0)
982 *t++ = *f++;
983}
984
985#endif
986#endif
987
988#line 217 "/usr/share/bison.simple"
989
990/* The user can define YYPARSE_PARAM as the name of an argument to be passed
991 into yyparse. The argument should have type void *.
992 It should actually point to an object.
993 Grammar actions can access the variable by casting it
994 to the proper pointer type. */
995
996#ifdef YYPARSE_PARAM
997#ifdef __cplusplus
998#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
999#define YYPARSE_PARAM_DECL
1000#else /* not __cplusplus */
1001#define YYPARSE_PARAM_ARG YYPARSE_PARAM
1002#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
1003#endif /* not __cplusplus */
1004#else /* not YYPARSE_PARAM */
1005#define YYPARSE_PARAM_ARG
1006#define YYPARSE_PARAM_DECL
1007#endif /* not YYPARSE_PARAM */
1008
1009/* Prevent warning if -Wstrict-prototypes. */
1010#ifdef __GNUC__
1011#ifdef YYPARSE_PARAM
1012int yyparse (void *);
1013#else
1014int yyparse (void);
1015#endif
1016#endif
1017
1018int
1019yyparse(YYPARSE_PARAM_ARG)
1020 YYPARSE_PARAM_DECL
1021{
1022 register int yystate;
1023 register int yyn;
1024 register short *yyssp;
1025 register YYSTYPE *yyvsp;
1026 int yyerrstatus; /* number of tokens to shift before error messages enabled */
1027 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
1028
1029 short yyssa[YYINITDEPTH]; /* the state stack */
1030 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
1031
1032 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
1033 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
1034
1035#ifdef YYLSP_NEEDED
1036 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
1037 YYLTYPE *yyls = yylsa;
1038 YYLTYPE *yylsp;
1039
1040#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
1041#else
1042#define YYPOPSTACK (yyvsp--, yyssp--)
1043#endif
1044
1045 int yystacksize = YYINITDEPTH;
1046 int yyfree_stacks = 0;
1047
1048#ifdef YYPURE
1049 int yychar;
1050 YYSTYPE yylval;
1051 int yynerrs;
1052#ifdef YYLSP_NEEDED
1053 YYLTYPE yylloc;
1054#endif
1055#endif
1056
1057 YYSTYPE yyval; /* the variable used to return */
1058 /* semantic values from the action */
1059 /* routines */
1060
1061 int yylen;
1062
1063#if YYDEBUG != 0
1064 if (yydebug)
1065 fprintf(stderr, "Starting parse\n");
1066#endif
1067
1068 yystate = 0;
1069 yyerrstatus = 0;
1070 yynerrs = 0;
1071 yychar = YYEMPTY; /* Cause a token to be read. */
1072
1073 /* Initialize stack pointers.
1074 Waste one element of value and location stack
1075 so that they stay on the same level as the state stack.
1076 The wasted elements are never initialized. */
1077
1078 yyssp = yyss - 1;
1079 yyvsp = yyvs;
1080#ifdef YYLSP_NEEDED
1081 yylsp = yyls;
1082#endif
1083
1084/* Push a new state, which is found in yystate . */
1085/* In all cases, when you get here, the value and location stacks
1086 have just been pushed. so pushing a state here evens the stacks. */
1087yynewstate:
1088
1089 *++yyssp = yystate;
1090
1091 if (yyssp >= yyss + yystacksize - 1)
1092 {
1093 /* Give user a chance to reallocate the stack */
1094 /* Use copies of these so that the &'s don't force the real ones into memory. */
1095 YYSTYPE *yyvs1 = yyvs;
1096 short *yyss1 = yyss;
1097#ifdef YYLSP_NEEDED
1098 YYLTYPE *yyls1 = yyls;
1099#endif
1100
1101 /* Get the current used size of the three stacks, in elements. */
1102 int size = yyssp - yyss + 1;
1103
1104#ifdef yyoverflow
1105 /* Each stack pointer address is followed by the size of
1106 the data in use in that stack, in bytes. */
1107#ifdef YYLSP_NEEDED
1108 /* This used to be a conditional around just the two extra args,
1109 but that might be undefined if yyoverflow is a macro. */
1110 yyoverflow("parser stack overflow",
1111 &yyss1, size * sizeof (*yyssp),
1112 &yyvs1, size * sizeof (*yyvsp),
1113 &yyls1, size * sizeof (*yylsp),
1114 &yystacksize);
1115#else
1116 yyoverflow("parser stack overflow",
1117 &yyss1, size * sizeof (*yyssp),
1118 &yyvs1, size * sizeof (*yyvsp),
1119 &yystacksize);
1120#endif
1121
1122 yyss = yyss1; yyvs = yyvs1;
1123#ifdef YYLSP_NEEDED
1124 yyls = yyls1;
1125#endif
1126#else /* no yyoverflow */
1127 /* Extend the stack our own way. */
1128 if (yystacksize >= YYMAXDEPTH)
1129 {
1130 yyerror("parser stack overflow");
1131 if (yyfree_stacks)
1132 {
1133 free (yyss);
1134 free (yyvs);
1135#ifdef YYLSP_NEEDED
1136 free (yyls);
1137#endif
1138 }
1139 return 2;
1140 }
1141 yystacksize *= 2;
1142 if (yystacksize > YYMAXDEPTH)
1143 yystacksize = YYMAXDEPTH;
1144#ifndef YYSTACK_USE_ALLOCA
1145 yyfree_stacks = 1;
1146#endif
1147 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
1148 __yy_memcpy ((char *)yyss, (char *)yyss1,
1149 size * (unsigned int) sizeof (*yyssp));
1150 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
1151 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
1152 size * (unsigned int) sizeof (*yyvsp));
1153#ifdef YYLSP_NEEDED
1154 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
1155 __yy_memcpy ((char *)yyls, (char *)yyls1,
1156 size * (unsigned int) sizeof (*yylsp));
1157#endif
1158#endif /* no yyoverflow */
1159
1160 yyssp = yyss + size - 1;
1161 yyvsp = yyvs + size - 1;
1162#ifdef YYLSP_NEEDED
1163 yylsp = yyls + size - 1;
1164#endif
1165
1166#if YYDEBUG != 0
1167 if (yydebug)
1168 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1169#endif
1170
1171 if (yyssp >= yyss + yystacksize - 1)
1172 YYABORT;
1173 }
1174
1175#if YYDEBUG != 0
1176 if (yydebug)
1177 fprintf(stderr, "Entering state %d\n", yystate);
1178#endif
1179
1180 goto yybackup;
1181 yybackup:
1182
1183/* Do appropriate processing given the current state. */
1184/* Read a lookahead token if we need one and don't already have one. */
1185/* yyresume: */
1186
1187 /* First try to decide what to do without reference to lookahead token. */
1188
1189 yyn = yypact[yystate];
1190 if (yyn == YYFLAG)
1191 goto yydefault;
1192
1193 /* Not known => get a lookahead token if don't already have one. */
1194
1195 /* yychar is either YYEMPTY or YYEOF
1196 or a valid token in external form. */
1197
1198 if (yychar == YYEMPTY)
1199 {
1200#if YYDEBUG != 0
1201 if (yydebug)
1202 fprintf(stderr, "Reading a token: ");
1203#endif
1204 yychar = YYLEX;
1205 }
1206
1207 /* Convert token to internal form (in yychar1) for indexing tables with */
1208
1209 if (yychar <= 0) /* This means end of input. */
1210 {
1211 yychar1 = 0;
1212 yychar = YYEOF; /* Don't call YYLEX any more */
1213
1214#if YYDEBUG != 0
1215 if (yydebug)
1216 fprintf(stderr, "Now at end of input.\n");
1217#endif
1218 }
1219 else
1220 {
1221 yychar1 = YYTRANSLATE(yychar);
1222
1223#if YYDEBUG != 0
1224 if (yydebug)
1225 {
1226 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
1227 /* Give the individual parser a way to print the precise meaning
1228 of a token, for further debugging info. */
1229#ifdef YYPRINT
1230 YYPRINT (stderr, yychar, yylval);
1231#endif
1232 fprintf (stderr, ")\n");
1233 }
1234#endif
1235 }
1236
1237 yyn += yychar1;
1238 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
1239 goto yydefault;
1240
1241 yyn = yytable[yyn];
1242
1243 /* yyn is what to do for this token type in this state.
1244 Negative => reduce, -yyn is rule number.
1245 Positive => shift, yyn is new state.
1246 New state is final state => don't bother to shift,
1247 just return success.
1248 0, or most negative number => error. */
1249
1250 if (yyn < 0)
1251 {
1252 if (yyn == YYFLAG)
1253 goto yyerrlab;
1254 yyn = -yyn;
1255 goto yyreduce;
1256 }
1257 else if (yyn == 0)
1258 goto yyerrlab;
1259
1260 if (yyn == YYFINAL)
1261 YYACCEPT;
1262
1263 /* Shift the lookahead token. */
1264
1265#if YYDEBUG != 0
1266 if (yydebug)
1267 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1268#endif
1269
1270 /* Discard the token being shifted unless it is eof. */
1271 if (yychar != YYEOF)
1272 yychar = YYEMPTY;
1273
1274 *++yyvsp = yylval;
1275#ifdef YYLSP_NEEDED
1276 *++yylsp = yylloc;
1277#endif
1278
1279 /* count tokens shifted since error; after three, turn off error status. */
1280 if (yyerrstatus) yyerrstatus--;
1281
1282 yystate = yyn;
1283 goto yynewstate;
1284
1285/* Do the default action for the current state. */
1286yydefault:
1287
1288 yyn = yydefact[yystate];
1289 if (yyn == 0)
1290 goto yyerrlab;
1291
1292/* Do a reduction. yyn is the number of a rule to reduce with. */
1293yyreduce:
1294 yylen = yyr2[yyn];
1295 if (yylen > 0)
1296 yyval = yyvsp[1-yylen]; /* implement default value of the action */
1297
1298#if YYDEBUG != 0
1299 if (yydebug)
1300 {
1301 int i;
1302
1303 fprintf (stderr, "Reducing via rule %d (line %d), ",
1304 yyn, yyrline[yyn]);
1305
1306 /* Print the symbols being reduced, and their result. */
1307 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
1308 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
1309 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1310 }
1311#endif
1312
1313
1314 switch (yyn) {
1315
1316case 1:
1317#line 298 "asn1p_y.y"
1318{
1319 *(void **)param = yyvsp[0].a_grammar;
1320 ;
1321 break;}
1322case 2:
1323#line 304 "asn1p_y.y"
1324{
1325 yyval.a_grammar = asn1p_new();
1326 checkmem(yyval.a_grammar);
1327 TQ_ADD(&(yyval.a_grammar->modules), yyvsp[0].a_module, mod_next);
1328 ;
1329 break;}
1330case 3:
1331#line 309 "asn1p_y.y"
1332{
1333 yyval.a_grammar = yyvsp[-1].a_grammar;
1334 TQ_ADD(&(yyval.a_grammar->modules), yyvsp[0].a_module, mod_next);
1335 ;
1336 break;}
1337case 4:
1338#line 330 "asn1p_y.y"
1339{
1340
1341 if(yyvsp[-1].a_module) {
1342 yyval.a_module = yyvsp[-1].a_module;
1343 } else {
1344 /* There's a chance that a module is just plain empty */
1345 yyval.a_module = asn1p_module_new();
1346 }
1347 checkmem(yyval.a_module);
1348
1349 yyval.a_module->Identifier = yyvsp[-7].tv_str;
1350 yyval.a_module->module_oid = yyvsp[-6].a_oid;
1351 yyval.a_module->module_flags = yyvsp[-4].a_module_flags;
1352 ;
1353 break;}
1354case 5:
1355#line 351 "asn1p_y.y"
1356{ yyval.a_oid = 0; ;
1357 break;}
1358case 6:
1359#line 352 "asn1p_y.y"
1360{ yyval.a_oid = yyvsp[0].a_oid; ;
1361 break;}
1362case 7:
1363#line 356 "asn1p_y.y"
1364{
1365 yyval.a_oid = yyvsp[-1].a_oid;
1366 ;
1367 break;}
1368case 8:
1369#line 359 "asn1p_y.y"
1370{
1371 yyval.a_oid = 0;
1372 ;
1373 break;}
1374case 9:
1375#line 365 "asn1p_y.y"
1376{
1377 yyval.a_oid = asn1p_oid_new();
1378 asn1p_oid_add_arc(yyval.a_oid, &yyvsp[0].a_oid_arc);
1379 if(yyvsp[0].a_oid_arc.name)
1380 free(yyvsp[0].a_oid_arc.name);
1381 ;
1382 break;}
1383case 10:
1384#line 371 "asn1p_y.y"
1385{
1386 yyval.a_oid = yyvsp[-1].a_oid;
1387 asn1p_oid_add_arc(yyval.a_oid, &yyvsp[0].a_oid_arc);
1388 if(yyvsp[0].a_oid_arc.name)
1389 free(yyvsp[0].a_oid_arc.name);
1390 ;
1391 break;}
1392case 11:
1393#line 380 "asn1p_y.y"
1394{ /* iso */
1395 yyval.a_oid_arc.name = yyvsp[0].tv_str;
1396 yyval.a_oid_arc.number = -1;
1397 ;
1398 break;}
1399case 12:
1400#line 384 "asn1p_y.y"
1401{ /* iso(1) */
1402 yyval.a_oid_arc.name = yyvsp[-3].tv_str;
1403 yyval.a_oid_arc.number = yyvsp[-1].a_int;
1404 ;
1405 break;}
1406case 13:
1407#line 388 "asn1p_y.y"
1408{ /* 1 */
1409 yyval.a_oid_arc.name = 0;
1410 yyval.a_oid_arc.number = yyvsp[0].a_int;
1411 ;
1412 break;}
1413case 14:
1414#line 398 "asn1p_y.y"
1415{ yyval.a_module_flags = MSF_NOFLAGS; ;
1416 break;}
1417case 15:
1418#line 399 "asn1p_y.y"
1419{
1420 yyval.a_module_flags = yyvsp[0].a_module_flags;
1421 ;
1422 break;}
1423case 16:
1424#line 408 "asn1p_y.y"
1425{
1426 yyval.a_module_flags = yyvsp[0].a_module_flags;
1427 ;
1428 break;}
1429case 17:
1430#line 411 "asn1p_y.y"
1431{
1432 yyval.a_module_flags = yyvsp[-1].a_module_flags | yyvsp[0].a_module_flags;
1433 ;
1434 break;}
1435case 18:
1436#line 420 "asn1p_y.y"
1437{
1438 yyval.a_module_flags = MSF_EXPLICIT_TAGS;
1439 ;
1440 break;}
1441case 19:
1442#line 423 "asn1p_y.y"
1443{
1444 yyval.a_module_flags = MSF_IMPLICIT_TAGS;
1445 ;
1446 break;}
1447case 20:
1448#line 426 "asn1p_y.y"
1449{
1450 yyval.a_module_flags = MSF_AUTOMATIC_TAGS;
1451 ;
1452 break;}
1453case 21:
1454#line 429 "asn1p_y.y"
1455{
1456 yyval.a_module_flags = MSF_EXTENSIBILITY_IMPLIED;
1457 ;
1458 break;}
1459case 22:
1460#line 438 "asn1p_y.y"
1461{ yyval.a_module = 0; ;
1462 break;}
1463case 23:
1464#line 439 "asn1p_y.y"
1465{
1466 assert(yyvsp[0].a_module);
1467 yyval.a_module = yyvsp[0].a_module;
1468 ;
1469 break;}
1470case 24:
1471#line 449 "asn1p_y.y"
1472{
1473 yyval.a_module = yyvsp[0].a_module;
1474 ;
1475 break;}
1476case 25:
1477#line 452 "asn1p_y.y"
1478{
1479 yyval.a_module = yyvsp[-1].a_module;
1480
1481#ifdef MY_IMPORT
1482#error MY_IMPORT DEFINED ELSEWHERE!
1483#endif
1484#define MY_IMPORT(foo,field) do { \
1485 if(TQ_FIRST(&(yyvsp[0].a_module->foo))) { \
1486 TQ_ADD(&(yyval.a_module->foo), \
1487 TQ_REMOVE(&(yyvsp[0].a_module->foo), field), \
1488 field); \
1489 assert(TQ_FIRST(&(yyvsp[0].a_module->foo)) == 0); \
1490 } } while(0)
1491
1492 MY_IMPORT(imports, xp_next);
1493 MY_IMPORT(exports, xp_next);
1494 MY_IMPORT(members, next);
1495#undef MY_IMPORT
1496
1497 ;
1498 break;}
1499case 26:
1500#line 478 "asn1p_y.y"
1501{
1502 yyval.a_module = yyvsp[0].a_module;
1503 ;
1504 break;}
1505case 27:
1506#line 481 "asn1p_y.y"
1507{
1508 yyval.a_module = asn1p_module_new();
1509 checkmem(yyval.a_module);
1510 if(yyvsp[0].a_xports) {
1511 TQ_ADD(&(yyval.a_module->exports), yyvsp[0].a_xports, xp_next);
1512 } else {
1513 /* "EXPORTS ALL;" ? */
1514 }
1515 ;
1516 break;}
1517case 28:
1518#line 490 "asn1p_y.y"
1519{
1520 yyval.a_module = asn1p_module_new();
1521 checkmem(yyval.a_module);
1522 assert(yyvsp[0].a_expr->expr_type != A1TC_INVALID);
1523 assert(yyvsp[0].a_expr->meta_type != AMT_INVALID);
1524 TQ_ADD(&(yyval.a_module->members), yyvsp[0].a_expr, next);
1525 ;
1526 break;}
1527case 29:
1528#line 497 "asn1p_y.y"
1529{
1530 yyval.a_module = asn1p_module_new();
1531 checkmem(yyval.a_module);
1532 assert(yyvsp[0].a_expr->expr_type != A1TC_INVALID);
1533 assert(yyvsp[0].a_expr->meta_type != AMT_INVALID);
1534 TQ_ADD(&(yyval.a_module->members), yyvsp[0].a_expr, next);
1535 ;
1536 break;}
1537case 30:
1538#line 510 "asn1p_y.y"
1539{
1540 yyval.a_module = asn1p_module_new();
1541 checkmem(yyval.a_module);
1542 assert(yyvsp[0].a_expr->expr_type != A1TC_INVALID);
1543 assert(yyvsp[0].a_expr->meta_type != AMT_INVALID);
1544 TQ_ADD(&(yyval.a_module->members), yyvsp[0].a_expr, next);
1545 ;
1546 break;}
1547case 31:
1548#line 521 "asn1p_y.y"
1549{
1550 return yyerror(
1551 "Attempt to redefine a standard basic type, "
1552 "use -ftypesXY to switch back "
1553 "to older version of ASN.1 standard");
1554 ;
1555 break;}
1556case 32:
1557#line 535 "asn1p_y.y"
1558{
1559 yyval.a_module = yyvsp[-1].a_module;
1560 ;
1561 break;}
1562case 33:
1563#line 541 "asn1p_y.y"
1564{
1565 return yyerror("Empty IMPORTS list");
1566 ;
1567 break;}
1568case 34:
1569#line 547 "asn1p_y.y"
1570{
1571 yyval.a_module = asn1p_module_new();
1572 checkmem(yyval.a_module);
1573 TQ_ADD(&(yyval.a_module->imports), yyvsp[0].a_xports, xp_next);
1574 ;
1575 break;}
1576case 35:
1577#line 552 "asn1p_y.y"
1578{
1579 yyval.a_module = yyvsp[-1].a_module;
1580 TQ_ADD(&(yyval.a_module->imports), yyvsp[0].a_xports, xp_next);
1581 ;
1582 break;}
1583case 36:
1584#line 559 "asn1p_y.y"
1585{
1586 yyval.a_xports = yyvsp[-3].a_xports;
1587 yyval.a_xports->from = yyvsp[-1].tv_str;
1588 yyval.a_xports->from_oid = yyvsp[0].a_oid;
1589 checkmem(yyval.a_xports);
1590 ;
1591 break;}
1592case 37:
1593#line 568 "asn1p_y.y"
1594{
1595 yyval.a_xports = asn1p_xports_new();
1596 checkmem(yyval.a_xports);
1597 TQ_ADD(&(yyval.a_xports->members), yyvsp[0].a_expr, next);
1598 ;
1599 break;}
1600case 38:
1601#line 573 "asn1p_y.y"
1602{
1603 yyval.a_xports = yyvsp[-2].a_xports;
1604 TQ_ADD(&(yyval.a_xports->members), yyvsp[0].a_expr, next);
1605 ;
1606 break;}
1607case 39:
1608#line 580 "asn1p_y.y"
1609{
1610 yyval.a_expr = asn1p_expr_new(yylineno);
1611 checkmem(yyval.a_expr);
1612 yyval.a_expr->Identifier = yyvsp[0].tv_str;
1613 yyval.a_expr->expr_type = A1TC_REFERENCE;
1614 ;
1615 break;}
1616case 40:
1617#line 586 "asn1p_y.y"
1618{
1619 yyval.a_expr = asn1p_expr_new(yylineno);
1620 checkmem(yyval.a_expr);
1621 yyval.a_expr->Identifier = yyvsp[0].tv_str;
1622 yyval.a_expr->expr_type = A1TC_REFERENCE;
1623 ;
1624 break;}
1625case 41:
1626#line 595 "asn1p_y.y"
1627{
1628 yyval.a_xports = yyvsp[-1].a_xports;
1629 ;
1630 break;}
1631case 42:
1632#line 598 "asn1p_y.y"
1633{
1634 yyval.a_xports = 0;
1635 ;
1636 break;}
1637case 43:
1638#line 601 "asn1p_y.y"
1639{
1640 /* Empty EXPORTS clause effectively prohibits export. */
1641 yyval.a_xports = asn1p_xports_new();
1642 checkmem(yyval.a_xports);
1643 ;
1644 break;}
1645case 44:
1646#line 609 "asn1p_y.y"
1647{
1648 yyval.a_xports = asn1p_xports_new();
1649 assert(yyval.a_xports);
1650 TQ_ADD(&(yyval.a_xports->members), yyvsp[0].a_expr, next);
1651 ;
1652 break;}
1653case 45:
1654#line 614 "asn1p_y.y"
1655{
1656 yyval.a_xports = yyvsp[-2].a_xports;
1657 TQ_ADD(&(yyval.a_xports->members), yyvsp[0].a_expr, next);
1658 ;
1659 break;}
1660case 46:
1661#line 621 "asn1p_y.y"
1662{
1663 yyval.a_expr = asn1p_expr_new(yylineno);
1664 checkmem(yyval.a_expr);
1665 yyval.a_expr->Identifier = yyvsp[0].tv_str;
1666 yyval.a_expr->expr_type = A1TC_EXPORTVAR;
1667 ;
1668 break;}
1669case 47:
1670#line 627 "asn1p_y.y"
1671{
1672 yyval.a_expr = asn1p_expr_new(yylineno);
1673 checkmem(yyval.a_expr);
1674 yyval.a_expr->Identifier = yyvsp[0].tv_str;
1675 yyval.a_expr->expr_type = A1TC_EXPORTVAR;
1676 ;
1677 break;}
1678case 48:
1679#line 637 "asn1p_y.y"
1680{
1681 yyval.a_expr = yyvsp[-4].a_expr;
1682 assert(yyval.a_expr->Identifier == 0);
1683 yyval.a_expr->Identifier = yyvsp[-5].tv_str;
1684 yyval.a_expr->meta_type = AMT_VALUESET;
1685 // take care of optValueSetBody
1686 ;
1687 break;}
1688case 49:
1689#line 647 "asn1p_y.y"
1690{
1691 yyval.a_expr = asn1p_expr_new(yylineno);
1692 checkmem(yyval.a_expr);
1693 yyval.a_expr->reference = yyvsp[0].a_ref;
1694 yyval.a_expr->expr_type = A1TC_REFERENCE;
1695 yyval.a_expr->meta_type = AMT_TYPEREF;
1696 ;
1697 break;}
1698case 50:
1699#line 654 "asn1p_y.y"
1700{
1701 yyval.a_expr = asn1p_expr_new(yylineno);
1702 checkmem(yyval.a_expr);
1703 yyval.a_expr->expr_type = yyvsp[0].a_type;
1704 yyval.a_expr->meta_type = AMT_TYPE;
1705 ;
1706 break;}
1707case 51:
1708#line 663 "asn1p_y.y"
1709{ ;
1710 break;}
1711case 52:
1712#line 664 "asn1p_y.y"
1713{
1714 ;
1715 break;}
1716case 53:
1717#line 680 "asn1p_y.y"
1718{
1719 yyval.a_expr = asn1p_expr_new(yylineno);
1720 checkmem(yyval.a_expr);
1721 yyval.a_expr->Identifier = yyvsp[-3].tv_str;
1722 yyval.a_expr->tag = yyvsp[-1].a_tag;
1723 yyval.a_expr->expr_type = A1TC_TYPEID;
1724 yyval.a_expr->meta_type = AMT_TYPE;
1725 ;
1726 break;}
1727case 54:
1728#line 688 "asn1p_y.y"
1729{
1730 yyval.a_expr = yyvsp[0].a_expr;
1731 yyval.a_expr->Identifier = yyvsp[-3].tv_str;
1732 yyval.a_expr->tag = yyvsp[-1].a_tag;
1733 assert(yyval.a_expr->expr_type);
1734 assert(yyval.a_expr->meta_type);
1735 ;
1736 break;}
1737case 55:
1738#line 695 "asn1p_y.y"
1739{
1740 yyval.a_expr = yyvsp[0].a_expr;
1741 yyval.a_expr->Identifier = yyvsp[-2].tv_str;
1742 assert(yyval.a_expr->expr_type == A1TC_CLASSDEF);
1743 assert(yyval.a_expr->meta_type == AMT_OBJECT);
1744 ;
1745 break;}
1746case 56:
1747#line 712 "asn1p_y.y"
1748{
1749 yyval.a_expr = yyvsp[0].a_expr;
1750 assert(yyval.a_expr->Identifier == 0);
1751 yyval.a_expr->Identifier = yyvsp[-5].tv_str;
1752 yyval.a_expr->params = yyvsp[-3].a_plist;
1753 yyval.a_expr->meta_type = AMT_PARAMTYPE;
1754 ;
1755 break;}
1756case 57:
1757#line 722 "asn1p_y.y"
1758{
1759 int ret;
1760 yyval.a_plist = asn1p_paramlist_new(yylineno);
1761 checkmem(yyval.a_plist);
1762 ret = asn1p_paramlist_add_param(yyval.a_plist, yyvsp[0].a_parg.governor, yyvsp[0].a_parg.argument);
1763 checkmem(ret == 0);
1764 if(yyvsp[0].a_parg.governor) asn1p_ref_free(yyvsp[0].a_parg.governor);
1765 if(yyvsp[0].a_parg.argument) free(yyvsp[0].a_parg.argument);
1766 ;
1767 break;}
1768case 58:
1769#line 731 "asn1p_y.y"
1770{
1771 int ret;
1772 yyval.a_plist = yyvsp[-2].a_plist;
1773 ret = asn1p_paramlist_add_param(yyval.a_plist, yyvsp[0].a_parg.governor, yyvsp[0].a_parg.argument);
1774 checkmem(ret == 0);
1775 if(yyvsp[0].a_parg.governor) asn1p_ref_free(yyvsp[0].a_parg.governor);
1776 if(yyvsp[0].a_parg.argument) free(yyvsp[0].a_parg.argument);
1777 ;
1778 break;}
1779case 59:
1780#line 742 "asn1p_y.y"
1781{
1782 yyval.a_parg.governor = NULL;
1783 yyval.a_parg.argument = yyvsp[0].tv_str;
1784 ;
1785 break;}
1786case 60:
1787#line 746 "asn1p_y.y"
1788{
1789 int ret;
1790 yyval.a_parg.governor = asn1p_ref_new(yylineno);
1791 ret = asn1p_ref_add_component(yyval.a_parg.governor, yyvsp[-2].tv_str, 0);
1792 checkmem(ret == 0);
1793 yyval.a_parg.argument = yyvsp[0].tv_str;
1794 ;
1795 break;}
1796case 61:
1797#line 753 "asn1p_y.y"
1798{
1799 int ret;
1800 yyval.a_parg.governor = asn1p_ref_new(yylineno);
1801 ret = asn1p_ref_add_component(yyval.a_parg.governor,
1802 ASN_EXPR_TYPE2STR(yyvsp[-2].a_type), 1);
1803 checkmem(ret == 0);
1804 yyval.a_parg.argument = yyvsp[0].tv_str;
1805 ;
1806 break;}
1807case 62:
1808#line 764 "asn1p_y.y"
1809{
1810 yyval.a_expr = asn1p_expr_new(yylineno);
1811 checkmem(yyval.a_expr);
1812 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
1813 ;
1814 break;}
1815case 63:
1816#line 769 "asn1p_y.y"
1817{
1818 yyval.a_expr = yyvsp[-2].a_expr;
1819 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
1820 ;
1821 break;}
1822case 64:
1823#line 776 "asn1p_y.y"
1824{
1825 yyval.a_expr = yyvsp[0].a_expr;
1826 ;
1827 break;}
1828case 65:
1829#line 779 "asn1p_y.y"
1830{
1831 yyval.a_expr = asn1p_expr_new(yylineno);
1832 checkmem(yyval.a_expr);
1833 yyval.a_expr->Identifier = yyvsp[0].tv_str;
1834 yyval.a_expr->expr_type = A1TC_REFERENCE;
1835 yyval.a_expr->meta_type = AMT_VALUE;
1836 ;
1837 break;}
1838case 66:
1839#line 792 "asn1p_y.y"
1840{
1841 yyval.a_expr = asn1p_expr_new(yylineno);
1842 checkmem(yyval.a_expr);
1843 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
1844 ;
1845 break;}
1846case 67:
1847#line 797 "asn1p_y.y"
1848{
1849 yyval.a_expr = yyvsp[-2].a_expr;
1850 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
1851 ;
1852 break;}
1853case 68:
1854#line 804 "asn1p_y.y"
1855{
1856 yyval.a_expr = yyvsp[-2].a_expr;
1857 checkmem(yyval.a_expr);
1858 yyval.a_expr->with_syntax = yyvsp[0].a_wsynt;
1859 assert(yyval.a_expr->expr_type == A1TC_CLASSDEF);
1860 assert(yyval.a_expr->meta_type == AMT_OBJECT);
1861 ;
1862 break;}
1863case 69:
1864#line 814 "asn1p_y.y"
1865{ yyval.a_int = 0; ;
1866 break;}
1867case 70:
1868#line 815 "asn1p_y.y"
1869{ yyval.a_int = 1; ;
1870 break;}
1871case 71:
1872#line 819 "asn1p_y.y"
1873{
1874 yyval.a_expr = asn1p_expr_new(yylineno);
1875 checkmem(yyval.a_expr);
1876 yyval.a_expr->expr_type = A1TC_CLASSDEF;
1877 yyval.a_expr->meta_type = AMT_OBJECT;
1878 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
1879 ;
1880 break;}
1881case 72:
1882#line 826 "asn1p_y.y"
1883{
1884 yyval.a_expr = yyvsp[-2].a_expr;
1885 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
1886 ;
1887 break;}
1888case 73:
1889#line 833 "asn1p_y.y"
1890{
1891 yyval.a_expr = asn1p_expr_new(yylineno);
1892 checkmem(yyval.a_expr);
1893 yyval.a_expr->Identifier = yyvsp[-1].a_refcomp.name;
1894 yyval.a_expr->expr_type = A1TC_CLASSFIELD;
1895 yyval.a_expr->meta_type = AMT_OBJECTFIELD;
1896 yyval.a_expr->marker = yyvsp[0].a_marker;
1897 ;
1898 break;}
1899case 74:
1900#line 841 "asn1p_y.y"
1901{
1902 yyval.a_expr = yyvsp[-1].a_expr;
1903 yyval.a_expr->Identifier = yyvsp[-2].a_refcomp.name;
1904 yyval.a_expr->unique = yyvsp[0].a_int;
1905 ;
1906 break;}
1907case 75:
1908#line 846 "asn1p_y.y"
1909{
1910 int ret;
1911 yyval.a_expr = asn1p_expr_new(yylineno);
1912 checkmem(yyval.a_expr);
1913 yyval.a_expr->Identifier = yyvsp[-3].a_refcomp.name;
1914 yyval.a_expr->reference = asn1p_ref_new(yylineno);
1915 checkmem(yyval.a_expr->reference);
1916 ret = asn1p_ref_add_component(yyval.a_expr->reference,
1917 yyvsp[-2].a_refcomp.name, yyvsp[-2].a_refcomp.lex_type);
1918 checkmem(ret == 0);
1919 yyval.a_expr->expr_type = A1TC_CLASSFIELD;
1920 yyval.a_expr->meta_type = AMT_OBJECTFIELD;
1921 yyval.a_expr->marker = yyvsp[-1].a_marker;
1922 yyval.a_expr->unique = yyvsp[0].a_int;
1923 ;
1924 break;}
1925case 76:
1926#line 864 "asn1p_y.y"
1927{ yyval.a_wsynt = 0; ;
1928 break;}
1929case 77:
1930#line 865 "asn1p_y.y"
1931{
1932 yyval.a_wsynt = yyvsp[0].a_wsynt;
1933 ;
1934 break;}
1935case 78:
1936#line 872 "asn1p_y.y"
1937{ asn1p_lexer_hack_enable_with_syntax(); ;
1938 break;}
1939case 79:
1940#line 874 "asn1p_y.y"
1941{
1942 yyval.a_wsynt = yyvsp[-1].a_wsynt;
1943 ;
1944 break;}
1945case 80:
1946#line 880 "asn1p_y.y"
1947{
1948 yyval.a_wsynt = asn1p_wsyntx_new();
1949 TQ_ADD(&(yyval.a_wsynt->chunks), yyvsp[0].a_wchunk, next);
1950 ;
1951 break;}
1952case 81:
1953#line 884 "asn1p_y.y"
1954{
1955 yyval.a_wsynt = yyvsp[-1].a_wsynt;
1956 TQ_ADD(&(yyval.a_wsynt->chunks), yyvsp[0].a_wchunk, next);
1957 ;
1958 break;}
1959case 82:
1960#line 891 "asn1p_y.y"
1961{
1962 yyval.a_wchunk = asn1p_wsyntx_chunk_frombuf(yyvsp[0].tv_opaque.buf, yyvsp[0].tv_opaque.len, 0);
1963 ;
1964 break;}
1965case 83:
1966#line 894 "asn1p_y.y"
1967{
1968 asn1p_ref_t *ref;
1969 int ret;
1970 ref = asn1p_ref_new(yylineno);
1971 checkmem(ref);
1972 ret = asn1p_ref_add_component(ref, yyvsp[0].a_refcomp.name, yyvsp[0].a_refcomp.lex_type);
1973 checkmem(ret == 0);
1974 yyval.a_wchunk = asn1p_wsyntx_chunk_fromref(ref, 0);
1975 ;
1976 break;}
1977case 84:
1978#line 920 "asn1p_y.y"
1979{
1980 yyval.a_expr = yyvsp[0].a_expr;
1981 assert(yyval.a_expr->Identifier == 0);
1982 yyval.a_expr->Identifier = yyvsp[-1].tv_nametag.name;
1983 yyval.a_expr->tag = yyvsp[-1].tv_nametag.tag;
1984 ;
1985 break;}
1986case 85:
1987#line 926 "asn1p_y.y"
1988{
1989 yyval.a_expr = yyvsp[0].a_expr;
1990 ;
1991 break;}
1992case 86:
1993#line 932 "asn1p_y.y"
1994{
1995 yyval.a_expr = yyvsp[-2].a_expr;
1996 yyval.a_expr->constraints = yyvsp[-1].a_constr;
1997 yyval.a_expr->marker = yyvsp[0].a_marker;
1998 ;
1999 break;}
2000case 87:
2001#line 940 "asn1p_y.y"
2002{
2003 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2004 checkmem(yyval.a_expr);
2005 yyval.a_expr->Identifier = strdup("...");
2006 checkmem(yyval.a_expr->Identifier);
2007 yyval.a_expr->expr_type = A1TC_EXTENSIBLE;
2008 yyval.a_expr->meta_type = AMT_TYPE;
2009 ;
2010 break;}
2011case 88:
2012#line 948 "asn1p_y.y"
2013{
2014 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2015 checkmem(yyval.a_expr);
2016 yyval.a_expr->Identifier = strdup("...");
2017 checkmem(yyval.a_expr->Identifier);
2018 yyval.a_expr->value = yyvsp[0].a_value;
2019 yyval.a_expr->expr_type = A1TC_EXTENSIBLE;
2020 yyval.a_expr->meta_type = AMT_TYPE;
2021 ;
2022 break;}
2023case 89:
2024#line 957 "asn1p_y.y"
2025{
2026 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2027 checkmem(yyval.a_expr);
2028 yyval.a_expr->Identifier = strdup("...");
2029 yyval.a_expr->value = yyvsp[0].a_value;
2030 checkmem(yyval.a_expr->Identifier);
2031 yyval.a_expr->expr_type = A1TC_EXTENSIBLE;
2032 yyval.a_expr->meta_type = AMT_TYPE;
2033 ;
2034 break;}
2035case 90:
2036#line 969 "asn1p_y.y"
2037{
2038 yyval.a_expr = yyvsp[0].a_expr;
2039 ;
2040 break;}
2041case 91:
2042#line 972 "asn1p_y.y"
2043{
2044 yyval.a_expr = asn1p_expr_new(yylineno);
2045 checkmem(yyval.a_expr);
2046 yyval.a_expr->expr_type = yyvsp[0].a_type;
2047 yyval.a_expr->meta_type = AMT_TYPE;
2048 ;
2049 break;}
2050case 92:
2051#line 978 "asn1p_y.y"
2052{
2053 yyval.a_expr = yyvsp[0].a_expr;
2054 checkmem(yyval.a_expr);
2055 assert(yyval.a_expr->meta_type);
2056 ;
2057 break;}
2058case 93:
2059#line 986 "asn1p_y.y"
2060{
2061 int ret;
2062 yyval.a_expr = yyvsp[-1].a_expr;
2063 assert(yyval.a_expr->expr_type == 0);
2064 assert(yyval.a_expr->meta_type == 0);
2065 assert(yyval.a_expr->reference == 0);
2066 yyval.a_expr->reference = asn1p_ref_new(yylineno);
2067 checkmem(yyval.a_expr->reference);
2068 ret = asn1p_ref_add_component(yyval.a_expr->reference, yyvsp[-3].tv_str, RLT_UNKNOWN);
2069 checkmem(ret == 0);
2070 free(yyvsp[-3].tv_str);
2071 yyval.a_expr->expr_type = A1TC_PARAMETRIZED;
2072 yyval.a_expr->meta_type = AMT_TYPE;
2073 ;
2074 break;}
2075case 94:
2076#line 1010 "asn1p_y.y"
2077{
2078 yyval.a_expr = asn1p_expr_new(yylineno);
2079 checkmem(yyval.a_expr);
2080 yyval.a_expr->reference = yyvsp[0].a_ref;
2081 yyval.a_expr->expr_type = A1TC_REFERENCE;
2082 yyval.a_expr->meta_type = AMT_TYPEREF;
2083 ;
2084 break;}
2085case 95:
2086#line 1017 "asn1p_y.y"
2087{
2088 yyval.a_expr = asn1p_expr_new(yylineno);
2089 checkmem(yyval.a_expr);
2090 yyval.a_expr->reference = yyvsp[0].a_ref;
2091 yyval.a_expr->expr_type = A1TC_INSTANCE;
2092 yyval.a_expr->meta_type = AMT_TYPE;
2093 ;
2094 break;}
2095case 96:
2096#line 1032 "asn1p_y.y"
2097{
2098 int ret;
2099 yyval.a_ref = asn1p_ref_new(yylineno);
2100 checkmem(yyval.a_ref);
2101 ret = asn1p_ref_add_component(yyval.a_ref, yyvsp[0].tv_str, RLT_UNKNOWN);
2102 checkmem(ret == 0);
2103 free(yyvsp[0].tv_str);
2104 ;
2105 break;}
2106case 97:
2107#line 1040 "asn1p_y.y"
2108{
2109 int ret;
2110 yyval.a_ref = asn1p_ref_new(yylineno);
2111 checkmem(yyval.a_ref);
2112 ret = asn1p_ref_add_component(yyval.a_ref, yyvsp[-2].tv_str, RLT_UNKNOWN);
2113 checkmem(ret == 0);
2114 ret = asn1p_ref_add_component(yyval.a_ref, yyvsp[0].tv_str, RLT_UNKNOWN);
2115 checkmem(ret == 0);
2116 free(yyvsp[-2].tv_str);
2117 ;
2118 break;}
2119case 98:
2120#line 1050 "asn1p_y.y"
2121{
2122 int ret;
2123 yyval.a_ref = asn1p_ref_new(yylineno);
2124 checkmem(yyval.a_ref);
2125 ret = asn1p_ref_add_component(yyval.a_ref, yyvsp[-2].tv_str, RLT_UNKNOWN);
2126 checkmem(ret == 0);
2127 ret = asn1p_ref_add_component(yyval.a_ref, yyvsp[0].tv_str, RLT_lowercase);
2128 checkmem(ret == 0);
2129 free(yyvsp[-2].tv_str);
2130 ;
2131 break;}
2132case 99:
2133#line 1060 "asn1p_y.y"
2134{
2135 int ret;
2136 yyval.a_ref = asn1p_ref_new(yylineno);
2137 checkmem(yyval.a_ref);
2138 ret = asn1p_ref_add_component(yyval.a_ref, yyvsp[0].tv_str, RLT_CAPITALS);
2139 free(yyvsp[0].tv_str);
2140 checkmem(ret == 0);
2141 ;
2142 break;}
2143case 100:
2144#line 1068 "asn1p_y.y"
2145{
2146 int ret;
2147 yyval.a_ref = yyvsp[0].a_ref;
2148 ret = asn1p_ref_add_component(yyval.a_ref, yyvsp[-2].tv_str, RLT_CAPITALS);
2149 free(yyvsp[-2].tv_str);
2150 checkmem(ret == 0);
2151 /*
2152 * Move the last element infront.
2153 */
2154 {
2155 struct asn1p_ref_component_s tmp_comp;
2156 tmp_comp = yyval.a_ref->components[yyval.a_ref->comp_count-1];
2157 memmove(&yyval.a_ref->components[1],
2158 &yyval.a_ref->components[0],
2159 sizeof(yyval.a_ref->components[0])
2160 * (yyval.a_ref->comp_count - 1));
2161 yyval.a_ref->components[0] = tmp_comp;
2162 }
2163 ;
2164 break;}
2165case 101:
2166#line 1090 "asn1p_y.y"
2167{
2168 int ret;
2169 yyval.a_ref = asn1p_ref_new(yylineno);
2170 checkmem(yyval.a_ref);
2171 ret = asn1p_ref_add_component(yyval.a_ref, yyvsp[0].a_refcomp.name, yyvsp[0].a_refcomp.lex_type);
2172 free(yyvsp[0].a_refcomp.name);
2173 checkmem(ret == 0);
2174 ;
2175 break;}
2176case 102:
2177#line 1098 "asn1p_y.y"
2178{
2179 int ret;
2180 yyval.a_ref = yyvsp[-2].a_ref;
2181 ret = asn1p_ref_add_component(yyval.a_ref, yyvsp[0].a_refcomp.name, yyvsp[0].a_refcomp.lex_type);
2182 free(yyvsp[0].a_refcomp.name);
2183 checkmem(ret == 0);
2184 ;
2185 break;}
2186case 105:
2187#line 1112 "asn1p_y.y"
2188{
2189 yyval.a_refcomp.lex_type = RLT_AmpUppercase;
2190 yyval.a_refcomp.name = yyvsp[0].tv_str;
2191 ;
2192 break;}
2193case 106:
2194#line 1117 "asn1p_y.y"
2195{
2196 yyval.a_refcomp.lex_type = RLT_Amplowercase;
2197 yyval.a_refcomp.name = yyvsp[0].tv_str;
2198 ;
2199 break;}
2200case 107:
2201#line 1130 "asn1p_y.y"
2202{
2203 yyval.a_expr = yyvsp[-2].a_expr;
2204 assert(yyval.a_expr->Identifier == NULL);
2205 yyval.a_expr->Identifier = yyvsp[-3].tv_str;
2206 yyval.a_expr->meta_type = AMT_VALUE;
2207 yyval.a_expr->value = yyvsp[0].a_value;
2208 ;
2209 break;}
2210case 108:
2211#line 1140 "asn1p_y.y"
2212{ asn1p_lexer_hack_push_opaque_state(); ;
2213 break;}
2214case 109:
2215#line 1141 "asn1p_y.y"
2216{
2217 yyval.a_value = asn1p_value_frombuf(yyvsp[0].tv_opaque.buf, yyvsp[0].tv_opaque.len, 0);
2218 checkmem(yyval.a_value);
2219 yyval.a_value->type = ATV_UNPARSED;
2220 ;
2221 break;}
2222case 110:
2223#line 1146 "asn1p_y.y"
2224{
2225 yyval.a_value = _convert_bitstring2binary(yyvsp[0].tv_str, 'B');
2226 checkmem(yyval.a_value);
2227 ;
2228 break;}
2229case 111:
2230#line 1150 "asn1p_y.y"
2231{
2232 yyval.a_value = _convert_bitstring2binary(yyvsp[0].tv_str, 'H');
2233 checkmem(yyval.a_value);
2234 ;
2235 break;}
2236case 112:
2237#line 1154 "asn1p_y.y"
2238{
2239 yyval.a_value = asn1p_value_frombuf(yyvsp[0].tv_opaque.buf, yyvsp[0].tv_opaque.len, 0);
2240 checkmem(yyval.a_value);
2241 ;
2242 break;}
2243case 113:
2244#line 1158 "asn1p_y.y"
2245{
2246 yyval.a_value = yyvsp[0].a_value;
2247 ;
2248 break;}
2249case 114:
2250#line 1161 "asn1p_y.y"
2251{
2252 yyval.a_value = yyvsp[0].a_value;
2253 ;
2254 break;}
2255case 115:
2256#line 1167 "asn1p_y.y"
2257{
2258 asn1p_ref_t *ref;
2259 int ret;
2260 ref = asn1p_ref_new(yylineno);
2261 checkmem(ref);
2262 ret = asn1p_ref_add_component(ref, yyvsp[0].tv_str, RLT_lowercase);
2263 checkmem(ret == 0);
2264 yyval.a_value = asn1p_value_fromref(ref, 0);
2265 checkmem(yyval.a_value);
2266 free(yyvsp[0].tv_str);
2267 ;
2268 break;}
2269case 116:
2270#line 1178 "asn1p_y.y"
2271{
2272 asn1p_ref_t *ref;
2273 int ret;
2274 ref = asn1p_ref_new(yylineno);
2275 checkmem(ref);
2276 ret = asn1p_ref_add_component(ref, yyvsp[-2].tv_str, RLT_UNKNOWN);
2277 checkmem(ret == 0);
2278 ret = asn1p_ref_add_component(ref, yyvsp[0].tv_str, RLT_lowercase);
2279 checkmem(ret == 0);
2280 yyval.a_value = asn1p_value_fromref(ref, 0);
2281 checkmem(yyval.a_value);
2282 free(yyvsp[-2].tv_str);
2283 free(yyvsp[0].tv_str);
2284 ;
2285 break;}
2286case 117:
2287#line 1195 "asn1p_y.y"
2288{
2289 yyval.tv_opaque.len = yyvsp[0].tv_opaque.len + 2;
2290 yyval.tv_opaque.buf = malloc(yyval.tv_opaque.len + 1);
2291 checkmem(yyval.tv_opaque.buf);
2292 yyval.tv_opaque.buf[0] = '{';
2293 yyval.tv_opaque.buf[1] = ' ';
2294 memcpy(yyval.tv_opaque.buf + 2, yyvsp[0].tv_opaque.buf, yyvsp[0].tv_opaque.len);
2295 yyval.tv_opaque.buf[yyval.tv_opaque.len] = '\0';
2296 free(yyvsp[0].tv_opaque.buf);
2297 ;
2298 break;}
2299case 118:
2300#line 1205 "asn1p_y.y"
2301{
2302 int newsize = yyvsp[-1].tv_opaque.len + yyvsp[0].tv_opaque.len;
2303 char *p = malloc(newsize + 1);
2304 checkmem(p);
2305 memcpy(p , yyvsp[-1].tv_opaque.buf, yyvsp[-1].tv_opaque.len);
2306 memcpy(p + yyvsp[-1].tv_opaque.len, yyvsp[0].tv_opaque.buf, yyvsp[0].tv_opaque.len);
2307 p[newsize] = '\0';
2308 free(yyvsp[-1].tv_opaque.buf);
2309 free(yyvsp[0].tv_opaque.buf);
2310 yyval.tv_opaque.buf = p;
2311 yyval.tv_opaque.len = newsize;
2312 ;
2313 break;}
2314case 119:
2315#line 1220 "asn1p_y.y"
2316{ yyval.a_type = ASN_BASIC_BOOLEAN; ;
2317 break;}
2318case 120:
2319#line 1221 "asn1p_y.y"
2320{ yyval.a_type = ASN_BASIC_NULL; ;
2321 break;}
2322case 121:
2323#line 1222 "asn1p_y.y"
2324{ yyval.a_type = ASN_BASIC_REAL; ;
2325 break;}
2326case 122:
2327#line 1223 "asn1p_y.y"
2328{ yyval.a_type = yyvsp[0].a_type; ;
2329 break;}
2330case 123:
2331#line 1224 "asn1p_y.y"
2332{ yyval.a_type = ASN_BASIC_OCTET_STRING; ;
2333 break;}
2334case 124:
2335#line 1225 "asn1p_y.y"
2336{ yyval.a_type = ASN_BASIC_OBJECT_IDENTIFIER; ;
2337 break;}
2338case 125:
2339#line 1226 "asn1p_y.y"
2340{ yyval.a_type = ASN_BASIC_RELATIVE_OID; ;
2341 break;}
2342case 126:
2343#line 1227 "asn1p_y.y"
2344{ yyval.a_type = ASN_BASIC_EXTERNAL; ;
2345 break;}
2346case 127:
2347#line 1228 "asn1p_y.y"
2348{ yyval.a_type = ASN_BASIC_EMBEDDED_PDV; ;
2349 break;}
2350case 128:
2351#line 1229 "asn1p_y.y"
2352{ yyval.a_type = ASN_BASIC_CHARACTER_STRING; ;
2353 break;}
2354case 129:
2355#line 1230 "asn1p_y.y"
2356{ yyval.a_type = ASN_BASIC_UTCTime; ;
2357 break;}
2358case 130:
2359#line 1231 "asn1p_y.y"
2360{ yyval.a_type = ASN_BASIC_GeneralizedTime; ;
2361 break;}
2362case 131:
2363#line 1238 "asn1p_y.y"
2364{ yyval.a_type = ASN_BASIC_INTEGER; ;
2365 break;}
2366case 132:
2367#line 1239 "asn1p_y.y"
2368{ yyval.a_type = ASN_BASIC_ENUMERATED; ;
2369 break;}
2370case 133:
2371#line 1240 "asn1p_y.y"
2372{ yyval.a_type = ASN_BASIC_BIT_STRING; ;
2373 break;}
2374case 134:
2375#line 1244 "asn1p_y.y"
2376{
2377 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2378 checkmem(yyval.a_expr);
2379 yyval.a_expr->expr_type = yyvsp[0].a_type;
2380 yyval.a_expr->meta_type = AMT_TYPE;
2381 ;
2382 break;}
2383case 135:
2384#line 1250 "asn1p_y.y"
2385{
2386 if(yyvsp[0].a_expr) {
2387 yyval.a_expr = yyvsp[0].a_expr;
2388 } else {
2389 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2390 checkmem(yyval.a_expr);
2391 }
2392 yyval.a_expr->expr_type = yyvsp[-1].a_type;
2393 yyval.a_expr->meta_type = AMT_TYPE;
2394 ;
2395 break;}
2396case 136:
2397#line 1263 "asn1p_y.y"
2398{ yyval.a_type = ASN_STRING_BMPString; ;
2399 break;}
2400case 137:
2401#line 1264 "asn1p_y.y"
2402{
2403 yyval.a_type = ASN_STRING_GeneralString;
2404 return yyerror("GeneralString is not supported");
2405 ;
2406 break;}
2407case 138:
2408#line 1268 "asn1p_y.y"
2409{
2410 yyval.a_type = ASN_STRING_GraphicString;
2411 return yyerror("GraphicString is not supported");
2412 ;
2413 break;}
2414case 139:
2415#line 1272 "asn1p_y.y"
2416{ yyval.a_type = ASN_STRING_IA5String; ;
2417 break;}
2418case 140:
2419#line 1273 "asn1p_y.y"
2420{ yyval.a_type = ASN_STRING_ISO646String; ;
2421 break;}
2422case 141:
2423#line 1274 "asn1p_y.y"
2424{ yyval.a_type = ASN_STRING_NumericString; ;
2425 break;}
2426case 142:
2427#line 1275 "asn1p_y.y"
2428{ yyval.a_type = ASN_STRING_PrintableString; ;
2429 break;}
2430case 143:
2431#line 1276 "asn1p_y.y"
2432{
2433 yyval.a_type = ASN_STRING_T61String;
2434 return yyerror("T61String not implemented yet");
2435 ;
2436 break;}
2437case 144:
2438#line 1280 "asn1p_y.y"
2439{ yyval.a_type = ASN_STRING_TeletexString; ;
2440 break;}
2441case 145:
2442#line 1281 "asn1p_y.y"
2443{ yyval.a_type = ASN_STRING_UniversalString; ;
2444 break;}
2445case 146:
2446#line 1282 "asn1p_y.y"
2447{ yyval.a_type = ASN_STRING_UTF8String; ;
2448 break;}
2449case 147:
2450#line 1283 "asn1p_y.y"
2451{
2452 yyval.a_type = ASN_STRING_VideotexString;
2453 return yyerror("VideotexString is no longer supported");
2454 ;
2455 break;}
2456case 148:
2457#line 1287 "asn1p_y.y"
2458{ yyval.a_type = ASN_STRING_VisibleString; ;
2459 break;}
2460case 149:
2461#line 1288 "asn1p_y.y"
2462{ yyval.a_type = ASN_STRING_ObjectDescriptor; ;
2463 break;}
2464case 150:
2465#line 1292 "asn1p_y.y"
2466{
2467 yyval.a_expr = yyvsp[-1].a_expr;
2468 assert(yyval.a_expr->expr_type == A1TC_INVALID);
2469 yyval.a_expr->expr_type = ASN_CONSTR_CHOICE;
2470 yyval.a_expr->meta_type = AMT_TYPE;
2471 ;
2472 break;}
2473case 151:
2474#line 1298 "asn1p_y.y"
2475{
2476 yyval.a_expr = yyvsp[-1].a_expr;
2477 assert(yyval.a_expr->expr_type == A1TC_INVALID);
2478 yyval.a_expr->expr_type = ASN_CONSTR_SEQUENCE;
2479 yyval.a_expr->meta_type = AMT_TYPE;
2480 ;
2481 break;}
2482case 152:
2483#line 1304 "asn1p_y.y"
2484{
2485 yyval.a_expr = yyvsp[-1].a_expr;
2486 assert(yyval.a_expr->expr_type == A1TC_INVALID);
2487 yyval.a_expr->expr_type = ASN_CONSTR_SET;
2488 yyval.a_expr->meta_type = AMT_TYPE;
2489 ;
2490 break;}
2491case 153:
2492#line 1310 "asn1p_y.y"
2493{
2494 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2495 checkmem(yyval.a_expr);
2496 yyval.a_expr->constraints = yyvsp[-2].a_constr;
2497 yyval.a_expr->expr_type = ASN_CONSTR_SEQUENCE_OF;
2498 yyval.a_expr->meta_type = AMT_TYPE;
2499 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
2500 ;
2501 break;}
2502case 154:
2503#line 1318 "asn1p_y.y"
2504{
2505 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2506 checkmem(yyval.a_expr);
2507 yyval.a_expr->constraints = yyvsp[-2].a_constr;
2508 yyval.a_expr->expr_type = ASN_CONSTR_SET_OF;
2509 yyval.a_expr->meta_type = AMT_TYPE;
2510 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
2511 ;
2512 break;}
2513case 155:
2514#line 1326 "asn1p_y.y"
2515{
2516 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2517 checkmem(yyval.a_expr);
2518 yyval.a_expr->expr_type = ASN_CONSTR_ANY;
2519 yyval.a_expr->meta_type = AMT_TYPE;
2520 ;
2521 break;}
2522case 156:
2523#line 1332 "asn1p_y.y"
2524{
2525 int ret;
2526 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2527 checkmem(yyval.a_expr);
2528 yyval.a_expr->reference = asn1p_ref_new(yylineno);
2529 ret = asn1p_ref_add_component(yyval.a_expr->reference,
2530 yyvsp[0].tv_str, RLT_lowercase);
2531 checkmem(ret == 0);
2532 yyval.a_expr->expr_type = ASN_CONSTR_ANY;
2533 yyval.a_expr->meta_type = AMT_TYPE;
2534 ;
2535 break;}
2536case 157:
2537#line 1349 "asn1p_y.y"
2538{ yyval.a_constr = 0; ;
2539 break;}
2540case 158:
2541#line 1350 "asn1p_y.y"
2542{ yyval.a_constr = yyvsp[0].a_constr; ;
2543 break;}
2544case 164:
2545#line 1358 "asn1p_y.y"
2546{
2547 /*
2548 * This is a special case, for compatibility purposes.
2549 * It goes without parenthesis.
2550 */
2551 int ret;
2552 yyval.a_constr = asn1p_constraint_new(yylineno);
2553 checkmem(yyval.a_constr);
2554 yyval.a_constr->type = ACT_CT_SIZE;
2555 ret = asn1p_constraint_insert(yyval.a_constr, yyvsp[-1].a_constr);
2556 checkmem(ret == 0);
2557 ;
2558 break;}
2559case 165:
2560#line 1370 "asn1p_y.y"
2561{
2562 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_SET, yyvsp[0].a_constr, 0);
2563 ;
2564 break;}
2565case 166:
2566#line 1373 "asn1p_y.y"
2567{
2568 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_SET, yyvsp[-1].a_constr, yyvsp[0].a_constr);
2569 ;
2570 break;}
2571case 167:
2572#line 1379 "asn1p_y.y"
2573{
2574 yyval.a_constr = yyvsp[-1].a_constr;
2575 ;
2576 break;}
2577case 168:
2578#line 1385 "asn1p_y.y"
2579{
2580 yyval.a_constr = yyvsp[0].a_constr;
2581 ;
2582 break;}
2583case 169:
2584#line 1388 "asn1p_y.y"
2585{
2586 asn1p_constraint_t *ct;
2587 ct = asn1p_constraint_new(yylineno);
2588 checkmem(ct);
2589 ct->type = ACT_EL_EXT;
2590 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_CSV, yyvsp[-2].a_constr, ct);
2591 ;
2592 break;}
2593case 170:
2594#line 1395 "asn1p_y.y"
2595{
2596 asn1p_constraint_t *ct;
2597 ct = asn1p_constraint_new(yylineno);
2598 checkmem(ct);
2599 ct->type = ACT_EL_EXT;
2600 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_CSV, yyvsp[-4].a_constr, ct);
2601 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_CSV, yyvsp[-4].a_constr, yyvsp[0].a_constr);
2602 ;
2603 break;}
2604case 171:
2605#line 1403 "asn1p_y.y"
2606{
2607 yyval.a_constr = asn1p_constraint_new(yylineno);
2608 checkmem(yyval.a_constr);
2609 yyval.a_constr->type = ACT_EL_EXT;
2610 ;
2611 break;}
2612case 172:
2613#line 1408 "asn1p_y.y"
2614{
2615 asn1p_constraint_t *ct;
2616 ct = asn1p_constraint_new(yylineno);
2617 checkmem(ct);
2618 ct->type = ACT_EL_EXT;
2619 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_CSV, ct, yyvsp[0].a_constr);
2620 ;
2621 break;}
2622case 173:
2623#line 1417 "asn1p_y.y"
2624{ yyval.a_constr = yyvsp[0].a_constr; ;
2625 break;}
2626case 174:
2627#line 1420 "asn1p_y.y"
2628{ yyval.a_constr = yyvsp[0].a_constr; ;
2629 break;}
2630case 175:
2631#line 1421 "asn1p_y.y"
2632{
2633 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_UNI, yyvsp[-2].a_constr, yyvsp[0].a_constr);
2634 ;
2635 break;}
2636case 176:
2637#line 1427 "asn1p_y.y"
2638{ yyval.a_constr = yyvsp[0].a_constr; ;
2639 break;}
2640case 177:
2641#line 1429 "asn1p_y.y"
2642{
2643 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_INT, yyvsp[-2].a_constr, yyvsp[0].a_constr);
2644 ;
2645 break;}
2646case 178:
2647#line 1435 "asn1p_y.y"
2648{ yyval.a_constr = yyvsp[0].a_constr; ;
2649 break;}
2650case 179:
2651#line 1436 "asn1p_y.y"
2652{
2653 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_EXC, yyvsp[-2].a_constr, yyvsp[0].a_constr);
2654 ;
2655 break;}
2656case 180:
2657#line 1442 "asn1p_y.y"
2658{
2659 yyval.a_constr = asn1p_constraint_new(yylineno);
2660 checkmem(yyval.a_constr);
2661 yyval.a_constr->type = ACT_EL_VALUE;
2662 yyval.a_constr->value = yyvsp[0].a_value;
2663 ;
2664 break;}
2665case 181:
2666#line 1448 "asn1p_y.y"
2667{
2668 yyval.a_constr = asn1p_constraint_new(yylineno);
2669 checkmem(yyval.a_constr);
2670 yyval.a_constr->type = yyvsp[-1].a_ctype;
2671 yyval.a_constr->range_start = yyvsp[-2].a_value;
2672 yyval.a_constr->range_stop = yyvsp[0].a_value;
2673 ;
2674 break;}
2675case 182:
2676#line 1455 "asn1p_y.y"
2677{
2678 int ret;
2679 yyval.a_constr = asn1p_constraint_new(yylineno);
2680 checkmem(yyval.a_constr);
2681 yyval.a_constr->type = yyvsp[-3].a_ctype;
2682 ret = asn1p_constraint_insert(yyval.a_constr, yyvsp[-1].a_constr);
2683 checkmem(ret == 0);
2684 ;
2685 break;}
2686case 183:
2687#line 1463 "asn1p_y.y"
2688{
2689 yyval.a_constr = yyvsp[0].a_constr;
2690 ;
2691 break;}
2692case 184:
2693#line 1466 "asn1p_y.y"
2694{
2695 yyval.a_constr = yyvsp[0].a_constr;
2696 ;
2697 break;}
2698case 185:
2699#line 1472 "asn1p_y.y"
2700{ yyval.a_ctype = ACT_EL_RANGE; ;
2701 break;}
2702case 186:
2703#line 1473 "asn1p_y.y"
2704{ yyval.a_ctype = ACT_EL_RLRANGE; ;
2705 break;}
2706case 187:
2707#line 1474 "asn1p_y.y"
2708{ yyval.a_ctype = ACT_EL_LLRANGE; ;
2709 break;}
2710case 188:
2711#line 1475 "asn1p_y.y"
2712{ yyval.a_ctype = ACT_EL_ULRANGE; ;
2713 break;}
2714case 189:
2715#line 1479 "asn1p_y.y"
2716{
2717 yyval.a_ctype = ACT_CT_SIZE;
2718 ;
2719 break;}
2720case 190:
2721#line 1482 "asn1p_y.y"
2722{
2723 yyval.a_ctype = ACT_CT_FROM;
2724 ;
2725 break;}
2726case 191:
2727#line 1488 "asn1p_y.y"
2728{
2729 yyval.a_value = yyvsp[0].a_value;
2730 ;
2731 break;}
2732case 192:
2733#line 1491 "asn1p_y.y"
2734{
2735 asn1p_ref_t *ref;
2736 int ret;
2737 ref = asn1p_ref_new(yylineno);
2738 checkmem(ref);
2739 ret = asn1p_ref_add_component(ref, yyvsp[0].tv_str, RLT_lowercase);
2740 checkmem(ret == 0);
2741 yyval.a_value = asn1p_value_fromref(ref, 0);
2742 checkmem(yyval.a_value);
2743 free(yyvsp[0].tv_str);
2744 ;
2745 break;}
2746case 193:
2747#line 1502 "asn1p_y.y"
2748{
2749 yyval.a_value = asn1p_value_frombuf(yyvsp[0].tv_opaque.buf, yyvsp[0].tv_opaque.len, 0);
2750 checkmem(yyval.a_value);
2751 ;
2752 break;}
2753case 194:
2754#line 1506 "asn1p_y.y"
2755{
2756 yyval.a_value = asn1p_value_fromint(123);
2757 checkmem(yyval.a_value);
2758 yyval.a_value->type = ATV_MIN;
2759 ;
2760 break;}
2761case 195:
2762#line 1511 "asn1p_y.y"
2763{
2764 yyval.a_value = asn1p_value_fromint(321);
2765 checkmem(yyval.a_value);
2766 yyval.a_value->type = ATV_MAX;
2767 ;
2768 break;}
2769case 196:
2770#line 1516 "asn1p_y.y"
2771{
2772 yyval.a_value = asn1p_value_fromint(0);
2773 checkmem(yyval.a_value);
2774 yyval.a_value->type = ATV_FALSE;
2775 ;
2776 break;}
2777case 197:
2778#line 1521 "asn1p_y.y"
2779{
2780 yyval.a_value = asn1p_value_fromint(1);
2781 checkmem(yyval.a_value);
2782 yyval.a_value->type = ATV_TRUE;
2783 ;
2784 break;}
2785case 198:
2786#line 1529 "asn1p_y.y"
2787{
2788 CONSTRAINT_INSERT(yyval.a_constr, ACT_CT_WCOMPS, yyvsp[-1].a_constr, 0);
2789 ;
2790 break;}
2791case 199:
2792#line 1535 "asn1p_y.y"
2793{
2794 yyval.a_constr = yyvsp[0].a_constr;
2795 ;
2796 break;}
2797case 200:
2798#line 1538 "asn1p_y.y"
2799{
2800 CONSTRAINT_INSERT(yyval.a_constr, ACT_CT_WCOMPS, yyvsp[-2].a_constr, yyvsp[0].a_constr);
2801 ;
2802 break;}
2803case 201:
2804#line 1544 "asn1p_y.y"
2805{
2806 yyval.a_constr = asn1p_constraint_new(yylineno);
2807 checkmem(yyval.a_constr);
2808 yyval.a_constr->type = ACT_EL_EXT;
2809 ;
2810 break;}
2811case 202:
2812#line 1549 "asn1p_y.y"
2813{
2814 yyval.a_constr = asn1p_constraint_new(yylineno);
2815 checkmem(yyval.a_constr);
2816 yyval.a_constr->type = ACT_EL_VALUE;
2817 yyval.a_constr->value = asn1p_value_frombuf(yyvsp[-2].tv_str, strlen(yyvsp[-2].tv_str), 0);
2818 yyval.a_constr->presence = yyvsp[0].a_pres;
2819 ;
2820 break;}
2821case 203:
2822#line 1562 "asn1p_y.y"
2823{ yyval.a_pres = ACPRES_DEFAULT; ;
2824 break;}
2825case 204:
2826#line 1563 "asn1p_y.y"
2827{ yyval.a_pres = yyvsp[0].a_pres; ;
2828 break;}
2829case 205:
2830#line 1567 "asn1p_y.y"
2831{
2832 yyval.a_pres = ACPRES_PRESENT;
2833 ;
2834 break;}
2835case 206:
2836#line 1570 "asn1p_y.y"
2837{
2838 yyval.a_pres = ACPRES_ABSENT;
2839 ;
2840 break;}
2841case 207:
2842#line 1573 "asn1p_y.y"
2843{
2844 yyval.a_pres = ACPRES_OPTIONAL;
2845 ;
2846 break;}
2847case 208:
2848#line 1579 "asn1p_y.y"
2849{
2850 yyval.a_constr = yyvsp[0].a_constr;
2851 ;
2852 break;}
2853case 209:
2854#line 1582 "asn1p_y.y"
2855{
2856 yyval.a_constr = yyvsp[0].a_constr;
2857 ;
2858 break;}
2859case 210:
2860#line 1591 "asn1p_y.y"
2861{
2862 asn1p_ref_t *ref = asn1p_ref_new(yylineno);
2863 asn1p_constraint_t *ct;
2864 int ret;
2865 ret = asn1p_ref_add_component(ref, yyvsp[-1].tv_str, 0);
2866 checkmem(ret == 0);
2867 ct = asn1p_constraint_new(yylineno);
2868 checkmem(yyval.a_constr);
2869 ct->type = ACT_EL_VALUE;
2870 ct->value = asn1p_value_fromref(ref, 0);
2871 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_CRC, ct, 0);
2872 ;
2873 break;}
2874case 211:
2875#line 1606 "asn1p_y.y"
2876{
2877 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_CRC, yyvsp[-3].a_constr, yyvsp[-1].a_constr);
2878 ;
2879 break;}
2880case 212:
2881#line 1612 "asn1p_y.y"
2882{
2883 yyval.a_constr = asn1p_constraint_new(yylineno);
2884 checkmem(yyval.a_constr);
2885 yyval.a_constr->type = ACT_EL_VALUE;
2886 yyval.a_constr->value = asn1p_value_fromref(yyvsp[0].a_ref, 0);
2887 ;
2888 break;}
2889case 213:
2890#line 1618 "asn1p_y.y"
2891{
2892 asn1p_constraint_t *ct;
2893 ct = asn1p_constraint_new(yylineno);
2894 checkmem(ct);
2895 ct->type = ACT_EL_VALUE;
2896 ct->value = asn1p_value_fromref(yyvsp[0].a_ref, 0);
2897 CONSTRAINT_INSERT(yyval.a_constr, ACT_CA_CSV, yyvsp[-2].a_constr, ct);
2898 ;
2899 break;}
2900case 214:
2901#line 1632 "asn1p_y.y"
2902{
2903 char *p = malloc(strlen(yyvsp[0].tv_str) + 2);
2904 int ret;
2905 *p = '@';
2906 strcpy(p + 1, yyvsp[0].tv_str);
2907 yyval.a_ref = asn1p_ref_new(yylineno);
2908 ret = asn1p_ref_add_component(yyval.a_ref, p, 0);
2909 checkmem(ret == 0);
2910 free(p);
2911 free(yyvsp[0].tv_str);
2912 ;
2913 break;}
2914case 215:
2915#line 1643 "asn1p_y.y"
2916{
2917 char *p = malloc(strlen(yyvsp[0].tv_str) + 3);
2918 int ret;
2919 p[0] = '@';
2920 p[1] = '.';
2921 strcpy(p + 2, yyvsp[0].tv_str);
2922 yyval.a_ref = asn1p_ref_new(yylineno);
2923 ret = asn1p_ref_add_component(yyval.a_ref, p, 0);
2924 checkmem(ret == 0);
2925 free(p);
2926 free(yyvsp[0].tv_str);
2927 ;
2928 break;}
2929case 216:
2930#line 1659 "asn1p_y.y"
2931{
2932 yyval.tv_str = yyvsp[0].tv_str;
2933 ;
2934 break;}
2935case 217:
2936#line 1662 "asn1p_y.y"
2937{
2938 int l1 = strlen(yyvsp[-2].tv_str);
2939 int l3 = strlen(yyvsp[0].tv_str);
2940 yyval.tv_str = malloc(l1 + 1 + l3 + 1);
2941 memcpy(yyval.tv_str, yyvsp[-2].tv_str, l1);
2942 yyval.tv_str[l1] = '.';
2943 memcpy(yyval.tv_str + l1 + 1, yyvsp[0].tv_str, l3);
2944 yyval.tv_str[l1 + 1 + l3] = '\0';
2945 ;
2946 break;}
2947case 218:
2948#line 1680 "asn1p_y.y"
2949{ yyval.a_marker = EM_NOMARK; ;
2950 break;}
2951case 219:
2952#line 1681 "asn1p_y.y"
2953{ yyval.a_marker = yyvsp[0].a_marker; ;
2954 break;}
2955case 220:
2956#line 1685 "asn1p_y.y"
2957{
2958 yyval.a_marker = EM_OPTIONAL;
2959 ;
2960 break;}
2961case 221:
2962#line 1688 "asn1p_y.y"
2963{
2964 yyval.a_marker = EM_DEFAULT;
2965 /* FIXME: store DefaultValue somewhere */
2966 ;
2967 break;}
2968case 222:
2969#line 1695 "asn1p_y.y"
2970{
2971 ;
2972 break;}
2973case 223:
2974#line 1697 "asn1p_y.y"
2975{
2976 ;
2977 break;}
2978case 224:
2979#line 1699 "asn1p_y.y"
2980{ asn1p_lexer_hack_push_opaque_state(); ;
2981 break;}
2982case 225:
2983#line 1699 "asn1p_y.y"
2984{
2985 ;
2986 break;}
2987case 226:
2988#line 1720 "asn1p_y.y"
2989{
2990 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
2991 checkmem(yyval.a_expr);
2992 ;
2993 break;}
2994case 227:
2995#line 1724 "asn1p_y.y"
2996{
2997 yyval.a_expr = yyvsp[-1].a_expr;
2998 ;
2999 break;}
3000case 228:
3001#line 1730 "asn1p_y.y"
3002{
3003 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
3004 checkmem(yyval.a_expr);
3005 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
3006 ;
3007 break;}
3008case 229:
3009#line 1735 "asn1p_y.y"
3010{
3011 yyval.a_expr = yyvsp[-2].a_expr;
3012 TQ_ADD(&(yyval.a_expr->members), yyvsp[0].a_expr, next);
3013 ;
3014 break;}
3015case 230:
3016#line 1742 "asn1p_y.y"
3017{
3018 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
3019 checkmem(yyval.a_expr);
3020 yyval.a_expr->expr_type = A1TC_UNIVERVAL;
3021 yyval.a_expr->meta_type = AMT_VALUE;
3022 yyval.a_expr->Identifier = yyvsp[0].tv_str;
3023 ;
3024 break;}
3025case 231:
3026#line 1749 "asn1p_y.y"
3027{
3028 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
3029 checkmem(yyval.a_expr);
3030 yyval.a_expr->expr_type = A1TC_UNIVERVAL;
3031 yyval.a_expr->meta_type = AMT_VALUE;
3032 yyval.a_expr->Identifier = yyvsp[-3].tv_str;
3033 yyval.a_expr->value = yyvsp[-1].a_value;
3034 ;
3035 break;}
3036case 232:
3037#line 1757 "asn1p_y.y"
3038{
3039 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
3040 checkmem(yyval.a_expr);
3041 yyval.a_expr->expr_type = A1TC_UNIVERVAL;
3042 yyval.a_expr->meta_type = AMT_VALUE;
3043 yyval.a_expr->Identifier = yyvsp[-3].tv_str;
3044 yyval.a_expr->value = yyvsp[-1].a_value;
3045 ;
3046 break;}
3047case 233:
3048#line 1765 "asn1p_y.y"
3049{
3050 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
3051 checkmem(yyval.a_expr);
3052 yyval.a_expr->expr_type = A1TC_UNIVERVAL;
3053 yyval.a_expr->meta_type = AMT_VALUE;
3054 yyval.a_expr->value = yyvsp[0].a_value;
3055 ;
3056 break;}
3057case 234:
3058#line 1772 "asn1p_y.y"
3059{
3060 yyval.a_expr = asn1p_expr_new(asn1p_lineno);
3061 checkmem(yyval.a_expr);
3062 yyval.a_expr->Identifier = strdup("...");
3063 checkmem(yyval.a_expr->Identifier);
3064 yyval.a_expr->expr_type = A1TC_EXTENSIBLE;
3065 yyval.a_expr->meta_type = AMT_VALUE;
3066 ;
3067 break;}
3068case 235:
3069#line 1783 "asn1p_y.y"
3070{
3071 yyval.a_value = asn1p_value_fromint(yyvsp[0].a_int);
3072 checkmem(yyval.a_value);
3073 ;
3074 break;}
3075case 236:
3076#line 1787 "asn1p_y.y"
3077{
3078 yyval.a_value = asn1p_value_fromint(yyvsp[0].a_int);
3079 checkmem(yyval.a_value);
3080 ;
3081 break;}
3082case 237:
3083#line 1818 "asn1p_y.y"
3084{ memset(&yyval.a_tag, 0, sizeof(yyval.a_tag)); ;
3085 break;}
3086case 238:
3087#line 1819 "asn1p_y.y"
3088{ yyval.a_tag = yyvsp[0].a_tag; ;
3089 break;}
3090case 239:
3091#line 1823 "asn1p_y.y"
3092{
3093 yyval.a_tag = yyvsp[0].a_tag;
3094 yyval.a_tag.tag_mode = TM_DEFAULT;
3095 ;
3096 break;}
3097case 240:
3098#line 1827 "asn1p_y.y"
3099{
3100 yyval.a_tag = yyvsp[-1].a_tag;
3101 yyval.a_tag.tag_mode = TM_IMPLICIT;
3102 ;
3103 break;}
3104case 241:
3105#line 1831 "asn1p_y.y"
3106{
3107 yyval.a_tag = yyvsp[-1].a_tag;
3108 yyval.a_tag.tag_mode = TM_EXPLICIT;
3109 ;
3110 break;}
3111case 242:
3112#line 1838 "asn1p_y.y"
3113{
3114 checkmem(yyvsp[0].tv_str);
3115 yyval.tv_str = yyvsp[0].tv_str;
3116 ;
3117 break;}
3118case 243:
3119#line 1842 "asn1p_y.y"
3120{
3121 checkmem(yyvsp[0].tv_str);
3122 yyval.tv_str = yyvsp[0].tv_str;
3123 ;
3124 break;}
3125case 244:
3126#line 1849 "asn1p_y.y"
3127{
3128 checkmem(yyvsp[0].tv_str);
3129 yyval.tv_str = yyvsp[0].tv_str;
3130 ;
3131 break;}
3132case 245:
3133#line 1856 "asn1p_y.y"
3134{
3135 checkmem(yyvsp[0].tv_str);
3136 yyval.tv_str = yyvsp[0].tv_str;
3137 ;
3138 break;}
3139case 246:
3140#line 1863 "asn1p_y.y"
3141{
3142 memset(&yyval.tv_nametag, 0, sizeof(yyval.tv_nametag));
3143 yyval.tv_nametag.name = yyvsp[0].tv_str;
3144 ;
3145 break;}
3146case 247:
3147#line 1867 "asn1p_y.y"
3148{
3149 yyval.tv_nametag.name = yyvsp[-1].tv_str;
3150 yyval.tv_nametag.tag = yyvsp[0].a_tag;
3151 ;
3152 break;}
3153}
3154 /* the action file gets copied in in place of this dollarsign */
3155#line 543 "/usr/share/bison.simple"
3156
3157 yyvsp -= yylen;
3158 yyssp -= yylen;
3159#ifdef YYLSP_NEEDED
3160 yylsp -= yylen;
3161#endif
3162
3163#if YYDEBUG != 0
3164 if (yydebug)
3165 {
3166 short *ssp1 = yyss - 1;
3167 fprintf (stderr, "state stack now");
3168 while (ssp1 != yyssp)
3169 fprintf (stderr, " %d", *++ssp1);
3170 fprintf (stderr, "\n");
3171 }
3172#endif
3173
3174 *++yyvsp = yyval;
3175
3176#ifdef YYLSP_NEEDED
3177 yylsp++;
3178 if (yylen == 0)
3179 {
3180 yylsp->first_line = yylloc.first_line;
3181 yylsp->first_column = yylloc.first_column;
3182 yylsp->last_line = (yylsp-1)->last_line;
3183 yylsp->last_column = (yylsp-1)->last_column;
3184 yylsp->text = 0;
3185 }
3186 else
3187 {
3188 yylsp->last_line = (yylsp+yylen-1)->last_line;
3189 yylsp->last_column = (yylsp+yylen-1)->last_column;
3190 }
3191#endif
3192
3193 /* Now "shift" the result of the reduction.
3194 Determine what state that goes to,
3195 based on the state we popped back to
3196 and the rule number reduced by. */
3197
3198 yyn = yyr1[yyn];
3199
3200 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
3201 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3202 yystate = yytable[yystate];
3203 else
3204 yystate = yydefgoto[yyn - YYNTBASE];
3205
3206 goto yynewstate;
3207
3208yyerrlab: /* here on detecting error */
3209
3210 if (! yyerrstatus)
3211 /* If not already recovering from an error, report this error. */
3212 {
3213 ++yynerrs;
3214
3215#ifdef YYERROR_VERBOSE
3216 yyn = yypact[yystate];
3217
3218 if (yyn > YYFLAG && yyn < YYLAST)
3219 {
3220 int size = 0;
3221 char *msg;
3222 int x, count;
3223
3224 count = 0;
3225 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
3226 for (x = (yyn < 0 ? -yyn : 0);
3227 x < (sizeof(yytname) / sizeof(char *)); x++)
3228 if (yycheck[x + yyn] == x)
3229 size += strlen(yytname[x]) + 15, count++;
3230 msg = (char *) malloc(size + 15);
3231 if (msg != 0)
3232 {
3233 strcpy(msg, "parse error");
3234
3235 if (count < 5)
3236 {
3237 count = 0;
3238 for (x = (yyn < 0 ? -yyn : 0);
3239 x < (sizeof(yytname) / sizeof(char *)); x++)
3240 if (yycheck[x + yyn] == x)
3241 {
3242 strcat(msg, count == 0 ? ", expecting `" : " or `");
3243 strcat(msg, yytname[x]);
3244 strcat(msg, "'");
3245 count++;
3246 }
3247 }
3248 yyerror(msg);
3249 free(msg);
3250 }
3251 else
3252 yyerror ("parse error; also virtual memory exceeded");
3253 }
3254 else
3255#endif /* YYERROR_VERBOSE */
3256 yyerror("parse error");
3257 }
3258
3259 goto yyerrlab1;
3260yyerrlab1: /* here on error raised explicitly by an action */
3261
3262 if (yyerrstatus == 3)
3263 {
3264 /* if just tried and failed to reuse lookahead token after an error, discard it. */
3265
3266 /* return failure if at end of input */
3267 if (yychar == YYEOF)
3268 YYABORT;
3269
3270#if YYDEBUG != 0
3271 if (yydebug)
3272 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
3273#endif
3274
3275 yychar = YYEMPTY;
3276 }
3277
3278 /* Else will try to reuse lookahead token
3279 after shifting the error token. */
3280
3281 yyerrstatus = 3; /* Each real token shifted decrements this */
3282
3283 goto yyerrhandle;
3284
3285yyerrdefault: /* current state does not do anything special for the error token. */
3286
3287#if 0
3288 /* This is wrong; only states that explicitly want error tokens
3289 should shift them. */
3290 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
3291 if (yyn) goto yydefault;
3292#endif
3293
3294yyerrpop: /* pop the current state because it cannot handle the error token */
3295
3296 if (yyssp == yyss) YYABORT;
3297 yyvsp--;
3298 yystate = *--yyssp;
3299#ifdef YYLSP_NEEDED
3300 yylsp--;
3301#endif
3302
3303#if YYDEBUG != 0
3304 if (yydebug)
3305 {
3306 short *ssp1 = yyss - 1;
3307 fprintf (stderr, "Error: state stack now");
3308 while (ssp1 != yyssp)
3309 fprintf (stderr, " %d", *++ssp1);
3310 fprintf (stderr, "\n");
3311 }
3312#endif
3313
3314yyerrhandle:
3315
3316 yyn = yypact[yystate];
3317 if (yyn == YYFLAG)
3318 goto yyerrdefault;
3319
3320 yyn += YYTERROR;
3321 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
3322 goto yyerrdefault;
3323
3324 yyn = yytable[yyn];
3325 if (yyn < 0)
3326 {
3327 if (yyn == YYFLAG)
3328 goto yyerrpop;
3329 yyn = -yyn;
3330 goto yyreduce;
3331 }
3332 else if (yyn == 0)
3333 goto yyerrpop;
3334
3335 if (yyn == YYFINAL)
3336 YYACCEPT;
3337
3338#if YYDEBUG != 0
3339 if (yydebug)
3340 fprintf(stderr, "Shifting error token, ");
3341#endif
3342
3343 *++yyvsp = yylval;
3344#ifdef YYLSP_NEEDED
3345 *++yylsp = yylloc;
3346#endif
3347
3348 yystate = yyn;
3349 goto yynewstate;
3350
3351 yyacceptlab:
3352 /* YYACCEPT comes here. */
3353 if (yyfree_stacks)
3354 {
3355 free (yyss);
3356 free (yyvs);
3357#ifdef YYLSP_NEEDED
3358 free (yyls);
3359#endif
3360 }
3361 return 0;
3362
3363 yyabortlab:
3364 /* YYABORT comes here. */
3365 if (yyfree_stacks)
3366 {
3367 free (yyss);
3368 free (yyvs);
3369#ifdef YYLSP_NEEDED
3370 free (yyls);
3371#endif
3372 }
3373 return 1;
3374}
3375#line 1874 "asn1p_y.y"
3376
3377
3378
3379/*
3380 * Convert Xstring ('0101'B or '5'H) to the binary vector.
3381 */
3382static asn1p_value_t *
3383_convert_bitstring2binary(char *str, int base) {
3384 asn1p_value_t *val;
3385 int slen;
3386 int memlen;
3387 int baselen;
3388 int bits;
3389 uint8_t *binary_vector;
3390 uint8_t *bv_ptr;
3391 uint8_t cur_val;
3392
3393 assert(str);
3394 assert(str[0] == '\'');
3395
3396 switch(base) {
3397 case 'B':
3398 baselen = 1;
3399 break;
3400 case 'H':
3401 baselen = 4;
3402 break;
3403 default:
3404 assert(base == 'B' || base == 'H');
3405 errno = EINVAL;
3406 return NULL;
3407 }
3408
3409 slen = strlen(str);
3410 assert(str[slen - 1] == base);
3411 assert(str[slen - 2] == '\'');
3412
3413 memlen = slen / (8 / baselen); /* Conservative estimate */
3414
3415 bv_ptr = binary_vector = malloc(memlen + 1);
3416 if(bv_ptr == NULL)
3417 /* ENOMEM */
3418 return NULL;
3419
3420 cur_val = 0;
3421 bits = 0;
3422 while(*(++str) != '\'') {
3423 switch(baselen) {
3424 case 1:
3425 switch(*str) {
3426 case '1':
3427 cur_val |= 1 << (7 - (bits % 8));
3428 case '0':
3429 break;
3430 default:
3431 assert(!"_y UNREACH1");
3432 case ' ': case '\r': case '\n':
3433 continue;
3434 }
3435 break;
3436 case 4:
3437 switch(*str) {
3438 case '0': case '1': case '2': case '3': case '4':
3439 case '5': case '6': case '7': case '8': case '9':
3440 cur_val |= (*str - '0') << (4 - (bits % 8));
3441 break;
3442 case 'A': case 'B': case 'C':
3443 case 'D': case 'E': case 'F':
3444 cur_val |= ((*str - 'A') + 10)
3445 << (4 - (bits % 8));
3446 break;
3447 default:
3448 assert(!"_y UNREACH2");
3449 case ' ': case '\r': case '\n':
3450 continue;
3451 }
3452 break;
3453 }
3454
3455 bits += baselen;
3456 if((bits % 8) == 0) {
3457 *bv_ptr++ = cur_val;
3458 cur_val = 0;
3459 }
3460 }
3461
3462 *bv_ptr = cur_val;
3463 assert((bv_ptr - binary_vector) <= memlen);
3464
3465 val = asn1p_value_frombits(binary_vector, bits, 0);
3466 if(val == NULL) {
3467 free(binary_vector);
3468 }
3469
3470 return val;
3471}
3472
3473extern char *asn1p_text;
3474
3475int
3476yyerror(const char *msg) {
3477 fprintf(stderr,
3478 "ASN.1 grammar parse error "
3479 "near line %d (token \"%s\"): %s\n",
3480 asn1p_lineno, asn1p_text, msg);
3481 return -1;
3482}
3483
3484