Release coccinelle-0.2.3rc2
[bpt/coccinelle.git] / parsing_cocci / ast0_cocci.mli
index bd78144..731661f 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 *)
 
@@ -10,7 +34,7 @@ val default_token_info : token_info
 
 type mcodekind =
     MINUS       of (Ast_cocci.anything list list * token_info) ref
-  | PLUS
+  | PLUS        of Ast_cocci.count
   | CONTEXT     of (Ast_cocci.anything Ast_cocci.befaft *
                      token_info * token_info) ref
   | MIXED       of (Ast_cocci.anything Ast_cocci.befaft *
@@ -24,10 +48,13 @@ type info = { pos_info : position_info;
              attachable_start : bool; attachable_end : bool;
              mcode_start : mcodekind list; mcode_end : mcodekind list;
              (* the following are only for + code *)
-             strings_before : (string * position_info) list;
-             strings_after : (string * position_info) list }
+             strings_before : (Ast_cocci.added_string * position_info) list;
+             strings_after : (Ast_cocci.added_string * position_info) list }
+
+type 'a mcode =
+    'a * arity * info * mcodekind * meta_pos ref (* pos, - only *) *
+      int (* adjacency_index *)
 
-type 'a mcode = 'a * arity * info * mcodekind * meta_pos ref (* pos, - only *)
 and 'a wrap =
     { node : 'a;
       info : info;
@@ -65,10 +92,10 @@ and 'a dots = 'a base_dots wrap
 (* Identifier *)
 
 and base_ident =
-    Id of string mcode
-  | MetaId        of Ast_cocci.meta_name mcode * ident list * pure
-  | MetaFunc      of Ast_cocci.meta_name mcode * ident list * pure
-  | MetaLocalFunc of Ast_cocci.meta_name mcode * ident list * pure
+    Id            of string mcode
+  | MetaId        of Ast_cocci.meta_name mcode * Ast_cocci.idconstraint * pure
+  | MetaFunc      of Ast_cocci.meta_name mcode * Ast_cocci.idconstraint * pure
+  | MetaLocalFunc of Ast_cocci.meta_name mcode * Ast_cocci.idconstraint * pure
   | OptIdent      of ident
   | UniqueIdent   of ident
 
@@ -103,8 +130,8 @@ and base_expression =
   | SizeOfType     of string mcode (* sizeof *) * string mcode (* ( *) *
                       typeC * string mcode (* ) *)
   | TypeExp        of typeC
-  | MetaErr        of Ast_cocci.meta_name mcode * expression list * pure
-  | MetaExpr       of Ast_cocci.meta_name mcode * expression list *
+  | MetaErr        of Ast_cocci.meta_name mcode * constraints * pure
+  | MetaExpr       of Ast_cocci.meta_name mcode * constraints *
                      Type_cocci.typeC list option * Ast_cocci.form * pure
   | MetaExprList   of Ast_cocci.meta_name mcode (* only in arglists *) *
                      listlen * pure
@@ -121,6 +148,12 @@ and base_expression =
 
 and expression = base_expression wrap
 
+and constraints =
+    NoConstraint
+  | NotIdCstrt     of Ast_cocci.reconstraint
+  | NotExpCstrt    of expression list
+  | SubExpCstrt    of Ast_cocci.meta_name list
+
 and listlen = Ast_cocci.meta_name mcode option
 
 (* --------------------------------------------------------------------- *)
@@ -271,6 +304,7 @@ and base_statement =
                     statement * (info * mcodekind) (* after info *)
   | Switch        of string mcode (* switch *) * string mcode (* ( *) *
                     expression * string mcode (* ) *) * string mcode (* { *) *
+                    statement (*decl*) dots *
                     case_line dots * string mcode (* } *)
   | Break         of string mcode (* break *) * string mcode (* ; *)
   | Continue      of string mcode (* continue *) * string mcode (* ; *)
@@ -326,6 +360,8 @@ and base_case_line =
     Default of string mcode (* default *) * string mcode (*:*) * statement dots
   | Case of string mcode (* case *) * expression * string mcode (*:*) *
        statement dots
+  | DisjCase of string mcode * case_line list *
+       string mcode list (* the |s *) * string mcode
   | OptCase of case_line
 
 and case_line = base_case_line wrap
@@ -360,6 +396,10 @@ and parsed_rule =
   | ScriptRule of
       string * Ast_cocci.dependency * (string * Ast_cocci.meta_name) list *
        string
+  | InitialScriptRule of
+      string (*language*) * Ast_cocci.dependency * string (*code*)
+  | FinalScriptRule   of
+      string (*language*) * Ast_cocci.dependency * string (*code*)
 
 (* --------------------------------------------------------------------- *)