Coccinelle release 1.0.0-rc3
[bpt/coccinelle.git] / parsing_cocci / ast0_cocci.mli
index 185b82d..be53d5a 100644 (file)
@@ -1,3 +1,27 @@
+(*
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * The authors reserve the right to distribute this or future versions of
+ * Coccinelle under other licenses.
+ *)
+
+
 (* --------------------------------------------------------------------- *)
 (* Modified code *)
 
@@ -9,7 +33,7 @@ type token_info =
 val default_token_info : token_info
 
 type mcodekind =
-    MINUS       of (Ast_cocci.anything list list * token_info) ref
+    MINUS       of (Ast_cocci.anything Ast_cocci.replacement * token_info) ref
   | PLUS        of Ast_cocci.count
   | CONTEXT     of (Ast_cocci.anything Ast_cocci.befaft *
                      token_info * token_info) ref
@@ -28,7 +52,7 @@ type info = { pos_info : position_info;
              strings_after : (Ast_cocci.added_string * position_info) list }
 
 type 'a mcode =
-    'a * arity * info * mcodekind * meta_pos ref (* pos, - only *) *
+    'a * arity * info * mcodekind * meta_pos list ref (* pos, - only *) *
       int (* adjacency_index *)
 
 and 'a wrap =
@@ -69,7 +93,8 @@ and 'a dots = 'a base_dots wrap
 
 and base_ident =
     Id            of string mcode
-  | MetaId        of Ast_cocci.meta_name mcode * Ast_cocci.idconstraint * pure
+  | MetaId        of Ast_cocci.meta_name mcode * Ast_cocci.idconstraint *
+       Ast_cocci.seed * pure
   | MetaFunc      of Ast_cocci.meta_name mcode * Ast_cocci.idconstraint * pure
   | MetaLocalFunc of Ast_cocci.meta_name mcode * Ast_cocci.idconstraint * pure
   | DisjId        of string mcode * ident list *
@@ -198,6 +223,7 @@ and declaration = base_declaration wrap
 
 and base_initialiser =
     MetaInit of Ast_cocci.meta_name mcode * pure
+  | MetaInitList of Ast_cocci.meta_name mcode * listlen * pure
   | InitExpr of expression
   | InitList of string mcode (*{*) * initialiser_list * string mcode (*}*) *
        bool (* true if ordered, false if unordered *)
@@ -266,7 +292,7 @@ and base_statement =
     Decl          of (info * mcodekind) (* before the decl *) * declaration
   | Seq           of string mcode (* { *) * statement dots *
                     string mcode (* } *)
-  | ExprStatement of expression * string mcode (*;*)
+  | ExprStatement of expression option * string mcode (*;*)
   | IfThen        of string mcode (* if *) * string mcode (* ( *) *
                     expression * string mcode (* ) *) *
                     statement * (info * mcodekind)
@@ -360,13 +386,13 @@ and case_line = base_case_line wrap
 and meta_pos =
     MetaPos of Ast_cocci.meta_name mcode * Ast_cocci.meta_name list *
        Ast_cocci.meta_collect
-  | NoMetaPos
 
 (* --------------------------------------------------------------------- *)
 (* Top-level code *)
 
 and base_top_level =
-    DECL of statement
+    NONDECL of statement (* cannot match all of a top-level declaration *)
+  | TOPCODE of statement dots
   | CODE of statement dots
   | FILEINFO of string mcode (* old file *) * string mcode (* new file *)
   | ERRORWORDS of expression list
@@ -450,9 +476,9 @@ val unwrap_mcode : 'a mcode -> 'a
 val rewrap : 'a wrap -> 'b -> 'b wrap
 val rewrap_mcode : 'a mcode -> 'b -> 'b mcode
 val copywrap : 'a wrap -> 'b -> 'b wrap
-val get_pos : 'a mcode -> meta_pos
-val get_pos_ref : 'a mcode -> meta_pos ref
-val set_pos : meta_pos -> 'a mcode -> 'a mcode
+val get_pos : 'a mcode -> meta_pos list
+val get_pos_ref : 'a mcode -> meta_pos list ref
+val set_pos : meta_pos list -> 'a mcode -> 'a mcode
 val get_info : 'a wrap -> info
 val set_info : 'a wrap -> info -> 'a wrap
 val get_index : 'a wrap -> int