let insert_tokens gram symbols =
let rec insert =
function
| Smeta (_, sl, _) -> List.iter insert sl
| Slist0 s | Slist1 s | Sopt s | Stry s -> insert s
| Slist0sep (s, t) -> (insert s; insert t)
| Slist1sep (s, t) -> (insert s; insert t)
| Stree t -> tinsert t
| Skeyword kwd -> using gram kwd
| Snterm _ | Snterml (_, _) | Snext | Sself | Stoken _ ->
()
and tinsert =
function
| Node { node = s; brother = bro; son = son } ->
(insert s; tinsert bro; tinsert son)
| LocAct (_, _) | DeadEnd -> ()
in List.iter insert symbols