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
866bd7f7
Commit
866bd7f7
authored
Sep 14, 2006
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
f9492a93
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1197 additions
and
1163 deletions
+1197
-1163
libasn1parser/asn1p_module.h
libasn1parser/asn1p_module.h
+4
-4
libasn1parser/asn1p_y.c
libasn1parser/asn1p_y.c
+1114
-1098
libasn1parser/asn1p_y.h
libasn1parser/asn1p_y.h
+1
-1
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+74
-60
tests/49-real-life-OK.asn1
tests/49-real-life-OK.asn1
+2
-0
tests/49-real-life-OK.asn1.-E
tests/49-real-life-OK.asn1.-E
+2
-0
No files found.
libasn1parser/asn1p_module.h
View file @
866bd7f7
...
...
@@ -51,14 +51,14 @@ typedef struct asn1p_module_s {
asn1p_module_flags_e
module_flags
;
/* AUTOMATIC TAGS? */
/*
* List of everything that this module
IM
PORTS.
* List of everything that this module
EX
PORTS.
*/
TQ_HEAD
(
struct
asn1p_xports_s
)
im
ports
;
TQ_HEAD
(
struct
asn1p_xports_s
)
ex
ports
;
/*
* List of everything that this module
EX
PORTS.
* List of everything that this module
IM
PORTS.
*/
TQ_HEAD
(
struct
asn1p_xports_s
)
ex
ports
;
TQ_HEAD
(
struct
asn1p_xports_s
)
im
ports
;
/*
* List of everything that this module defines itself.
...
...
libasn1parser/asn1p_y.c
View file @
866bd7f7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
libasn1parser/asn1p_y.h
View file @
866bd7f7
...
...
@@ -245,7 +245,7 @@
#ifndef YYSTYPE
#line
72
"asn1p_y.y"
#line
85
"asn1p_y.y"
typedef
union
{
asn1p_t
*
a_grammar
;
asn1p_module_flags_e
a_module_flags
;
...
...
libasn1parser/asn1p_y.y
View file @
866bd7f7
...
...
@@ -61,6 +61,19 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
} \
} while(0)
#ifdef AL_IMPORT
#error AL_IMPORT DEFINED ELSEWHERE!
#endif
#define AL_IMPORT(to,where,from,field) do { \
if(!(from)) break; \
while(TQ_FIRST(&((from)->where))) { \
TQ_ADD(&((to)->where), \
TQ_REMOVE(&((from)->where), field), \
field); \
} \
assert(TQ_FIRST(&((from)->where)) == 0); \
} while(0)
%}
...
...
@@ -223,13 +236,16 @@ static void _fixup_anonymous_identifier(asn1p_expr_t *expr);
* Types defined herein.
*/
%type <a_grammar> ModuleList
%type <a_module> ModuleSpecification
%type <a_module> ModuleSpecificationBody
%type <a_module> ModuleSpecificationElement
%type <a_module> optModuleSpecificationBody /* Optional */
%type <a_module_flags> optModuleSpecificationFlags
%type <a_module_flags> ModuleSpecificationFlags /* Set of FL */
%type <a_module_flags> ModuleSpecificationFlag /* Single FL */
%type <a_module> ModuleDefinition
%type <a_module> ModuleBody
%type <a_module> AssignmentList
%type <a_module> Assignment
%type <a_module> optModuleBody /* Optional */
%type <a_module_flags> optModuleDefinitionFlags
%type <a_module_flags> ModuleDefinitionFlags /* Set of FL */
%type <a_module_flags> ModuleDefinitionFlag /* Single FL */
%type <a_module> optImports
%type <a_module> optExports
%type <a_module> ImportsDefinition
%type <a_module> ImportsBundleSet
%type <a_xports> ImportsBundle
...
...
@@ -330,12 +346,12 @@ ParsedGrammar:
;
ModuleList:
Module
Specifica
tion {
Module
Defini
tion {
$$ = asn1p_new();
checkmem($$);
TQ_ADD(&($$->modules), $1, mod_next);
}
| ModuleList Module
Specifica
tion {
| ModuleList Module
Defini
tion {
$$ = $1;
TQ_ADD(&($$->modules), $2, mod_next);
}
...
...
@@ -351,11 +367,11 @@ ModuleList:
* === EOF ===
*/
Module
Specifica
tion:
Module
Defini
tion:
TypeRefName optObjectIdentifier TOK_DEFINITIONS
optModule
Specifica
tionFlags
optModule
Defini
tionFlags
TOK_PPEQ TOK_BEGIN
optModule
Specification
Body
optModuleBody
TOK_END {
if($7) {
...
...
@@ -423,9 +439,9 @@ ObjectIdentifierElement:
/*
* Optional module flags.
*/
optModule
Specifica
tionFlags:
optModule
Defini
tionFlags:
{ $$ = MSF_NOFLAGS; }
| Module
Specifica
tionFlags {
| Module
Defini
tionFlags {
$$ = $1;
}
;
...
...
@@ -433,11 +449,11 @@ optModuleSpecificationFlags:
/*
* Module flags.
*/
Module
Specifica
tionFlags:
Module
Specifica
tionFlag {
Module
Defini
tionFlags:
Module
Defini
tionFlag {
$$ = $1;
}
| Module
SpecificationFlags ModuleSpecifica
tionFlag {
| Module
DefinitionFlags ModuleDefini
tionFlag {
$$ = $1 | $2;
}
;
...
...
@@ -445,7 +461,7 @@ ModuleSpecificationFlags:
/*
* Single module flag.
*/
Module
Specifica
tionFlag:
Module
Defini
tionFlag:
TOK_EXPLICIT TOK_TAGS {
$$ = MSF_EXPLICIT_TAGS;
}
...
...
@@ -479,9 +495,9 @@ ModuleSpecificationFlag:
/*
* Optional module body.
*/
optModule
Specification
Body:
optModuleBody:
{ $$ = 0; }
| Module
Specification
Body {
| ModuleBody {
$$ = $1;
}
;
...
...
@@ -489,56 +505,36 @@ optModuleSpecificationBody:
/*
* ASN.1 Module body.
*/
ModuleSpecificationBody:
ModuleSpecificationElement {
$$ = $1;
ModuleBody:
optExports optImports AssignmentList {
$$ = asn1p_module_new();
AL_IMPORT($$, exports, $1, xp_next);
AL_IMPORT($$, imports, $2, xp_next);
AL_IMPORT($$, members, $3, next);
}
| ModuleSpecificationBody ModuleSpecificationElement {
$$ = $1;
;
/* Behave well when one of them is skipped. */
if(!($1)) {
if($2) $$ = $2;
AssignmentList:
Assignment {
$$ = $1;
}
| AssignmentList Assignment {
if($1) {
$$ = $1;
} else {
$$ = $2;
break;
}
#ifdef MY_IMPORT
#error MY_IMPORT DEFINED ELSEWHERE!
#endif
#define MY_IMPORT(foo,field) do { \
while(TQ_FIRST(&($2->foo))) { \
TQ_ADD(&($$->foo), \
TQ_REMOVE(&($2->foo), field), \
field); \
} \
assert(TQ_FIRST(&($2->foo)) == 0); \
} while(0)
MY_IMPORT(imports, xp_next);
MY_IMPORT(exports, xp_next);
MY_IMPORT(members, next);
#undef MY_IMPORT
AL_IMPORT($$, members, $2, next);
}
;
/*
* One of the elements of ASN.1 module specification.
*/
ModuleSpecificationElement:
ImportsDefinition {
$$ = $1;
}
| ExportsDefinition {
$$ = asn1p_module_new();
checkmem($$);
if($1) {
TQ_ADD(&($$->exports), $1, xp_next);
} else {
/* "EXPORTS ALL;" ? */
}
}
| DataTypeReference {
Assignment:
DataTypeReference {
$$ = asn1p_module_new();
checkmem($$);
assert($1->expr_type != A1TC_INVALID);
...
...
@@ -591,6 +587,10 @@ ModuleSpecificationElement:
* IMPORTS Type1, value FROM Module { iso standard(0) } ;
* === EOF ===
*/
optImports:
{ $$ = 0; }
| ImportsDefinition;
ImportsDefinition:
TOK_IMPORTS ImportsBundleSet ';' {
if(!saved_aid && 0)
...
...
@@ -668,6 +668,20 @@ ImportsElement:
}
;
optExports:
{ $$ = 0; }
| ExportsDefinition {
$$ = asn1p_module_new();
checkmem($$);
if($1) {
TQ_ADD(&($$->exports), $1, xp_next);
} else {
/* "EXPORTS ALL;" */
}
}
;
ExportsDefinition:
TOK_EXPORTS ExportsBody ';' {
$$ = $2;
...
...
tests/49-real-life-OK.asn1
View file @
866bd7f7
...
...
@@ -19,4 +19,6 @@ BEGIN
IMPORTS TypeB FROM ModuleB
TypeC FROM ModuleC ;
Z ::= INTEGER -- Can't specify only EXPORTS & IMPOTS
END
tests/49-real-life-OK.asn1.-E
View file @
866bd7f7
...
...
@@ -3,4 +3,6 @@ ModuleSetChoiceExtensibility { iso org(3) dod(6) internet(1) private(4)
DEFINITIONS ::=
BEGIN
Z ::= INTEGER
END
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