blob: 2594b556e3c6afb0b4176e95bd5c7f875c06b683 [file] [log] [blame]
vlmfa67ddc2004-06-03 03:38:44 +00001%{
2
3#include <string.h>
4#include <errno.h>
5#include <assert.h>
6
7#include "asn1parser.h"
8#include "asn1p_y.h"
9
10int asn1p_lex(void);
11void asn1p_lexer_hack_push_opaque_state(void); /* Used in .y */
12void asn1p_lexer_hack_enable_with_syntax(void); /* Used in .y */
vlm9283dbe2004-08-18 04:59:12 +000013void asn1p_lexer_hack_push_encoding_control(void); /* Used in .y */
vlmfa67ddc2004-06-03 03:38:44 +000014
15#define YY_FATAL_ERROR(msg) do { \
16 fprintf(stderr, \
17 "lexer error at line %d, " \
18 "text \"%s\"\n", \
19 yylineno, yytext); \
20 exit(1); \
21 } while(0)
22
23int asn1p_lexer_pedantic_1990 = 0;
24int asn1p_lexer_types_year = 0;
25int asn1p_lexer_constructs_year = 0;
vlmfa67ddc2004-06-03 03:38:44 +000026
vlm066dc102005-08-22 12:23:54 +000027int asn1p_as_pointer;
28
vlma6a84d72006-03-16 10:03:35 +000029static asn1c_integer_t _lex_atoi(const char *ptr);
30
vlmfa67ddc2004-06-03 03:38:44 +000031/*
32 * Check that the type is defined in the year of the standard choosen.
33 */
34#define TYPE_LIFETIME(fyr, lyr) \
35 (!asn1p_lexer_types_year \
36 || (fyr && fyr <= asn1p_lexer_types_year) \
37 || (lyr && lyr > asn1p_lexer_types_year))
38
39/*
40 * Check the the construction (or concept, i.e. CLASS) is defined in
41 * a given year.
42 */
43#define CONSTRUCT_LIFETIME(fyr, lyr) \
44 (!asn1p_lexer_constructs_year \
45 || (fyr && fyr <= asn1p_lexer_constructs_year) \
46 || (lyr && lyr > asn1p_lexer_constructs_year))
47
48/*
vlmfa67ddc2004-06-03 03:38:44 +000049 * Append quoted string.
50 */
51#define QAPPEND(text, tlen) do { \
52 char *prev_text = asn1p_lval.tv_opaque.buf; \
53 int prev_len = asn1p_lval.tv_opaque.len; \
54 char *p; \
55 \
56 p = malloc((tlen) + prev_len + 1); \
57 if(p == NULL) return -1; \
58 \
59 if(prev_text) memcpy(p, prev_text, prev_len); \
60 memcpy(p + prev_len, text, tlen); \
61 p[prev_len + (tlen)] = '\0'; \
62 \
63 free(asn1p_lval.tv_opaque.buf); \
64 asn1p_lval.tv_opaque.buf = p; \
65 asn1p_lval.tv_opaque.len = (tlen) + prev_len; \
66 } while(0)
67
68%}
69
70%option never-interactive
vlm9283dbe2004-08-18 04:59:12 +000071%option noinput
vlmfa67ddc2004-06-03 03:38:44 +000072%option noyywrap stack
73/* Performance penalty is OK */
74%option yylineno
75/* Controlled from within application */
76%option debug
77
78%pointer
79
80%x dash_comment
vlmb5abdc92005-07-02 21:42:40 +000081%x idash_comment
vlmfa67ddc2004-06-03 03:38:44 +000082%x cpp_comment
83%x quoted
84%x opaque
vlm9283dbe2004-08-18 04:59:12 +000085%x encoding_control
vlmfa67ddc2004-06-03 03:38:44 +000086%x with_syntax
87
88/* Newline */
89NL [\r\v\f\n]
90/* White-space */
91WSP [\t\r\v\f\n ]
92
93%%
94
vlmb5abdc92005-07-02 21:42:40 +000095-{3,}/[\r\n] /* Immediately terminated long comment */
96-{3,}/[^-\r\n] yy_push_state(idash_comment); /* Incorrect, but acceptable */
97<idash_comment>{
98 -{3,} yy_pop_state(); /* Acceptable end of comment */
99}
100
vlm177a5b62005-09-05 05:17:57 +0000101--<[ \t]*ASN1C.RepresentAsPointer[ \t]*>-- asn1p_as_pointer = 1;
102
vlm808411d2006-03-14 16:31:37 +0000103<INITIAL,with_syntax>-- yy_push_state(dash_comment);
vlmb5abdc92005-07-02 21:42:40 +0000104<dash_comment,idash_comment>{
vlmfa67ddc2004-06-03 03:38:44 +0000105
106 {NL} yy_pop_state();
107
108 -- yy_pop_state(); /* End of comment */
109 - /* Eat single dash */
vlm177a5b62005-09-05 05:17:57 +0000110 [^\r\v\f\n-]+ /* Eat */
vlmfa67ddc2004-06-03 03:38:44 +0000111}
vlmb5abdc92005-07-02 21:42:40 +0000112
vlm808411d2006-03-14 16:31:37 +0000113<INITIAL,cpp_comment,with_syntax>"/*" yy_push_state(cpp_comment);
vlmfa67ddc2004-06-03 03:38:44 +0000114<cpp_comment>{
vlm066dc102005-08-22 12:23:54 +0000115 [^*/<] /* Eat */
vlmfa67ddc2004-06-03 03:38:44 +0000116 "*/" yy_pop_state();
117 . /* Eat */
118}
119
120
121 /*
122 * This is state is being set from corresponding .y module when
123 * higher-level data is necessary to make proper parsing of the
124 * underlying data. Thus, we enter the <opaque> state and save
125 * everything for later processing.
126 */
127<opaque>{
128
129 "{" {
130 yy_push_state(opaque);
131 asn1p_lval.tv_opaque.buf = strdup(yytext);
132 asn1p_lval.tv_opaque.len = yyleng;
133 return TOK_opaque;
134 }
135
136 "}" {
137 yy_pop_state();
138 asn1p_lval.tv_opaque.buf = strdup(yytext);
139 asn1p_lval.tv_opaque.len = yyleng;
140 return TOK_opaque;
141 }
142
143 [^{}:=]+ {
144 asn1p_lval.tv_opaque.buf = strdup(yytext);
145 asn1p_lval.tv_opaque.len = yyleng;
146 return TOK_opaque;
147 }
148
149 "::=" {
150 fprintf(stderr,
151 "ASN.1 Parser syncronization failure: "
152 "\"%s\" at line %d must not appear "
153 "inside value definition\n",
154 yytext, yylineno);
155 return -1;
156 }
157
158 [:=] {
159 asn1p_lval.tv_opaque.buf = strdup(yytext);
160 asn1p_lval.tv_opaque.len = yyleng;
161 return TOK_opaque;
162 }
163
164 }
165
166\"[^\"]* {
167 asn1p_lval.tv_opaque.buf = 0;
168 asn1p_lval.tv_opaque.len = 0;
169 QAPPEND(yytext+1, yyleng-1);
170 yy_push_state(quoted);
171 }
172<quoted>{
173
174 \"\" { QAPPEND(yytext, yyleng-1); } /* Add a single quote */
175 [^\"]+ { QAPPEND(yytext, yyleng); }
176
177 \" {
178 yy_pop_state();
179 /* Do not append last quote:
180 // QAPPEND(yytext, yyleng); */
181
182 if(asn1p_lexer_pedantic_1990
183 && strchr(yytext, '\n')) {
184 fprintf(stderr, "%s: "
185 "Newlines are prohibited by ASN.1:1990\n",
186 asn1p_lval.tv_opaque.buf);
187 return -1;
188 }
189
190 return TOK_cstring;
191 }
192
193 }
194
vlm9283dbe2004-08-18 04:59:12 +0000195<encoding_control>{
196 ENCODING-CONTROL {
197 const char *s = "ENCODING-CONTROL";
198 const char *p = s + sizeof("ENCODING-CONTROL") - 2;
199 for(; p >= s; p--) unput(*p);
200 yy_pop_state();
201 }
202 END unput('D'); unput('N'); unput('E'); yy_pop_state();
203 [^{} \t\r\v\f\n]+
204 [[:alnum:]]+
205 . /* Eat everything else */
206 "\n"
207 }
vlmfa67ddc2004-06-03 03:38:44 +0000208
209'[0-9A-F \t\r\v\f\n]+'H {
210 /* " \t\r\n" weren't allowed in ASN.1:1990. */
211 asn1p_lval.tv_str = yytext;
212 return TOK_hstring;
213 }
214
215'[01 \t\r\v\f\n]+'B {
216 /* " \t\r\n" weren't allowed in ASN.1:1990. */
217 asn1p_lval.tv_str = strdup(yytext);
218 return TOK_bstring;
219 }
220
221
222-[1-9][0-9]* {
vlma6a84d72006-03-16 10:03:35 +0000223 asn1p_lval.a_int = _lex_atoi(yytext);
vlmfa67ddc2004-06-03 03:38:44 +0000224 if(errno == ERANGE)
225 return -1;
226 return TOK_number_negative;
227 }
228
229[1-9][0-9]* {
vlma6a84d72006-03-16 10:03:35 +0000230 asn1p_lval.a_int = _lex_atoi(yytext);
vlmfa67ddc2004-06-03 03:38:44 +0000231 if(errno == ERANGE)
232 return -1;
233 return TOK_number;
234 }
235
236"0" {
vlma6a84d72006-03-16 10:03:35 +0000237 asn1p_lval.a_int = _lex_atoi(yytext);
vlmfa67ddc2004-06-03 03:38:44 +0000238 if(errno == ERANGE)
239 return -1;
240 return TOK_number;
241 }
242
vlmfa67ddc2004-06-03 03:38:44 +0000243ABSENT return TOK_ABSENT;
vlmfa67ddc2004-06-03 03:38:44 +0000244ALL return TOK_ALL;
245ANY {
246 /* Appeared in 1990, removed in 1997 */
247 if(TYPE_LIFETIME(1990, 1997))
248 return TOK_ANY;
249 fprintf(stderr, "Keyword \"%s\" at line %d "
250 "is obsolete\n", yytext, yylineno);
251 REJECT;
252 }
253APPLICATION return TOK_APPLICATION;
254AUTOMATIC return TOK_AUTOMATIC;
255BEGIN return TOK_BEGIN;
256BIT return TOK_BIT;
257BMPString {
258 if(TYPE_LIFETIME(1994, 0))
259 return TOK_BMPString;
260 REJECT;
261 }
262BOOLEAN return TOK_BOOLEAN;
263BY return TOK_BY;
264CHARACTER return TOK_CHARACTER;
265CHOICE return TOK_CHOICE;
266CLASS return TOK_CLASS;
267COMPONENT return TOK_COMPONENT;
268COMPONENTS return TOK_COMPONENTS;
vlm6611add2005-03-20 14:28:32 +0000269CONSTRAINED return TOK_CONSTRAINED;
vlmfa67ddc2004-06-03 03:38:44 +0000270CONTAINING return TOK_CONTAINING;
271DEFAULT return TOK_DEFAULT;
272DEFINED {
273 /* Appeared in 1990, removed in 1997 */
274 if(TYPE_LIFETIME(1990, 1997))
275 return TOK_DEFINED;
276 fprintf(stderr, "Keyword \"%s\" at line %d "
277 "is obsolete\n", yytext, yylineno);
278 /* Deprecated since */
279 REJECT;
280 }
281DEFINITIONS return TOK_DEFINITIONS;
282EMBEDDED return TOK_EMBEDDED;
283ENCODED return TOK_ENCODED;
vlm9283dbe2004-08-18 04:59:12 +0000284ENCODING-CONTROL return TOK_ENCODING_CONTROL;
vlmfa67ddc2004-06-03 03:38:44 +0000285END return TOK_END;
286ENUMERATED return TOK_ENUMERATED;
287EXCEPT return TOK_EXCEPT;
288EXPLICIT return TOK_EXPLICIT;
289EXPORTS return TOK_EXPORTS;
290EXTENSIBILITY return TOK_EXTENSIBILITY;
291EXTERNAL return TOK_EXTERNAL;
292FALSE return TOK_FALSE;
293FROM return TOK_FROM;
294GeneralizedTime return TOK_GeneralizedTime;
295GeneralString return TOK_GeneralString;
296GraphicString return TOK_GraphicString;
297IA5String return TOK_IA5String;
298IDENTIFIER return TOK_IDENTIFIER;
299IMPLICIT return TOK_IMPLICIT;
300IMPLIED return TOK_IMPLIED;
301IMPORTS return TOK_IMPORTS;
302INCLUDES return TOK_INCLUDES;
303INSTANCE return TOK_INSTANCE;
vlm9283dbe2004-08-18 04:59:12 +0000304INSTRUCTIONS return TOK_INSTRUCTIONS;
vlmfa67ddc2004-06-03 03:38:44 +0000305INTEGER return TOK_INTEGER;
306INTERSECTION return TOK_INTERSECTION;
307ISO646String return TOK_ISO646String;
308MAX return TOK_MAX;
309MIN return TOK_MIN;
310MINUS-INFINITY return TOK_MINUS_INFINITY;
311NULL return TOK_NULL;
312NumericString return TOK_NumericString;
313OBJECT return TOK_OBJECT;
314ObjectDescriptor return TOK_ObjectDescriptor;
315OCTET return TOK_OCTET;
316OF return TOK_OF;
317OPTIONAL return TOK_OPTIONAL;
318PATTERN return TOK_PATTERN;
319PDV return TOK_PDV;
320PLUS-INFINITY return TOK_PLUS_INFINITY;
321PRESENT return TOK_PRESENT;
322PrintableString return TOK_PrintableString;
323PRIVATE return TOK_PRIVATE;
324REAL return TOK_REAL;
325RELATIVE-OID return TOK_RELATIVE_OID;
326SEQUENCE return TOK_SEQUENCE;
327SET return TOK_SET;
328SIZE return TOK_SIZE;
329STRING return TOK_STRING;
330SYNTAX return TOK_SYNTAX;
331T61String return TOK_T61String;
332TAGS return TOK_TAGS;
333TeletexString return TOK_TeletexString;
334TRUE return TOK_TRUE;
vlmfa67ddc2004-06-03 03:38:44 +0000335UNION return TOK_UNION;
336UNIQUE return TOK_UNIQUE;
337UNIVERSAL return TOK_UNIVERSAL;
338UniversalString {
339 if(TYPE_LIFETIME(1994, 0))
340 return TOK_UniversalString;
341 REJECT;
342 }
343UTCTime return TOK_UTCTime;
344UTF8String {
345 if(TYPE_LIFETIME(1994, 0))
346 return TOK_UTF8String;
347 REJECT;
348 }
349VideotexString return TOK_VideotexString;
350VisibleString return TOK_VisibleString;
351WITH return TOK_WITH;
352
353
vlmb5abdc92005-07-02 21:42:40 +0000354<INITIAL,with_syntax>&[A-Z][A-Za-z0-9]*([-][A-Za-z0-9]+)* {
vlmfa67ddc2004-06-03 03:38:44 +0000355 asn1p_lval.tv_str = strdup(yytext);
356 return TOK_typefieldreference;
357 }
358
vlmb5abdc92005-07-02 21:42:40 +0000359<INITIAL,with_syntax>&[a-z][a-zA-Z0-9]*([-][a-zA-Z0-9]+)* {
vlmfa67ddc2004-06-03 03:38:44 +0000360 asn1p_lval.tv_str = strdup(yytext);
361 return TOK_valuefieldreference;
362 }
363
364
vlmb5abdc92005-07-02 21:42:40 +0000365[a-z][a-zA-Z0-9]*([-][a-zA-Z0-9]+)* {
vlmfa67ddc2004-06-03 03:38:44 +0000366 asn1p_lval.tv_str = strdup(yytext);
367 return TOK_identifier;
368 }
369
370 /*
371 * objectclassreference
372 */
vlmb5abdc92005-07-02 21:42:40 +0000373[A-Z][A-Z0-9]*([-][A-Z0-9]+)* {
vlmfa67ddc2004-06-03 03:38:44 +0000374 asn1p_lval.tv_str = strdup(yytext);
vlm9283dbe2004-08-18 04:59:12 +0000375 return TOK_capitalreference;
vlmfa67ddc2004-06-03 03:38:44 +0000376 }
377
378 /*
379 * typereference, modulereference
380 * NOTE: TOK_objectclassreference must be combined
381 * with this token to produce true typereference.
382 */
vlmb5abdc92005-07-02 21:42:40 +0000383[A-Z][A-Za-z0-9]*([-][A-Za-z0-9]+)* {
vlmfa67ddc2004-06-03 03:38:44 +0000384 asn1p_lval.tv_str = strdup(yytext);
385 return TOK_typereference;
386 }
387
388"::=" return TOK_PPEQ;
389
390"..." return TOK_ThreeDots;
391".." return TOK_TwoDots;
392
vlmfa67ddc2004-06-03 03:38:44 +0000393<with_syntax>{
394
vlm808411d2006-03-14 16:31:37 +0000395 [A-Z][A-Za-z0-9]*([-][A-Za-z0-9]+)* {
396 asn1p_lval.tv_str = strdup(yytext);
397 return TOK_Literal;
vlmfa67ddc2004-06-03 03:38:44 +0000398 }
399
vlm808411d2006-03-14 16:31:37 +0000400 "," {
401 asn1p_lval.tv_str = strdup(yytext);
402 return TOK_Literal;
403 }
404
405 "{" {
406 yy_push_state(with_syntax);
407 asn1p_lval.tv_str = strdup(yytext);
408 return TOK_Literal;
409 }
410
411 "[" return '[';
412 "]" return ']';
413
vlmfa67ddc2004-06-03 03:38:44 +0000414 {WSP}+ {
415 asn1p_lval.tv_opaque.buf = strdup(yytext);
416 asn1p_lval.tv_opaque.len = yyleng;
vlmeeb3c512006-03-16 05:11:14 +0000417 return TOK_whitespace;
vlmfa67ddc2004-06-03 03:38:44 +0000418 }
419
420 "}" {
421 yy_pop_state();
vlm808411d2006-03-14 16:31:37 +0000422 if(YYSTATE == with_syntax) {
423 asn1p_lval.tv_str = strdup(yytext);
424 return TOK_Literal;
425 } else {
426 return '}';
427 }
vlmfa67ddc2004-06-03 03:38:44 +0000428 }
429
430}
431
vlm2c8c44d2005-03-24 16:22:35 +0000432
433{WSP}+ /* Ignore whitespace */
434
435
436[{][\t\r\v\f\n ]*[0-7][,][\t\r\v\f\n ]*[0-9]+[\t\r\v\f\n ]*[}] {
437 asn1c_integer_t v1 = -1, v2 = -1;
438 char *p;
439 for(p = yytext; *p; p++)
440 if(*p >= '0' && *p <= '9')
vlma6a84d72006-03-16 10:03:35 +0000441 { v1 = _lex_atoi(p); break; }
vlm2c8c44d2005-03-24 16:22:35 +0000442 while(*p >= '0' && *p <= '9') p++; /* Skip digits */
443 for(; *p; p++) if(*p >= '0' && *p <= '9')
vlma6a84d72006-03-16 10:03:35 +0000444 { v2 = _lex_atoi(p); break; }
vlm2c8c44d2005-03-24 16:22:35 +0000445 if(v1 < 0 || v1 > 7) {
446 fprintf(stderr, "%s at line %d: X.680:2003, #37.14 "
447 "mandates 0..7 range for Tuple's TableColumn\n",
448 yytext, yylineno);
449 return -1;
450 }
451 if(v2 < 0 || v2 > 15) {
452 fprintf(stderr, "%s at line %d: X.680:2003, #37.14 "
453 "mandates 0..15 range for Tuple's TableRow\n",
454 yytext, yylineno);
455 return -1;
456 }
457 asn1p_lval.a_int = (v1 << 4) + v2;
458 return TOK_tuple;
459 }
460
461[{][\t\r\v\f\n ]*[0-9]+[,][\t\r\v\f\n ]*[0-9]+[,][\t\r\v\f\n ]*[0-9]+[,][\t\r\v\f\n ]*[0-9]+[\t\r\v\f\n ]*[}] {
462 asn1c_integer_t v1 = -1, v2 = -1, v3 = -1, v4 = -1;
463 char *p;
464 for(p = yytext; *p; p++)
465 if(*p >= '0' && *p <= '9')
vlma6a84d72006-03-16 10:03:35 +0000466 { v1 = _lex_atoi(p); break; }
vlm2c8c44d2005-03-24 16:22:35 +0000467 while(*p >= '0' && *p <= '9') p++; /* Skip digits */
468 for(; *p; p++) if(*p >= '0' && *p <= '9')
vlma6a84d72006-03-16 10:03:35 +0000469 { v2 = _lex_atoi(p); break; }
vlm2c8c44d2005-03-24 16:22:35 +0000470 while(*p >= '0' && *p <= '9') p++;
471 for(; *p; p++) if(*p >= '0' && *p <= '9')
vlma6a84d72006-03-16 10:03:35 +0000472 { v3 = _lex_atoi(p); break; }
vlm2c8c44d2005-03-24 16:22:35 +0000473 while(*p >= '0' && *p <= '9') p++;
474 for(; *p; p++) if(*p >= '0' && *p <= '9')
vlma6a84d72006-03-16 10:03:35 +0000475 { v4 = _lex_atoi(p); break; }
vlm2c8c44d2005-03-24 16:22:35 +0000476 if(v1 < 0 || v1 > 127) {
477 fprintf(stderr, "%s at line %d: X.680:2003, #37.12 "
478 "mandates 0..127 range for Quadruple's Group\n",
479 yytext, yylineno);
480 return -1;
481 }
482 if(v2 < 0 || v2 > 255) {
483 fprintf(stderr, "%s at line %d: X.680:2003, #37.12 "
484 "mandates 0..255 range for Quadruple's Plane\n",
485 yytext, yylineno);
486 return -1;
487 }
488 if(v3 < 0 || v3 > 255) {
489 fprintf(stderr, "%s at line %d: X.680:2003, #37.12 "
490 "mandates 0..255 range for Quadruple's Row\n",
491 yytext, yylineno);
492 return -1;
493 }
494 if(v4 < 0 || v4 > 255) {
495 fprintf(stderr, "%s at line %d: X.680:2003, #37.12 "
496 "mandates 0..255 range for Quadruple's Cell\n",
497 yytext, yylineno);
498 return -1;
499 }
500 asn1p_lval.a_int = (v1 << 24) | (v2 << 16) | (v3 << 8) | v4;
501 return TOK_quadruple;
502 }
503
504
505[(){},;:|!.&@\[\]^] return yytext[0];
506
507[^A-Za-z0-9:=,{}<.@()[]'\"|&^*;!-] {
508 if(TYPE_LIFETIME(1994, 0))
509 fprintf(stderr, "ERROR: ");
510 fprintf(stderr,
511 "Symbol '%c' at line %d is prohibited "
512 "by ASN.1:1994 and ASN.1:1997\n",
513 yytext[0], yylineno);
514 if(TYPE_LIFETIME(1994, 0))
515 return -1;
516 }
vlmfa67ddc2004-06-03 03:38:44 +0000517
518<*>. {
519 fprintf(stderr,
520 "Unexpected token at line %d: \"%s\"\n",
521 yylineno, yytext);
522 while(YYSTATE != INITIAL)
523 yy_pop_state();
vlmc94e28f2004-09-15 11:59:51 +0000524 if(0) {
525 yy_top_state(); /* Just to use this function. */
526 yy_fatal_error("Parse error");
527 }
vlmfa67ddc2004-06-03 03:38:44 +0000528 return -1;
529}
530
531<*><<EOF>> {
532 while(YYSTATE != INITIAL)
533 yy_pop_state();
534 yyterminate();
535 }
536
537
538%%
539
540/*
541 * Very dirty but wonderful hack allowing to rule states from within .y file.
542 */
vlm9283dbe2004-08-18 04:59:12 +0000543void asn1p_lexer_hack_push_opaque_state() { yy_push_state(opaque); }
vlmfa67ddc2004-06-03 03:38:44 +0000544
545/*
546 * Another hack which disables recognizing some tokens when inside WITH SYNTAX.
547 */
vlm9283dbe2004-08-18 04:59:12 +0000548void asn1p_lexer_hack_enable_with_syntax() { yy_push_state(with_syntax); }
549
550/* Yet another */
551void asn1p_lexer_hack_push_encoding_control() {
552 yy_push_state(encoding_control);
vlmfa67ddc2004-06-03 03:38:44 +0000553}
554
vlm2728a8d2005-01-23 09:51:44 +0000555static asn1c_integer_t
vlma6a84d72006-03-16 10:03:35 +0000556_lex_atoi(const char *ptr) {
vlm2728a8d2005-01-23 09:51:44 +0000557 asn1c_integer_t value;
vlma6a84d72006-03-16 10:03:35 +0000558 if(asn1p_atoi(ptr, &value)) {
vlmfa67ddc2004-06-03 03:38:44 +0000559 fprintf(stderr,
560 "Value \"%s\" at line %d is too large "
vlm86912f02005-04-05 08:46:22 +0000561 "for this compiler! Please contact the asn1c author.\n",
vlmfa67ddc2004-06-03 03:38:44 +0000562 ptr, yylineno);
vlma6a84d72006-03-16 10:03:35 +0000563 errno = ERANGE;
vlmfa67ddc2004-06-03 03:38:44 +0000564 }
vlmfa67ddc2004-06-03 03:38:44 +0000565 return value;
566}