let skip s = true in
let inline s = List.mem s [ "int" ] in
- let rec visit_entry e todo is_son =
+ let rec visit_entry e ?level todo is_son =
let { ename = ename; edesc = desc } = e in
if inline ename then
visit_desc desc todo is_son
else
begin
- Format.fprintf fmt "%s " ename;
- if skip ename then
- todo
- else
- todo @ [e]
+ (match level with
+ | None -> Format.fprintf fmt "%s " ename;
+ | Some _ -> Format.fprintf fmt "%s " ename;);
+ if skip ename then
+ todo
+ else
+ todo @ [e]
end
and visit_desc d todo is_son =
todo)
todo sl
| Snterm entry -> visit_entry entry todo is_son
- | Snterml (entry,_) -> visit_entry entry todo is_son
+ | Snterml (entry,level) -> visit_entry entry ~level todo is_son
| Slist0 symbol ->
Format.fprintf fmt "{@[<hov2> ";
let todo = visit_symbol symbol todo is_son in
;;
let ebnf_of_term () =
- let g_entry = Grammar.Entry.obj CicNotationParser.term in
+ let g_entry = Grammar.Entry.obj (CicNotationParser.term ()) in
let buff = Buffer.create 100 in
let fmt = Format.formatter_of_buffer buff in
visit_entries fmt [g_entry] [];