Commit c6ab03c7 authored by Lev Walkin's avatar Lev Walkin

multiple constraints of different type and value assignment

parent 8e81b766
This diff is collapsed.
......@@ -275,7 +275,7 @@ static asn1p_module_t *currentModule;
%type <a_expr> DefinedType
%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> ValueAssignment /* val INTEGER ::= 1*/
%type <a_value> Value
%type <a_value> SimpleValue
%type <a_value> DefinedValue
......@@ -557,7 +557,7 @@ Assignment:
assert($1->meta_type != AMT_INVALID);
TQ_ADD(&($$->members), $1, next);
}
| ValueDefinition {
| ValueAssignment {
$$ = asn1p_module_new();
checkmem($$);
assert($1->expr_type != A1TC_INVALID);
......@@ -1463,8 +1463,8 @@ DefinedObjectClass:
* value INTEGER ::= 1
* === EOF ===
*/
ValueDefinition:
Identifier DefinedType TOK_PPEQ Value {
ValueAssignment:
Identifier Type TOK_PPEQ Value {
$$ = $2;
assert($$->Identifier == NULL);
$$->Identifier = $1;
......@@ -1707,9 +1707,6 @@ optConstraints:
Constraint:
SubtypeConstraint
| '(' GeneralConstraint ')' {
$$ = $2;
}
;
SubtypeConstraint:
......@@ -1756,6 +1753,9 @@ ElementSetSpecs:
ct = $$;
CONSTRAINT_INSERT($$, ACT_CA_CSV, ct, $5);
}
| GeneralConstraint {
$$ = $1;
}
;
ElementSetSpec:
......
......@@ -354,24 +354,21 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
}
break;
case ACT_CT_CTDBY:
printf("(CONSTRAINED BY ");
printf("CONSTRAINED BY ");
assert(ct->value->type == ATV_UNPARSED);
fwrite(ct->value->value.string.buf,
1, ct->value->value.string.size, stdout);
printf(")");
break;
case ACT_CT_CTNG:
printf("(CONTAINING ");
printf("CONTAINING ");
asn1print_expr(ct->value->value.v_type->module->asn1p,
ct->value->value.v_type->module,
ct->value->value.v_type,
flags, 1);
printf(")");
break;
case ACT_CT_PATTERN:
printf("(PATTERN ");
printf("PATTERN ");
asn1print_value(ct->value, flags);
printf(")");
break;
case ACT_CA_SET: symno++;
case ACT_CA_CRC: symno++;
......@@ -383,7 +380,6 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
char *symtable[] = { " EXCEPT ", " ^ ", " | ", ",",
"", "(" };
unsigned int i;
if(ct->type == ACT_CA_CRC) fputs("(", stdout);
for(i = 0; i < ct->el_count; i++) {
if(i) fputs(symtable[symno], stdout);
if(ct->type == ACT_CA_CRC) fputs("{", stdout);
......@@ -393,7 +389,6 @@ asn1print_constraint(asn1p_constraint_t *ct, enum asn1print_flags flags) {
&& ct->type == ACT_CA_SET)
fputs(")", stdout);
}
if(ct->type == ACT_CA_CRC) fputs(")", stdout);
}
break;
case ACT_CA_AEX:
......
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