let rec name_of_symbol_failed entry =
function
| Slist0 s | Slist0sep (s, _) | Slist1 s | Slist1sep (s, _)
| Sopt s | Stry s -> name_of_symbol_failed entry s
| Stree t -> name_of_tree_failed entry t
| s -> name_of_symbol entry s
and name_of_tree_failed entry =
function
| Node { node = s; brother = bro; son = son } ->
let tokl =
(match s with
| Stoken _ | Skeyword _ ->
Tools.get_token_list entry [] s son
| _ -> None)
in
(match tokl with
| None ->
let txt = name_of_symbol_failed entry s in
let txt =
(match (s, son) with
| (Sopt _, Node _) ->
txt ^
(" or " ^
(name_of_tree_failed entry son))
| _ -> txt) in
let txt =
(match bro with
| DeadEnd | LocAct (_, _) -> txt
| Node _ ->
txt ^
(" or " ^
(name_of_tree_failed entry bro)))
in txt
| Some ((tokl, _, _)) ->
List.fold_left
(fun s tok ->
(if s = "" then "" else s ^ " then ") ^
(match tok with
| Stoken ((_, descr)) -> descr
| Skeyword kwd -> kwd
| _ -> assert false))
"" tokl)
| DeadEnd | LocAct (_, _) -> "???"