precedence based parsing of constraints

git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1231 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
vlm 2006-09-21 01:50:37 +00:00
parent e54d16a386
commit 1bc782fc4d
2 changed files with 890 additions and 880 deletions

File diff suppressed because it is too large Load Diff

View File

@ -226,7 +226,7 @@ static asn1p_module_t *currentModule;
%token TOK_VisibleString %token TOK_VisibleString
%token TOK_WITH %token TOK_WITH
%left TOK_EXCEPT %nonassoc TOK_EXCEPT
%left '^' TOK_INTERSECTION %left '^' TOK_INTERSECTION
%left '|' TOK_UNION %left '|' TOK_UNION
@ -316,6 +316,9 @@ static asn1p_module_t *currentModule;
%type <a_constr> SetOfConstraints %type <a_constr> SetOfConstraints
%type <a_constr> ElementSetSpecs /* 1..2,...,3 */ %type <a_constr> ElementSetSpecs /* 1..2,...,3 */
%type <a_constr> ElementSetSpec /* 1..2,...,3 */ %type <a_constr> ElementSetSpec /* 1..2,...,3 */
%type <a_constr> Unions
%type <a_constr> Intersections
%type <a_constr> IntersectionElements
%type <a_constr> ConstraintSubtypeElement /* 1..2 */ %type <a_constr> ConstraintSubtypeElement /* 1..2 */
%type <a_constr> SimpleTableConstraint %type <a_constr> SimpleTableConstraint
%type <a_constr> UserDefinedConstraint %type <a_constr> UserDefinedConstraint
@ -1686,9 +1689,8 @@ BasicString:
/* /*
* Data type constraints. * Data type constraints.
*/ */
Union: '|' | TOK_UNION; UnionMark: '|' | TOK_UNION;
Intersection: '^' | TOK_INTERSECTION; IntersectionMark: '^' | TOK_INTERSECTION;
Except: TOK_EXCEPT;
optConstraints: optConstraints:
{ $$ = 0; } { $$ = 0; }
@ -1751,19 +1753,30 @@ ElementSetSpecs:
; ;
ElementSetSpec: ElementSetSpec:
ConstraintSubtypeElement { Unions
$$ = $1;
}
| TOK_ALL TOK_EXCEPT ConstraintSubtypeElement { | TOK_ALL TOK_EXCEPT ConstraintSubtypeElement {
CONSTRAINT_INSERT($$, ACT_CA_AEX, $3, 0); CONSTRAINT_INSERT($$, ACT_CA_AEX, $3, 0);
} }
| ElementSetSpec Union ConstraintSubtypeElement { ;
Unions:
Intersections
| Unions UnionMark Intersections {
CONSTRAINT_INSERT($$, ACT_CA_UNI, $1, $3); CONSTRAINT_INSERT($$, ACT_CA_UNI, $1, $3);
} }
| ElementSetSpec Intersection ConstraintSubtypeElement { ;
Intersections:
IntersectionElements
| Intersections IntersectionMark IntersectionElements {
CONSTRAINT_INSERT($$, ACT_CA_INT, $1, $3); CONSTRAINT_INSERT($$, ACT_CA_INT, $1, $3);
} }
| ConstraintSubtypeElement Except ConstraintSubtypeElement { ;
IntersectionElements:
ConstraintSubtypeElement
| ConstraintSubtypeElement TOK_EXCEPT ConstraintSubtypeElement {
CONSTRAINT_INSERT($$, ACT_CA_EXC, $1, $3); CONSTRAINT_INSERT($$, ACT_CA_EXC, $1, $3);
} }
; ;