valuesettypeassignment parsing

This commit is contained in:
Lev Walkin 2006-03-21 07:46:48 +00:00
parent 171487e6ed
commit 557f27defc
4 changed files with 660 additions and 646 deletions

View File

@ -7,6 +7,7 @@
* Refactored Information Object Classes parsing.
* Refactored Parameterization support.
* [typedef enum foo {}] foo_e; is now e_foo, see #1287989
* Refactored ValueSetTypeAssignment parsing.
0.9.20: 2006-Mar-06

File diff suppressed because it is too large Load Diff

View File

@ -251,7 +251,8 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
%type <a_expr> Type
%type <a_expr> DataTypeReference /* Type1 ::= Type2 */
%type <a_expr> DefinedType
%type <a_expr> ValueSetDefinition /* Val INTEGER ::= {1|2} */
%type <a_constr> ValueSet /* {a|b|c}*/
%type <a_expr> ValueSetTypeAssignment /* Val INTEGER ::= {1|2} */
%type <a_expr> ValueDefinition /* val INTEGER ::= 1*/
%type <a_value> Value
%type <a_value> SimpleValue
@ -554,7 +555,7 @@ ModuleSpecificationElement:
* EvenNumbers INTEGER ::= { 2 | 4 | 6 | 8 }
* === EOF ===
*/
| ValueSetDefinition {
| ValueSetTypeAssignment {
$$ = asn1p_module_new();
checkmem($$);
assert($1->expr_type != A1TC_INVALID);
@ -712,14 +713,15 @@ ExportsElement:
;
ValueSetDefinition:
TypeRefName DefinedType TOK_PPEQ
'{' { asn1p_lexer_hack_push_opaque_state(); } Opaque /* '}' */ {
ValueSet: '{' ElementSetSpecs '}' { $$ = $2; }
ValueSetTypeAssignment:
TypeRefName DefinedType TOK_PPEQ ValueSet {
$$ = $2;
assert($$->Identifier == 0);
$$->Identifier = $1;
$$->meta_type = AMT_VALUESET;
/* take care of ValueSet body */
$$->constraints = $4;
}
;

View File

@ -607,7 +607,6 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
*/
if(TQ_FIRST(&(tc->members))
|| (tc->expr_type & ASN_CONSTR_MASK)
|| tc->meta_type == AMT_VALUESET
|| tc->meta_type == AMT_OBJECT
|| tc->meta_type == AMT_OBJECTCLASS
|| tc->meta_type == AMT_OBJECTFIELD
@ -675,7 +674,11 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
if(!SEQ_OF && tc->constraints) {
printf(" ");
if(tc->meta_type == AMT_VALUESET)
printf("{");
asn1print_constraint(tc->constraints, flags);
if(tc->meta_type == AMT_VALUESET)
printf("}");
}
if(tc->unique) {