mirror of https://gerrit.osmocom.org/asn1c
parse a variant of value constraint
This commit is contained in:
parent
0c68645c5c
commit
bf979156ac
|
@ -2664,7 +2664,7 @@ YY_RULE_SETUP
|
|||
#line 161 "asn1p_l.l"
|
||||
{
|
||||
fprintf(stderr,
|
||||
"ASN.1 Parser syncronization failure: "
|
||||
"ASN.1 Parser synchronization failure: "
|
||||
"\"%s\" at line %d must not appear "
|
||||
"inside value definition\n",
|
||||
asn1p_text, asn1p_lineno);
|
||||
|
|
|
@ -160,7 +160,7 @@ WSP [\t\r\v\f\n ]
|
|||
|
||||
"::=" {
|
||||
fprintf(stderr,
|
||||
"ASN.1 Parser syncronization failure: "
|
||||
"ASN.1 Parser synchronization failure: "
|
||||
"\"%s\" at line %d must not appear "
|
||||
"inside value definition\n",
|
||||
yytext, yylineno);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -350,6 +350,7 @@ static asn1p_module_t *currentModule;
|
|||
%type <a_type> BasicTypeId_UniverationCompatible
|
||||
%type <a_type> BasicString
|
||||
%type <tv_opaque> Opaque
|
||||
%type <tv_opaque> OpaqueFirstToken
|
||||
%type <a_tag> Tag /* [UNIVERSAL 0] IMPLICIT */
|
||||
%type <a_tag> TagClass TagTypeValue TagPlicit
|
||||
%type <a_tag> optTag /* [UNIVERSAL 0] IMPLICIT */
|
||||
|
@ -1566,7 +1567,7 @@ Value:
|
|||
$$->value.choice_identifier.identifier = $1;
|
||||
$$->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);
|
||||
checkmem($$);
|
||||
$$->type = ATV_UNPARSED;
|
||||
|
@ -1654,15 +1655,15 @@ RestrictedCharacterStringValue:
|
|||
;
|
||||
|
||||
Opaque:
|
||||
TOK_opaque {
|
||||
OpaqueFirstToken {
|
||||
$$.len = $1.len + 1;
|
||||
$$.buf = malloc($$.len + 1);
|
||||
$$.buf = malloc(1 + $$.len + 1);
|
||||
checkmem($$.buf);
|
||||
$$.buf[0] = '{';
|
||||
memcpy($$.buf + 1, $1.buf, $1.len);
|
||||
$$.buf[$$.len] = '\0';
|
||||
free($1.buf);
|
||||
}
|
||||
}
|
||||
| Opaque TOK_opaque {
|
||||
int newsize = $1.len + $2.len;
|
||||
char *p = malloc(newsize + 1);
|
||||
|
@ -1677,6 +1678,13 @@ Opaque:
|
|||
}
|
||||
;
|
||||
|
||||
OpaqueFirstToken:
|
||||
TOK_opaque
|
||||
| Identifier {
|
||||
$$.len = strlen($1);
|
||||
$$.buf = $1;
|
||||
};
|
||||
|
||||
BasicTypeId:
|
||||
TOK_BOOLEAN { $$ = ASN_BASIC_BOOLEAN; }
|
||||
| TOK_NULL { $$ = ASN_BASIC_NULL; }
|
||||
|
@ -1893,7 +1901,7 @@ SubtypeElements:
|
|||
| InnerTypeConstraints /* WITH COMPONENT[S] ... */
|
||||
| PatternConstraint /* PATTERN ... */
|
||||
| ValueRange
|
||||
| '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque /* '}' */ {
|
||||
| '{' { asn1p_lexer_hack_push_opaque_state(); } Opaque {
|
||||
$$ = asn1p_constraint_new(yylineno, currentModule);
|
||||
checkmem($$);
|
||||
$$->type = ACT_EL_VALUE;
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
-- 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
|
|
@ -0,0 +1,18 @@
|
|||
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
|
Loading…
Reference in New Issue