Commit 557f27de authored by Lev Walkin's avatar Lev Walkin

valuesettypeassignment parsing

parent 171487e6
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Refactored Information Object Classes parsing. * Refactored Information Object Classes parsing.
* Refactored Parameterization support. * Refactored Parameterization support.
* [typedef enum foo {}] foo_e; is now e_foo, see #1287989 * [typedef enum foo {}] foo_e; is now e_foo, see #1287989
* Refactored ValueSetTypeAssignment parsing.
0.9.20: 2006-Mar-06 0.9.20: 2006-Mar-06
......
This diff is collapsed.
...@@ -251,7 +251,8 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr); ...@@ -251,7 +251,8 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
%type <a_expr> Type %type <a_expr> Type
%type <a_expr> DataTypeReference /* Type1 ::= Type2 */ %type <a_expr> DataTypeReference /* Type1 ::= Type2 */
%type <a_expr> DefinedType %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_expr> ValueDefinition /* val INTEGER ::= 1*/
%type <a_value> Value %type <a_value> Value
%type <a_value> SimpleValue %type <a_value> SimpleValue
...@@ -554,7 +555,7 @@ ModuleSpecificationElement: ...@@ -554,7 +555,7 @@ ModuleSpecificationElement:
* EvenNumbers INTEGER ::= { 2 | 4 | 6 | 8 } * EvenNumbers INTEGER ::= { 2 | 4 | 6 | 8 }
* === EOF === * === EOF ===
*/ */
| ValueSetDefinition { | ValueSetTypeAssignment {
$$ = asn1p_module_new(); $$ = asn1p_module_new();
checkmem($$); checkmem($$);
assert($1->expr_type != A1TC_INVALID); assert($1->expr_type != A1TC_INVALID);
...@@ -712,14 +713,15 @@ ExportsElement: ...@@ -712,14 +713,15 @@ ExportsElement:
; ;
ValueSetDefinition: ValueSet: '{' ElementSetSpecs '}' { $$ = $2; }
TypeRefName DefinedType TOK_PPEQ
'{' { asn1p_lexer_hack_push_opaque_state(); } Opaque /* '}' */ { ValueSetTypeAssignment:
TypeRefName DefinedType TOK_PPEQ ValueSet {
$$ = $2; $$ = $2;
assert($$->Identifier == 0); assert($$->Identifier == 0);
$$->Identifier = $1; $$->Identifier = $1;
$$->meta_type = AMT_VALUESET; $$->meta_type = AMT_VALUESET;
/* take care of ValueSet body */ $$->constraints = $4;
} }
; ;
......
...@@ -607,7 +607,6 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri ...@@ -607,7 +607,6 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
*/ */
if(TQ_FIRST(&(tc->members)) if(TQ_FIRST(&(tc->members))
|| (tc->expr_type & ASN_CONSTR_MASK) || (tc->expr_type & ASN_CONSTR_MASK)
|| tc->meta_type == AMT_VALUESET
|| tc->meta_type == AMT_OBJECT || tc->meta_type == AMT_OBJECT
|| tc->meta_type == AMT_OBJECTCLASS || tc->meta_type == AMT_OBJECTCLASS
|| tc->meta_type == AMT_OBJECTFIELD || tc->meta_type == AMT_OBJECTFIELD
...@@ -675,7 +674,11 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri ...@@ -675,7 +674,11 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
if(!SEQ_OF && tc->constraints) { if(!SEQ_OF && tc->constraints) {
printf(" "); printf(" ");
if(tc->meta_type == AMT_VALUESET)
printf("{");
asn1print_constraint(tc->constraints, flags); asn1print_constraint(tc->constraints, flags);
if(tc->meta_type == AMT_VALUESET)
printf("}");
} }
if(tc->unique) { if(tc->unique) {
......
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