Commit c603f107 authored by Lev Walkin's avatar Lev Walkin

ignoring spaces within tags

parent 8f9d2bd6
...@@ -447,9 +447,9 @@ distclean-generic: ...@@ -447,9 +447,9 @@ distclean-generic:
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
-rm -f asn1p_l.c
-rm -f asn1p_y.h
-rm -f asn1p_y.c -rm -f asn1p_y.c
-rm -f asn1p_y.h
-rm -f asn1p_l.c
clean: clean-am clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -24,7 +24,7 @@ int asn1p_lexer_pedantic_1990 = 0; ...@@ -24,7 +24,7 @@ int asn1p_lexer_pedantic_1990 = 0;
int asn1p_lexer_types_year = 0; int asn1p_lexer_types_year = 0;
int asn1p_lexer_constructs_year = 0; int asn1p_lexer_constructs_year = 0;
static int _check_dashes(char *ptr); static int _check_dashes(char *ptr);
static asn1_integer_t asn1p_atoi(char *ptr); /* errno is either 0 or ERANGE */ static asn1c_integer_t asn1p_atoi(char *ptr); /* errno is either 0 or ERANGE */
/* /*
* Check that the type is defined in the year of the standard choosen. * Check that the type is defined in the year of the standard choosen.
...@@ -240,50 +240,6 @@ WSP [\t\r\v\f\n ] ...@@ -240,50 +240,6 @@ WSP [\t\r\v\f\n ]
return TOK_number; return TOK_number;
} }
/*
* Tags
*/
\[(UNIVERSAL[ \t\r\v\f\n]+|APPLICATION[ \t\r\v\f\n]+|PRIVATE[ \t\r\v\f\n]+)?[0-9]+\] {
char *p;
memset(&asn1p_lval.a_tag, 0, sizeof(asn1p_lval.a_tag));
switch(yytext[1]) {
case 'U':
asn1p_lval.a_tag.tag_class = TC_UNIVERSAL;
p = yytext + sizeof("UNIVERSAL") + 1;
break;
case 'A':
asn1p_lval.a_tag.tag_class = TC_APPLICATION;
p = yytext + sizeof("APPLICATION") + 1;
break;
case 'P':
asn1p_lval.a_tag.tag_class = TC_PRIVATE;
p = yytext + sizeof("PRIVATE") + 1;
break;
default:
assert(yytext[1] >= '0' && yytext[1] <= '9');
asn1p_lval.a_tag.tag_class = TC_CONTEXT_SPECIFIC;
p = yytext + 1;
break;
}
asn1p_lval.a_tag.tag_value = asn1p_atoi(p);
if(*p == '0' && asn1p_lval.a_tag.tag_value) {
fprintf(stderr,
"Tag value at line %d "
"cannot start with zero "
"and have multiple digits: \"%s\"\n",
yylineno, yytext);
return -1;
}
return TOK_tag;
}
\[[A-Z]+[ \t\r\v\f\n]+[0-9]+\] {
fprintf(stderr,
"Unsupported tag syntax at line %d: \"%s\"\n",
yylineno, yytext);
return -1;
}
ABSENT return TOK_ABSENT; ABSENT return TOK_ABSENT;
/* /*
ABSTRACT-SYNTAX return TOK_ABSTRACT_SYNTAX; ABSTRACT-SYNTAX return TOK_ABSTRACT_SYNTAX;
...@@ -443,10 +399,10 @@ WITH return TOK_WITH; ...@@ -443,10 +399,10 @@ WITH return TOK_WITH;
"..." return TOK_ThreeDots; "..." return TOK_ThreeDots;
".." return TOK_TwoDots; ".." return TOK_TwoDots;
[(){},;:|!.&@\[\]] return yytext[0];
{WSP}+ /* Ignore whitespace */ {WSP}+ /* Ignore whitespace */
[(){},;:|!.&@\[\]] return yytext[0];
[^A-Za-z0-9:=,{}<.@()[]'\"|&^*;!-] { [^A-Za-z0-9:=,{}<.@()[]'\"|&^*;!-] {
if(TYPE_LIFETIME(1994, 0)) if(TYPE_LIFETIME(1994, 0))
fprintf(stderr, "ERROR: "); fprintf(stderr, "ERROR: ");
...@@ -550,9 +506,9 @@ _check_dashes(char *ptr) { ...@@ -550,9 +506,9 @@ _check_dashes(char *ptr) {
return 0; return 0;
} }
static asn1_integer_t static asn1c_integer_t
asn1p_atoi(char *ptr) { asn1p_atoi(char *ptr) {
asn1_integer_t value; asn1c_integer_t value;
errno = 0; /* Clear the error code */ errno = 0; /* Clear the error code */
if(sizeof(value) <= sizeof(int)) { if(sizeof(value) <= sizeof(int)) {
......
This diff is collapsed.
...@@ -128,7 +128,6 @@ typedef union { ...@@ -128,7 +128,6 @@ typedef union {
#define TOK_UNION 352 #define TOK_UNION 352
#define TOK_TwoDots 353 #define TOK_TwoDots 353
#define TOK_ThreeDots 354 #define TOK_ThreeDots 354
#define TOK_tag 355
extern YYSTYPE asn1p_lval; extern YYSTYPE asn1p_lval;
...@@ -196,7 +196,6 @@ static asn1p_value_t * ...@@ -196,7 +196,6 @@ static asn1p_value_t *
/* Misc tags */ /* Misc tags */
%token TOK_TwoDots /* .. */ %token TOK_TwoDots /* .. */
%token TOK_ThreeDots /* ... */ %token TOK_ThreeDots /* ... */
%token <a_tag> TOK_tag /* [0] */
/* /*
...@@ -266,7 +265,8 @@ static asn1p_value_t * ...@@ -266,7 +265,8 @@ static asn1p_value_t *
%type <a_type> BasicString %type <a_type> BasicString
%type <tv_opaque> Opaque %type <tv_opaque> Opaque
//%type <tv_opaque> StringValue //%type <tv_opaque> StringValue
%type <a_tag> Tag /* [UNIVERSAL 0] IMPLICIT */ %type <a_tag> Tag /* [UNIVERSAL 0] IMPLICIT */
%type <a_tag> TagClass TagTypeValue TagPlicit
%type <a_tag> optTag /* [UNIVERSAL 0] IMPLICIT */ %type <a_tag> optTag /* [UNIVERSAL 0] IMPLICIT */
%type <a_constr> optConstraints %type <a_constr> optConstraints
%type <a_constr> Constraints %type <a_constr> Constraints
...@@ -1942,20 +1942,31 @@ optTag: ...@@ -1942,20 +1942,31 @@ optTag:
; ;
Tag: Tag:
TOK_tag { TagTypeValue TagPlicit {
$$ = $1; $$ = $1;
$$.tag_mode = TM_DEFAULT; $$.tag_mode = $2.tag_mode;
}
| TOK_tag TOK_IMPLICIT {
$$ = $1;
$$.tag_mode = TM_IMPLICIT;
}
| TOK_tag TOK_EXPLICIT {
$$ = $1;
$$.tag_mode = TM_EXPLICIT;
} }
; ;
TagTypeValue:
'[' TagClass TOK_number ']' {
$$ = $2;
$$.tag_value = $3;
};
TagClass:
{ $$.tag_class = TC_CONTEXT_SPECIFIC; }
| TOK_UNIVERSAL { $$.tag_class = TC_UNIVERSAL; }
| TOK_APPLICATION { $$.tag_class = TC_APPLICATION; }
| TOK_PRIVATE { $$.tag_class = TC_PRIVATE; }
;
TagPlicit:
{ $$.tag_mode = TM_DEFAULT; }
| TOK_IMPLICIT { $$.tag_mode = TM_IMPLICIT; }
| TOK_EXPLICIT { $$.tag_mode = TM_EXPLICIT; }
;
TypeRefName: TypeRefName:
TOK_typereference { TOK_typereference {
checkmem($1); checkmem($1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment