add ENUMERATED and OBJECT IDENTIFIER

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10741 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2001-09-25 13:39:27 +00:00
parent 680399419e
commit 2bcae56ac3
18 changed files with 323 additions and 26 deletions

View File

@@ -61,10 +61,12 @@ static void append (Member *l, Member *r);
}
%token INTEGER SEQUENCE OF OCTET STRING GeneralizedTime GeneralString
%token BIT APPLICATION OPTIONAL EEQUAL TBEGIN END DEFINITIONS EXTERNAL
%token BIT APPLICATION OPTIONAL EEQUAL TBEGIN END DEFINITIONS ENUMERATED
%token EXTERNAL
%token DOTDOT
%token IMPORTS FROM
%token <name> IDENTIFIER
%token OBJECT IDENTIFIER
%token <name> IDENT
%token <constant> CONSTANT
%type <constant> constant optional2
@@ -75,7 +77,7 @@ static void append (Member *l, Member *r);
%%
envelope : IDENTIFIER DEFINITIONS EEQUAL TBEGIN specification END {}
envelope : IDENT DEFINITIONS EEQUAL TBEGIN specification END {}
;
specification :
@@ -87,22 +89,22 @@ declaration : imports_decl
| constant_decl
;
referencenames : IDENTIFIER ',' referencenames
referencenames : IDENT ',' referencenames
{
Symbol *s = addsym($1);
s->stype = Stype;
}
| IDENTIFIER
| IDENT
{
Symbol *s = addsym($1);
s->stype = Stype;
}
;
imports_decl : IMPORTS referencenames FROM IDENTIFIER ';'
imports_decl : IMPORTS referencenames FROM IDENT ';'
;
type_decl : IDENTIFIER EEQUAL type
type_decl : IDENT EEQUAL type
{
Symbol *s = addsym ($1);
s->stype = Stype;
@@ -111,7 +113,7 @@ type_decl : IDENTIFIER EEQUAL type
}
;
constant_decl : IDENTIFIER type EEQUAL constant
constant_decl : IDENT type EEQUAL constant
{
Symbol *s = addsym ($1);
s->stype = SConstant;
@@ -134,6 +136,12 @@ type : INTEGER { $$ = new_type(TInteger); }
$$ = new_type(TInteger);
$$->members = $3;
}
| OBJECT IDENTIFIER { $$ = new_type(TOID); }
| ENUMERATED '{' bitdecls '}'
{
$$ = new_type(TEnumerated);
$$->members = $3;
}
| OCTET STRING { $$ = new_type(TOctetString); }
| GeneralString { $$ = new_type(TGeneralString); }
| GeneralizedTime { $$ = new_type(TGeneralizedTime); }
@@ -152,7 +160,7 @@ type : INTEGER { $$ = new_type(TInteger); }
$$ = new_type(TBitString);
$$->members = $4;
}
| IDENTIFIER
| IDENT
{
Symbol *s = addsym($1);
$$ = new_type(TType);
@@ -174,7 +182,7 @@ memberdecls : { $$ = NULL; }
| memberdecls ',' memberdecl { $$ = $1; append($$, $3); }
;
memberdecl : IDENTIFIER '[' constant ']' type optional2
memberdecl : IDENT '[' constant ']' type optional2
{
$$ = malloc(sizeof(*$$));
$$->name = $1;
@@ -196,7 +204,7 @@ bitdecls : { $$ = NULL; }
| bitdecls ',' bitdecl { $$ = $1; append($$, $3); }
;
bitdecl : IDENTIFIER '(' constant ')'
bitdecl : IDENT '(' constant ')'
{
$$ = malloc(sizeof(*$$));
$$->name = $1;
@@ -210,7 +218,7 @@ bitdecl : IDENTIFIER '(' constant ')'
;
constant : CONSTANT { $$ = $1; }
| IDENTIFIER {
| IDENT {
Symbol *s = addsym($1);
if(s->stype != SConstant)
error_message ("%s is not a constant\n",