Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
1ed22099
Commit
1ed22099
authored
Aug 12, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preliminary stupid things
parent
58db695d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
40 deletions
+58
-40
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+58
-40
No files found.
libasn1parser/asn1p_y.y
View file @
1ed22099
...
@@ -23,6 +23,11 @@ void asn1p_lexer_hack_push_encoding_control(void);
...
@@ -23,6 +23,11 @@ void asn1p_lexer_hack_push_encoding_control(void);
#define yylineno asn1p_lineno
#define yylineno asn1p_lineno
extern int asn1p_lineno;
extern int asn1p_lineno;
/*
* This temporary variable is used to solve the shortcomings of 1-lookahead
* parser.
*/
static struct AssignedIdentifier *saved_aid;
static asn1p_value_t *
static asn1p_value_t *
_convert_bitstring2binary(char *str, int base);
_convert_bitstring2binary(char *str, int base);
...
@@ -32,7 +37,7 @@ static asn1p_value_t *
...
@@ -32,7 +37,7 @@ static asn1p_value_t *
return yyerror("Memory failure"); \
return yyerror("Memory failure"); \
} while(0)
} while(0)
#define CONSTRAINT_INSERT(root, constr_type, arg1, arg2) do { \
#define CONSTRAINT_INSERT(root,
lloc,
constr_type, arg1, arg2) do { \
if(arg1->type != constr_type) { \
if(arg1->type != constr_type) { \
int __ret; \
int __ret; \
root = asn1p_constraint_new(yylineno); \
root = asn1p_constraint_new(yylineno); \
...
@@ -68,6 +73,7 @@ static asn1p_value_t *
...
@@ -68,6 +73,7 @@ static asn1p_value_t *
asn1p_constraint_t *a_constr; /* Constraint */
asn1p_constraint_t *a_constr; /* Constraint */
enum asn1p_constraint_type_e a_ctype;/* Constraint type */
enum asn1p_constraint_type_e a_ctype;/* Constraint type */
asn1p_xports_t *a_xports; /* IMports/EXports */
asn1p_xports_t *a_xports; /* IMports/EXports */
struct AssignedIdentifier a_aid; /* Assigned Identifier */
asn1p_oid_t *a_oid; /* Object Identifier */
asn1p_oid_t *a_oid; /* Object Identifier */
asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */
asn1p_oid_arc_t a_oid_arc; /* Single OID's arc */
struct asn1p_type_tag_s a_tag; /* A tag */
struct asn1p_type_tag_s a_tag; /* A tag */
...
@@ -258,6 +264,7 @@ static asn1p_value_t *
...
@@ -258,6 +264,7 @@ static asn1p_value_t *
%type <a_plist> ParameterArgumentList
%type <a_plist> ParameterArgumentList
%type <a_expr> ActualParameter
%type <a_expr> ActualParameter
%type <a_expr> ActualParameterList
%type <a_expr> ActualParameterList
%type <a_aid> AssignedIdentifier /* OID/DefinedValue */
%type <a_oid> ObjectIdentifier /* OID */
%type <a_oid> ObjectIdentifier /* OID */
%type <a_oid> optObjectIdentifier /* Optional OID */
%type <a_oid> optObjectIdentifier /* Optional OID */
%type <a_oid> ObjectIdentifierBody
%type <a_oid> ObjectIdentifierBody
...
@@ -346,7 +353,7 @@ ModuleSpecification:
...
@@ -346,7 +353,7 @@ ModuleSpecification:
}
}
checkmem($$);
checkmem($$);
$$->
Identifier
= $1;
$$->
ModuleName
= $1;
$$->module_oid = $2;
$$->module_oid = $2;
$$->module_flags = $4;
$$->module_flags = $4;
}
}
...
@@ -574,6 +581,10 @@ ModuleSpecificationElement:
...
@@ -574,6 +581,10 @@ ModuleSpecificationElement:
*/
*/
ImportsDefinition:
ImportsDefinition:
TOK_IMPORTS ImportsBundleSet ';' {
TOK_IMPORTS ImportsBundleSet ';' {
if(!saved_aid && 0)
return yyerror("Unterminated IMPORTS FROM, "
"expected semicolon ';'");
saved_aid = 0;
$$ = $2;
$$ = $2;
}
}
/*
/*
...
@@ -596,11 +607,18 @@ ImportsBundleSet:
...
@@ -596,11 +607,18 @@ ImportsBundleSet:
}
}
;
;
AssignedIdentifier:
{ memset(&$$, 0, sizeof($$)); }
| ObjectIdentifier { $$.oid = $1; };
/* | DefinedValue { $$.value = $1; }; // Handled through saved_aid */
ImportsBundle:
ImportsBundle:
ImportsList TOK_FROM TypeRefName
optObject
Identifier {
ImportsList TOK_FROM TypeRefName
Assigned
Identifier {
$$ = $1;
$$ = $1;
$$->from = $3;
$$->fromModuleName = $3;
$$->from_oid = $4;
$$->identifier = $4;
/* This stupid thing is used for look-back hack. */
saved_aid = $$->identifier.oid ? 0 : &($$->identifier);
checkmem($$);
checkmem($$);
}
}
;
;
...
@@ -1520,14 +1538,14 @@ optConstraints:
...
@@ -1520,14 +1538,14 @@ optConstraints:
Constraints:
Constraints:
SetOfConstraints {
SetOfConstraints {
CONSTRAINT_INSERT($$, ACT_CA_SET, $1, 0);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_SET, $1, 0);
}
}
| TOK_SIZE '(' ElementSetSpecs ')' {
| TOK_SIZE '(' ElementSetSpecs ')' {
/*
/*
* This is a special case, for compatibility purposes.
* This is a special case, for compatibility purposes.
* It goes without parentheses.
* It goes without parentheses.
*/
*/
CONSTRAINT_INSERT($$, ACT_CT_SIZE, $3, 0);
CONSTRAINT_INSERT($$,
@1,
ACT_CT_SIZE, $3, 0);
}
}
;
;
...
@@ -1536,7 +1554,7 @@ SetOfConstraints:
...
@@ -1536,7 +1554,7 @@ SetOfConstraints:
$$ = $2;
$$ = $2;
}
}
| SetOfConstraints '(' ElementSetSpecs ')' {
| SetOfConstraints '(' ElementSetSpecs ')' {
CONSTRAINT_INSERT($$, ACT_CA_SET, $1, $3);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_SET, $1, $3);
}
}
;
;
...
@@ -1548,15 +1566,15 @@ ElementSetSpecs:
...
@@ -1548,15 +1566,15 @@ ElementSetSpecs:
asn1p_constraint_t *ct;
asn1p_constraint_t *ct;
ct = asn1p_constraint_new(yylineno);
ct = asn1p_constraint_new(yylineno);
ct->type = ACT_EL_EXT;
ct->type = ACT_EL_EXT;
CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_CSV, $1, ct);
}
}
| ElementSetSpec ',' TOK_ThreeDots ',' ElementSetSpec {
| ElementSetSpec ',' TOK_ThreeDots ',' ElementSetSpec {
asn1p_constraint_t *ct;
asn1p_constraint_t *ct;
ct = asn1p_constraint_new(yylineno);
ct = asn1p_constraint_new(yylineno);
ct->type = ACT_EL_EXT;
ct->type = ACT_EL_EXT;
CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_CSV, $1, ct);
ct = $$;
ct = $$;
CONSTRAINT_INSERT($$, ACT_CA_CSV, ct, $5);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_CSV, ct, $5);
}
}
;
;
...
@@ -1565,16 +1583,16 @@ ElementSetSpec:
...
@@ -1565,16 +1583,16 @@ ElementSetSpec:
$$ = $1;
$$ = $1;
}
}
| TOK_ALL TOK_EXCEPT ConstraintSubtypeElement {
| TOK_ALL TOK_EXCEPT ConstraintSubtypeElement {
CONSTRAINT_INSERT($$, ACT_CA_AEX, $3, 0);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_AEX, $3, 0);
}
}
| ElementSetSpec Union ConstraintSubtypeElement {
| ElementSetSpec Union ConstraintSubtypeElement {
CONSTRAINT_INSERT($$, ACT_CA_UNI, $1, $3);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_UNI, $1, $3);
}
}
| ElementSetSpec Intersection ConstraintSubtypeElement {
| ElementSetSpec Intersection ConstraintSubtypeElement {
CONSTRAINT_INSERT($$, ACT_CA_INT, $1, $3);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_INT, $1, $3);
}
}
| ConstraintSubtypeElement Except ConstraintSubtypeElement {
| ConstraintSubtypeElement Except ConstraintSubtypeElement {
CONSTRAINT_INSERT($$, ACT_CA_EXC, $1, $3);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_EXC, $1, $3);
}
}
;
;
...
@@ -1718,10 +1736,10 @@ ContainedSubtype:
...
@@ -1718,10 +1736,10 @@ ContainedSubtype:
InnerTypeConstraint:
InnerTypeConstraint:
TOK_WITH TOK_COMPONENT SetOfConstraints {
TOK_WITH TOK_COMPONENT SetOfConstraints {
CONSTRAINT_INSERT($$, ACT_CT_WCOMP, $3, 0);
CONSTRAINT_INSERT($$,
@1,
ACT_CT_WCOMP, $3, 0);
}
}
| TOK_WITH TOK_COMPONENTS '{' WithComponentsList '}' {
| TOK_WITH TOK_COMPONENTS '{' WithComponentsList '}' {
CONSTRAINT_INSERT($$, ACT_CT_WCOMPS, $4, 0);
CONSTRAINT_INSERT($$,
@1,
ACT_CT_WCOMPS, $4, 0);
}
}
;
;
...
@@ -1730,7 +1748,7 @@ WithComponentsList:
...
@@ -1730,7 +1748,7 @@ WithComponentsList:
$$ = $1;
$$ = $1;
}
}
| WithComponentsList ',' WithComponentsElement {
| WithComponentsList ',' WithComponentsElement {
CONSTRAINT_INSERT($$, ACT_CT_WCOMPS, $1, $3);
CONSTRAINT_INSERT($$,
@1,
ACT_CT_WCOMPS, $1, $3);
}
}
;
;
...
@@ -1794,13 +1812,13 @@ SimpleTableConstraint:
...
@@ -1794,13 +1812,13 @@ SimpleTableConstraint:
checkmem($$);
checkmem($$);
ct->type = ACT_EL_VALUE;
ct->type = ACT_EL_VALUE;
ct->value = asn1p_value_fromref(ref, 0);
ct->value = asn1p_value_fromref(ref, 0);
CONSTRAINT_INSERT($$, ACT_CA_CRC, ct, 0);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_CRC, ct, 0);
}
}
;
;
ComponentRelationConstraint:
ComponentRelationConstraint:
SimpleTableConstraint '{' AtNotationList '}' {
SimpleTableConstraint '{' AtNotationList '}' {
CONSTRAINT_INSERT($$, ACT_CA_CRC, $1, $3);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_CRC, $1, $3);
}
}
;
;
...
@@ -1817,7 +1835,7 @@ AtNotationList:
...
@@ -1817,7 +1835,7 @@ AtNotationList:
checkmem(ct);
checkmem(ct);
ct->type = ACT_EL_VALUE;
ct->type = ACT_EL_VALUE;
ct->value = asn1p_value_fromref($3, 0);
ct->value = asn1p_value_fromref($3, 0);
CONSTRAINT_INSERT($$, ACT_CA_CSV, $1, ct);
CONSTRAINT_INSERT($$,
@1,
ACT_CA_CSV, $1, ct);
}
}
;
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment