diff options
author | Björn Gustavsson <[email protected]> | 2014-10-20 13:17:36 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-01-12 11:40:25 +0100 |
commit | b9b741b23bdaab354b2b5cc8cfb424550c2dd743 (patch) | |
tree | c3224a3a036f0af142520d92f6d3bfe799463ba9 | |
parent | 0775ee9c7dc4957302a756b8b37cf94e372d3ecc (diff) | |
download | otp-b9b741b23bdaab354b2b5cc8cfb424550c2dd743.tar.gz otp-b9b741b23bdaab354b2b5cc8cfb424550c2dd743.tar.bz2 otp-b9b741b23bdaab354b2b5cc8cfb424550c2dd743.zip |
Remove special case in parser
The parser handled the builtin ABSTRACT-SYNTAX and TYPE-IDENTIFIER
classes specially, which caused problems. It turns out that there
is no longer any need to handle those classes specially.
-rw-r--r-- | lib/asn1/src/asn1ct_check.erl | 6 | ||||
-rw-r--r-- | lib/asn1/src/asn1ct_parser2.erl | 21 | ||||
-rw-r--r-- | lib/asn1/test/asn1_SUITE_data/InfObj.asn | 20 | ||||
-rw-r--r-- | lib/asn1/test/testInfObj.erl | 3 |
4 files changed, 25 insertions, 25 deletions
diff --git a/lib/asn1/src/asn1ct_check.erl b/lib/asn1/src/asn1ct_check.erl index 4a67173064..81bb78f9d4 100644 --- a/lib/asn1/src/asn1ct_check.erl +++ b/lib/asn1/src/asn1ct_check.erl @@ -3194,12 +3194,6 @@ check_type(S=#state{recordtopname=TopName},Type,Ts) when is_record(Ts,type) -> TempNewDef#newt{type={'SET OF',check_setof(S,Type,Components)}, tag= merge_tags(Tag,?TAG_CONSTRUCTED(?N_SET))}; - %% This is a temporary hack until the full Information Obj Spec - %% in X.681 is supported - {#'Externaltypereference'{type='TYPE-IDENTIFIER'}, - [{typefieldreference,_,'Type'}]} -> - Ct=maybe_illicit_implicit_tag(open_type,Tag), - TempNewDef#newt{type='ASN1_OPEN_TYPE',tag=Ct}; {pt,Ptype,ParaList} -> %% Ptype might be a parameterized - type, object set or diff --git a/lib/asn1/src/asn1ct_parser2.erl b/lib/asn1/src/asn1ct_parser2.erl index 3891fce8d3..bcfa779997 100644 --- a/lib/asn1/src/asn1ct_parser2.erl +++ b/lib/asn1/src/asn1ct_parser2.erl @@ -752,17 +752,8 @@ parse_DefinedType(Tokens=[{typereference,_L1,_Module},{'.',_}, parse_DefinedType([{typereference,L1,Module},{'.',_},{typereference,_,TypeName}|Rest]) -> {#type{def = #'Externaltypereference'{pos=L1,module=Module,type=TypeName}},Rest}; parse_DefinedType([{typereference,L1,TypeName}|Rest]) -> - case is_pre_defined_class(TypeName) of - false -> - {#type{def = #'Externaltypereference'{pos=L1,module=resolve_module(TypeName), - type=TypeName}},Rest}; - _ -> - throw({asn1_error, - {L1,get(asn1_module), - [got,TypeName,expected, - [typereference,'typereference.typereference', - 'typereference typereference']]}}) - end; + {#type{def = #'Externaltypereference'{pos=L1,module=resolve_module(TypeName), + type=TypeName}},Rest}; parse_DefinedType(Tokens) -> throw({asn1_error,{get_line(hd(Tokens)),get(asn1_module), [got,get_token(hd(Tokens)),expected, @@ -3234,11 +3225,3 @@ lookahead_assignment([{'END',_}|_Rest]) -> lookahead_assignment(Tokens) -> parse_Assignment(Tokens), ok. - -is_pre_defined_class('TYPE-IDENTIFIER') -> - true; -is_pre_defined_class('ABSTRACT-SYNTAX') -> - true; -is_pre_defined_class(_) -> - false. - diff --git a/lib/asn1/test/asn1_SUITE_data/InfObj.asn b/lib/asn1/test/asn1_SUITE_data/InfObj.asn index 9dbee3f516..10d0040a26 100644 --- a/lib/asn1/test/asn1_SUITE_data/InfObj.asn +++ b/lib/asn1/test/asn1_SUITE_data/InfObj.asn @@ -404,6 +404,26 @@ id-at OBJECT IDENTIFIER ::= { 2 5 4 41 } id-at-name AttributeType ::= id-at at-name ATTRIBUTE ::= { &Type PrintableString, &id id-at-name } +-- +-- Test using an alias for TYPE-IDENTIFIER. +-- + +TiAliasParameterized { TI-ALIAS:InfoObjectSet } ::= SEQUENCE { + algorithm TI-ALIAS.&id({InfoObjectSet}), + parameters TI-ALIAS.&Type({InfoObjectSet} {@algorithm}) OPTIONAL +} + +TI-ALIAS ::= TYPE-IDENTIFIER + +TiAliasSeq ::= SEQUENCE { + prf TiAliasParameterized {{TiAliasSet}} +} + +TiAliasSet TI-ALIAS ::= { + {NULL IDENTIFIED BY {2 1 2}}, + ... +} + END diff --git a/lib/asn1/test/testInfObj.erl b/lib/asn1/test/testInfObj.erl index 09fe549f0d..accdcf8dff 100644 --- a/lib/asn1/test/testInfObj.erl +++ b/lib/asn1/test/testInfObj.erl @@ -153,6 +153,9 @@ main(_Erule) -> roundtrip('InfObj', 'Rdn', {'Rdn',{2,5,4,41},"abc"}), + roundtrip('InfObj', 'TiAliasSeq', + {'TiAliasSeq',{'TiAliasSeq_prf',{2,1,2},'NULL'}}), + ok. test_objset(Type, Keys) -> |