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
bf979156
Commit
bf979156
authored
Sep 07, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse a variant of value constraint
parent
0c68645c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1060 additions
and
997 deletions
+1060
-997
libasn1parser/asn1p_l.c
libasn1parser/asn1p_l.c
+1
-1
libasn1parser/asn1p_l.l
libasn1parser/asn1p_l.l
+1
-1
libasn1parser/asn1p_y.c
libasn1parser/asn1p_y.c
+1002
-990
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+13
-5
tests/tests-asn1c-compiler/150-with-components-OK.asn1
tests/tests-asn1c-compiler/150-with-components-OK.asn1
+25
-0
tests/tests-asn1c-compiler/150-with-components-OK.asn1.-EF
tests/tests-asn1c-compiler/150-with-components-OK.asn1.-EF
+18
-0
No files found.
libasn1parser/asn1p_l.c
View file @
bf979156
...
@@ -2664,7 +2664,7 @@ YY_RULE_SETUP
...
@@ -2664,7 +2664,7 @@ YY_RULE_SETUP
#line 161 "asn1p_l.l"
#line 161 "asn1p_l.l"
{
{
fprintf
(
stderr
,
fprintf
(
stderr
,
"ASN.1 Parser syncronization failure: "
"ASN.1 Parser sync
h
ronization failure: "
"
\"
%s
\"
at line %d must not appear "
"
\"
%s
\"
at line %d must not appear "
"inside value definition
\n
"
,
"inside value definition
\n
"
,
asn1p_text
,
asn1p_lineno
);
asn1p_text
,
asn1p_lineno
);
...
...
libasn1parser/asn1p_l.l
View file @
bf979156
...
@@ -160,7 +160,7 @@ WSP [\t\r\v\f\n ]
...
@@ -160,7 +160,7 @@ WSP [\t\r\v\f\n ]
"::=" {
"::=" {
fprintf(stderr,
fprintf(stderr,
"ASN.1 Parser syncronization failure: "
"ASN.1 Parser sync
h
ronization failure: "
"\"%s\" at line %d must not appear "
"\"%s\" at line %d must not appear "
"inside value definition\n",
"inside value definition\n",
yytext, yylineno);
yytext, yylineno);
...
...
libasn1parser/asn1p_y.c
View file @
bf979156
This source diff could not be displayed because it is too large. You can
view the blob
instead.
libasn1parser/asn1p_y.y
View file @
bf979156
...
@@ -350,6 +350,7 @@ static asn1p_module_t *currentModule;
...
@@ -350,6 +350,7 @@ static asn1p_module_t *currentModule;
%type <a_type> BasicTypeId_UniverationCompatible
%type <a_type> BasicTypeId_UniverationCompatible
%type <a_type> BasicString
%type <a_type> BasicString
%type <tv_opaque> Opaque
%type <tv_opaque> Opaque
%type <tv_opaque> OpaqueFirstToken
%type <a_tag> Tag /* [UNIVERSAL 0] IMPLICIT */
%type <a_tag> Tag /* [UNIVERSAL 0] IMPLICIT */
%type <a_tag> TagClass TagTypeValue TagPlicit
%type <a_tag> TagClass TagTypeValue TagPlicit
%type <a_tag> optTag /* [UNIVERSAL 0] IMPLICIT */
%type <a_tag> optTag /* [UNIVERSAL 0] IMPLICIT */
...
@@ -1566,7 +1567,7 @@ Value:
...
@@ -1566,7 +1567,7 @@ Value:
$$->value.choice_identifier.identifier = $1;
$$->value.choice_identifier.identifier = $1;
$$->value.choice_identifier.value = $3;
$$->value.choice_identifier.value = $3;
}
}
| '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque
/* '}' */
{
| '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque {
$$ = asn1p_value_frombuf($3.buf, $3.len, 0);
$$ = asn1p_value_frombuf($3.buf, $3.len, 0);
checkmem($$);
checkmem($$);
$$->type = ATV_UNPARSED;
$$->type = ATV_UNPARSED;
...
@@ -1654,15 +1655,15 @@ RestrictedCharacterStringValue:
...
@@ -1654,15 +1655,15 @@ RestrictedCharacterStringValue:
;
;
Opaque:
Opaque:
TOK_opaque
{
OpaqueFirstToken
{
$$.len = $1.len + 1;
$$.len = $1.len + 1;
$$.buf = malloc($$.len + 1);
$$.buf = malloc(
1 +
$$.len + 1);
checkmem($$.buf);
checkmem($$.buf);
$$.buf[0] = '{';
$$.buf[0] = '{';
memcpy($$.buf + 1, $1.buf, $1.len);
memcpy($$.buf + 1, $1.buf, $1.len);
$$.buf[$$.len] = '\0';
$$.buf[$$.len] = '\0';
free($1.buf);
free($1.buf);
}
}
| Opaque TOK_opaque {
| Opaque TOK_opaque {
int newsize = $1.len + $2.len;
int newsize = $1.len + $2.len;
char *p = malloc(newsize + 1);
char *p = malloc(newsize + 1);
...
@@ -1677,6 +1678,13 @@ Opaque:
...
@@ -1677,6 +1678,13 @@ Opaque:
}
}
;
;
OpaqueFirstToken:
TOK_opaque
| Identifier {
$$.len = strlen($1);
$$.buf = $1;
};
BasicTypeId:
BasicTypeId:
TOK_BOOLEAN { $$ = ASN_BASIC_BOOLEAN; }
TOK_BOOLEAN { $$ = ASN_BASIC_BOOLEAN; }
| TOK_NULL { $$ = ASN_BASIC_NULL; }
| TOK_NULL { $$ = ASN_BASIC_NULL; }
...
@@ -1893,7 +1901,7 @@ SubtypeElements:
...
@@ -1893,7 +1901,7 @@ SubtypeElements:
| InnerTypeConstraints /* WITH COMPONENT[S] ... */
| InnerTypeConstraints /* WITH COMPONENT[S] ... */
| PatternConstraint /* PATTERN ... */
| PatternConstraint /* PATTERN ... */
| ValueRange
| ValueRange
| '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque
/* '}' */
{
| '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque {
$$ = asn1p_constraint_new(yylineno, currentModule);
$$ = asn1p_constraint_new(yylineno, currentModule);
checkmem($$);
checkmem($$);
$$->type = ACT_EL_VALUE;
$$->type = ACT_EL_VALUE;
...
...
tests/tests-asn1c-compiler/150-with-components-OK.asn1
0 → 100644
View file @
bf979156
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .150
ModuleValueWithComponents
{ iso org(3) dod(6) internet(1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 150 }
DEFINITIONS ::= BEGIN
EntityType ::= BIT STRING {app (0), enrol (1)} (SIZE (8))
GroupPermissions ::= SEQUENCE {
minChainDepth INTEGER DEFAULT 1,
eeType EntityType DEFAULT {app}
}
EnrolPermissions ::= GroupPermissions (WITH COMPONENTS {
minChainDepth (2),
eeType ({enrol})
})
END
tests/tests-asn1c-compiler/150-with-components-OK.asn1.-EF
0 → 100644
View file @
bf979156
ModuleValueWithComponents { iso org(3) dod(6) internet(1) private(4)
enterprise(1) spelio(9363) software(1) asn1c(5) test(1) 150 }
DEFINITIONS ::=
BEGIN
EntityType ::= BIT STRING {
app(0),
enrol(1)
} (SIZE(8))
GroupPermissions ::= SEQUENCE {
minChainDepth INTEGER DEFAULT 1,
eeType EntityType DEFAULT {app}
}
EnrolPermissions ::= GroupPermissions (WITH COMPONENTS { minChainDepth (2), eeType ({enrol}) })
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