diff options
author | Hans Bolinder <[email protected]> | 2010-05-12 09:44:28 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-05-12 09:44:28 +0000 |
commit | a0df9ab3d7c9b301f717eaea2455613d60d3dec3 (patch) | |
tree | bb02397bec3730b9dd37002c1f64bca4c50da427 /lib/stdlib/src | |
parent | d3109217f88e05c7b57d919a4f49ec57549f4ddd (diff) | |
download | otp-a0df9ab3d7c9b301f717eaea2455613d60d3dec3.tar.gz otp-a0df9ab3d7c9b301f717eaea2455613d60d3dec3.tar.bz2 otp-a0df9ab3d7c9b301f717eaea2455613d60d3dec3.zip |
OTP-8629 stdlib: prepare erl_parse.yrl for future extension
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/erl_parse.yrl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/stdlib/src/erl_parse.yrl b/lib/stdlib/src/erl_parse.yrl index 69807aad83..5287f55e59 100644 --- a/lib/stdlib/src/erl_parse.yrl +++ b/lib/stdlib/src/erl_parse.yrl @@ -112,6 +112,7 @@ type_guards -> type_guard ',' type_guards : ['$1'|'$3']. type_guard -> atom '(' top_types ')' : {type, ?line('$1'), constraint, ['$1', '$3']}. +type_guard -> var '::' top_type : build_def('$1', '$3'). top_types -> top_type : ['$1']. top_types -> top_type ',' top_types : ['$1'|'$3']. @@ -597,6 +598,10 @@ find_arity_from_specs([Spec|_]) -> {type, _, 'fun', [{type, _, product, Args},_]} = Fun, length(Args). +build_def(LHS, Types) -> + IsSubType = {atom, ?line(LHS), is_subtype}, + {type, ?line(LHS), constraint, [IsSubType, [LHS, Types]]}. + lift_unions(T1, {type, _La, union, List}) -> {type, ?line(T1), union, [T1|List]}; lift_unions(T1, T2) -> |