X-Git-Url: https://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/faf9a90c4f9e1e85931cb6b01de660587416eb97..5427db06e325c3c7c572e2e1ebe88a2fd211641c:/popl09/pretty_print_popl.ml?ds=sidebyside diff --git a/popl09/pretty_print_popl.ml b/popl09/pretty_print_popl.ml index 86ca8fe..e76b8fc 100644 --- a/popl09/pretty_print_popl.ml +++ b/popl09/pretty_print_popl.ml @@ -1,23 +1,25 @@ (* -* 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 . -* -* The authors reserve the right to distribute this or future versions of -* Coccinelle under other licenses. -*) + * Copyright 2010, INRIA, University of Copenhagen + * Julia Lawall, Rene Rydhof Hansen, Gilles Muller, Nicolas Palix + * Copyright 2005-2009, Ecole des Mines de Nantes, University of Copenhagen + * Yoann Padioleau, Julia Lawall, Rene Rydhof Hansen, Henrik Stuart, Gilles Muller, Nicolas Palix + * 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 . + * + * The authors reserve the right to distribute this or future versions of + * Coccinelle under other licenses. + *) open Format @@ -34,21 +36,24 @@ let end_block str = let print_around printer term = function Ast.NOTHING -> printer term - | Ast.BEFORE(bef) -> + | Ast.BEFORE(bef,_) -> Pretty_print_cocci.print_anything "<<< " bef; printer term - | Ast.AFTER(aft) -> + | Ast.AFTER(aft,_) -> printer term; Pretty_print_cocci.print_anything ">>> " aft - | Ast.BEFOREAFTER(bef,aft) -> + | Ast.BEFOREAFTER(bef,aft,_) -> Pretty_print_cocci.print_anything "<<< " bef; printer term; Pretty_print_cocci.print_anything ">>> " aft let mcode fn = function - (x, _, Ast.MINUS(_,plus_stream), pos) -> + (x, _, Ast.MINUS(_,_,_,plus_stream), pos) -> print_string "-"; fn x; - Pretty_print_cocci.print_anything ">>> " plus_stream - | (x, _, Ast.CONTEXT(_,plus_streams), pos) -> + (match plus_stream with + Ast.NOREPLACEMENT -> () + | Ast.REPLACEMENT(plus_stream,_) -> + Pretty_print_cocci.print_anything ">>> " plus_stream) + | (x, _, Ast.CONTEXT(_,plus_streams), pos) -> print_around fn x plus_streams - | (x, info, Ast.PLUS, pos) -> fn x + | (x, info, Ast.PLUS _, pos) -> fn x (* --------------------------------------------------------------------- *) @@ -62,7 +67,7 @@ and print_term = function Past.Atomic(term) -> Pretty_print_cocci.rule_elem "" term | Past.IfThen(test,thn,(_,_,_,aft)) -> print_term test; print_term thn; - mcode (function _ -> ()) ((),Ast.no_info,aft,Ast.NoMetaPos) + mcode (function _ -> ()) ((),Ast.no_info,aft,[]) | Past.TExists((_,v),term) -> print_string "exists "; print_string v; print_string " ."; force_newline(); print_term term