let rec sep_expr_acc l =
function
| ExAcc (_, e1, e2) -> sep_expr_acc (sep_expr_acc l e2) e1
| (Ast.ExId (loc, (Ast.IdUid (_, s))) as e) ->
(match l with
| [] -> [ (loc, [], e) ]
| (loc', sl, e) :: l ->
((Loc.merge loc loc'), (s :: sl), e) :: l)
| Ast.ExId (_, ((Ast.IdAcc (_, _, _) as i))) ->
let rec normalize_acc =
(function
| Ast.IdAcc (_loc, i1, i2) ->
Ast.ExAcc (_loc, (normalize_acc i1),
(normalize_acc i2))
| Ast.IdApp (_loc, i1, i2) ->
Ast.ExApp (_loc, (normalize_acc i1),
(normalize_acc i2))
| (Ast.IdAnt (_loc, _) | Ast.IdUid (_loc, _) |
Ast.IdLid (_loc, _)
as i) -> Ast.ExId (_loc, i))
in sep_expr_acc l (normalize_acc i)
| e -> ((loc_of_expr e), [], e) :: l