X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fcomponents%2Fgrafite_parser%2Fprint_grammar.ml;h=47f42356f4854e8f2f08242a9f8d7ec7fb4f3115;hb=a823c605d3a541c8d7df2bcc3c21bf459c9d25c4;hp=bb2a68b326ae39bf631c095dcb58d1fadce6f11e;hpb=01001c883a8151edba81cd03a6f254d24a81c867;p=helm.git diff --git a/helm/software/components/grafite_parser/print_grammar.ml b/helm/software/components/grafite_parser/print_grammar.ml index bb2a68b32..47f42356f 100644 --- a/helm/software/components/grafite_parser/print_grammar.ml +++ b/helm/software/components/grafite_parser/print_grammar.ml @@ -87,7 +87,7 @@ and is_symbol_dummy = function | Smeta (_, lt, _) -> List.for_all is_symbol_dummy lt | Snterm e | Snterml (e, _) -> is_entry_dummy e | Slist1 x | Slist0 x -> is_symbol_dummy x - | Slist1sep (x,y) | Slist0sep (x,y) -> is_symbol_dummy x && is_symbol_dummy y + | Slist1sep (x,y,false) | Slist0sep (x,y,false) -> is_symbol_dummy x && is_symbol_dummy y | Sopt x -> is_symbol_dummy x | Sself | Snext -> false | Stree t -> is_tree_dummy t @@ -108,17 +108,19 @@ let visit_description desc fmt self = 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 = @@ -178,13 +180,13 @@ let visit_description desc fmt self = 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 "{@[ "; let todo = visit_symbol symbol todo is_son in Format.fprintf fmt "@]} @ "; todo - | Slist0sep (symbol,sep) -> + | Slist0sep (symbol,sep,false) -> Format.fprintf fmt "[@[ "; let todo = visit_symbol symbol todo is_son in Format.fprintf fmt "{@[ "; @@ -198,7 +200,7 @@ let visit_description desc fmt self = let todo = visit_symbol symbol todo is_son in Format.fprintf fmt "@]}+ @ "; todo - | Slist1sep (symbol,sep) -> + | Slist1sep (symbol,sep,false) -> let todo = visit_symbol symbol todo is_son in Format.fprintf fmt "{@[ "; let todo = visit_symbol sep todo is_son in