Release coccinelle-0.2.0rc1
[bpt/coccinelle.git] / parsing_cocci / unparse_ast0.ml
index 39c5b46..8fbd4b2 100644 (file)
@@ -1,25 +1,3 @@
-(*
-* Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen
-* Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller
-* This file is part of Coccinelle.
-* 
-* Coccinelle is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, according to version 2 of the License.
-* 
-* Coccinelle is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-* 
-* You should have received a copy of the GNU General Public License
-* along with Coccinelle.  If not, see <http://www.gnu.org/licenses/>.
-* 
-* The authors reserve the right to distribute this or future versions of
-* Coccinelle under other licenses.
-*)
-
-
 open Format
 module Ast0 = Ast0_cocci
 module U = Pretty_print_cocci
@@ -79,7 +57,7 @@ let mcodekind brackets fn x info mc =
        (function x ->
          print_string lb; fn x; print_string rb)
        x plus_streams
-  | Ast0.PLUS -> print_int (info.Ast0.pos_info.Ast0.column); fn x
+  | Ast0.PLUS -> print_int (info.Ast0.pos_info.Ast0.column); fn x
   | Ast0.MIXED(plus_streams) ->
       let (lb,rb) =
        if !quiet
@@ -472,11 +450,12 @@ and statement arity s =
          close_box(); mcode print_string rp; print_string " ";
          statement arity body;
          mcode (function _ -> ()) ((),(),info,aft,ref Ast0.NoMetaPos,-1)
-      |        Ast0.Switch(switch,lp,exp,rp,lb,cases,rb) ->
+      |        Ast0.Switch(switch,lp,exp,rp,lb,decls,cases,rb) ->
          print_string arity;
          mcode print_string switch; print_string " ";
          mcode print_string_box lp; expression exp; close_box();
          mcode print_string rp; print_string " "; mcode print_string lb;
+         dots force_newline (statement arity) decls;
          dots force_newline (case_line arity) cases;
          mcode print_string rb
       | Ast0.Break(br,sem) ->
@@ -501,14 +480,14 @@ and statement arity s =
          | Ast0.PureContext -> print_string "pure_context")*)
       | Ast0.MetaStmtList(name,_) ->
          print_string arity;  mcode print_meta name
-      | Ast0.Disj(_,statement_dots_list,_,_) ->
+      | Ast0.Disj(starter,statement_dots_list,_,ender) ->
          print_string arity;
-         print_string "\n("; force_newline();
+         print_string "\n"; mcode print_string starter; force_newline();
          print_between
            (function _ -> print_string "\n|"; force_newline())
            (dots force_newline (statement arity))
            statement_dots_list;
-         print_string "\n)"
+         print_string "\n"; mcode print_string ender
       | Ast0.Nest(starter,stmt_dots,ender,whn,multi) ->
          print_string arity;
          mcode print_string starter;
@@ -586,6 +565,12 @@ and case_line arity c =
          mcode print_string case; print_string " "; expression exp;
          mcode print_string colon; print_string " ";
          dots force_newline (statement arity) code
+      | Ast0.DisjCase(starter,case_lines,mids,ender) ->
+         print_string "\n("; force_newline();
+         print_between
+           (function _ -> print_string "\n|"; force_newline())
+           (case_line arity) case_lines;
+         print_string "\n)"
       | Ast0.OptCase(case) -> case_line "?" case)
 
 and statement_dots l = dots (function _ -> ()) (statement "") l