diff options
author | Björn-Egil Dahlberg <[email protected]> | 2013-10-26 01:21:23 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-01-28 15:56:27 +0100 |
commit | a0133aa75da3756918a5b9fd427ae75a75ae1dce (patch) | |
tree | 6f840321d46f2a4678147519e618a2bb110be51f /lib/stdlib/src | |
parent | b15b2098627f702958771c3497949c62623a415d (diff) | |
download | otp-a0133aa75da3756918a5b9fd427ae75a75ae1dce.tar.gz otp-a0133aa75da3756918a5b9fd427ae75a75ae1dce.tar.bz2 otp-a0133aa75da3756918a5b9fd427ae75a75ae1dce.zip |
stdlib: Fix erl_parse:parse_term/1
Did not handle Maps.
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/erl_parse.yrl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/stdlib/src/erl_parse.yrl b/lib/stdlib/src/erl_parse.yrl index 35c33c7796..e9a813e098 100644 --- a/lib/stdlib/src/erl_parse.yrl +++ b/lib/stdlib/src/erl_parse.yrl @@ -888,6 +888,12 @@ normalise({cons,_,Head,Tail}) -> [normalise(Head)|normalise(Tail)]; normalise({tuple,_,Args}) -> list_to_tuple(normalise_list(Args)); +normalise({map,_,Pairs}=M) -> + map:from_list(lists:map(fun + %% only allow '=>' + ({map_field_assoc,_,K,V}) -> {normalise(K),normalise(V)}; + (_) -> erlang:error({badarg,M}) + end, Pairs)); %% Special case for unary +/-. normalise({op,_,'+',{char,_,I}}) -> I; normalise({op,_,'+',{integer,_,I}}) -> I; |