Changed tuple type parsing rule
This commit is contained in:
parent
7daf218b2a
commit
4c72045a86
@ -140,7 +140,8 @@ type100() -> type200().
|
||||
type200() ->
|
||||
?RULE(many({fun_domain(), keyword('=>')}), type300(), fun_t(_1, _2)).
|
||||
|
||||
type300() -> type400().
|
||||
type300() ->
|
||||
?RULE(sep1(type400(), tok('*')), tuple_t(get_ann(_1), _1)).
|
||||
|
||||
type400() ->
|
||||
choice(
|
||||
@ -156,10 +157,12 @@ type400() ->
|
||||
typeAtom() ->
|
||||
?LAZY_P(choice(
|
||||
[ id(), token(con), token(qcon), token(qid), tvar()
|
||||
, ?RULE(keyword('('), comma_sep(type()), tok(')'), tuple_t(_1, _2))
|
||||
])).
|
||||
|
||||
fun_domain() -> ?RULE(?LAZY_P(type300()), fun_domain(_1)).
|
||||
fun_domain() -> ?LAZY_P(choice(
|
||||
[ paren_list(type())
|
||||
, type300()
|
||||
])).
|
||||
|
||||
%% -- Statements -------------------------------------------------------------
|
||||
|
||||
@ -473,10 +476,6 @@ fun_t(Domains, Type) ->
|
||||
tuple_e(_Ann, [Expr]) -> Expr; %% Not a tuple
|
||||
tuple_e(Ann, Exprs) -> {tuple, Ann, Exprs}.
|
||||
|
||||
%% TODO: not nice
|
||||
fun_domain({tuple_t, _, Args}) -> Args;
|
||||
fun_domain(T) -> [T].
|
||||
|
||||
-spec parse_pattern(aeso_syntax:expr()) -> aeso_parse_lib:parser(aeso_syntax:pat()).
|
||||
parse_pattern({app, Ann, Con = {'::', _}, Es}) ->
|
||||
{app, Ann, Con, lists:map(fun parse_pattern/1, Es)};
|
||||
|
Loading…
x
Reference in New Issue
Block a user