diff options
author | Björn Gustavsson <[email protected]> | 2012-12-12 08:33:27 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-12-18 14:46:14 +0100 |
commit | 062d7bf2ea0760b5e8865aa689ae87cedea7574a (patch) | |
tree | 4ccd1889e075cd01f783bf03e8c2163445471cbc /lib | |
parent | 89b47bd53200816ac058eafe0b7d00745183fee4 (diff) | |
download | otp-062d7bf2ea0760b5e8865aa689ae87cedea7574a.tar.gz otp-062d7bf2ea0760b5e8865aa689ae87cedea7574a.tar.bz2 otp-062d7bf2ea0760b5e8865aa689ae87cedea7574a.zip |
asn1ct_parser2: Let synonyms share parsing code
UNION and "|" are synonyms, as are INTERSECTION and "^". Use the same
parsing code for the synonyms.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/asn1/src/asn1ct_parser2.erl | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/lib/asn1/src/asn1ct_parser2.erl b/lib/asn1/src/asn1ct_parser2.erl index 7301f49085..9e1fcce2b1 100644 --- a/lib/asn1/src/asn1ct_parser2.erl +++ b/lib/asn1/src/asn1ct_parser2.erl @@ -924,19 +924,8 @@ parse_UnionsRec([{'|',_}|Rest]) -> {V1,V2} -> {[V1,union,V2],Rest3} end; -parse_UnionsRec([{'UNION',_}|Rest]) -> - {InterSec,Rest2} = parse_Intersections(Rest), - {URec,Rest3} = parse_UnionsRec(Rest2), - case {InterSec,URec} of - {V1,[]} -> - {V1,Rest3}; - {{'SingleValue',V1},{'SingleValue',V2}} -> - {{'SingleValue',ordsets:union(to_set(V1),to_set(V2))},Rest3}; - {V1,V2} when is_list(V2) -> - {[V1] ++ [union|V2],Rest3}; - {V1,V2} -> - {[V1,union,V2],Rest3} - end; +parse_UnionsRec([{'UNION',Info}|Rest]) -> + parse_UnionsRec([{'|',Info}|Rest]); parse_UnionsRec(Tokens) -> {[],Tokens}. @@ -971,20 +960,8 @@ parse_IElemsRec([{'^',_}|Rest]) -> {V1,V2} -> {[V1,intersection,V2],Rest3} end; -parse_IElemsRec([{'INTERSECTION',_}|Rest]) -> - {InterSec,Rest2} = parse_IntersectionElements(Rest), - {IRec,Rest3} = parse_IElemsRec(Rest2), - case {InterSec,IRec} of - {{'SingleValue',V1},{'SingleValue',V2}} -> - {{'SingleValue', - ordsets:intersection(to_set(V1),to_set(V2))},Rest3}; - {V1,[]} -> - {V1,Rest3}; - {V1,V2} when is_list(V2) -> - {[V1] ++ [intersection|V2],Rest3}; - {V1,V2} -> - {[V1,intersection,V2],Rest3} - end; +parse_IElemsRec([{'INTERSECTION',Info}|Rest]) -> + parse_IElemsRec([{'^',Info}|Rest]); parse_IElemsRec(Tokens) -> {[],Tokens}. |