Release coccinelle-0.1.7
[bpt/coccinelle.git] / parsing_cocci / ast0_cocci.mli
index 1b448fa..f6db914 100644 (file)
@@ -16,13 +16,16 @@ type mcodekind =
   | MIXED       of (Ast_cocci.anything Ast_cocci.befaft *
                      token_info * token_info) ref
 
-type info = { line_start : int; line_end : int;
-             logical_start : int; logical_end : int;
+type position_info = { line_start : int; line_end : int;
+                      logical_start : int; logical_end : int;
+                      column : int; offset : int; }
+
+type info = { pos_info : position_info;
              attachable_start : bool; attachable_end : bool;
              mcode_start : mcodekind list; mcode_end : mcodekind list;
-             column : int; offset : int;
              (* the following are only for + code *)
-             strings_before : string list; strings_after : string list }
+             strings_before : (string * position_info) list;
+             strings_after : (string * position_info) list }
 
 type 'a mcode = 'a * arity * info * mcodekind * meta_pos ref (* pos, - only *)
 and 'a wrap =
@@ -74,7 +77,7 @@ and ident = base_ident wrap
 (* --------------------------------------------------------------------- *)
 (* Expression *)
 
-and base_expression = 
+and base_expression =
     Ident          of ident
   | Constant       of Ast_cocci.constant mcode
   | FunCall        of expression * string mcode (* ( *) *
@@ -123,10 +126,10 @@ and listlen = Ast_cocci.meta_name mcode option
 (* --------------------------------------------------------------------- *)
 (* Types *)
 
-and base_typeC = 
+and base_typeC =
     ConstVol        of Ast_cocci.const_vol mcode * typeC
-  | BaseType        of Ast_cocci.baseType mcode * Ast_cocci.sign mcode option
-  | ImplicitInt     of Ast_cocci.sign mcode
+  | BaseType        of Ast_cocci.baseType * string mcode list
+  | Signed          of Ast_cocci.sign mcode * typeC option
   | Pointer         of typeC * string mcode (* * *)
   | FunctionPointer of typeC *
                  string mcode(* ( *)*string mcode(* * *)*string mcode(* ) *)*
@@ -136,6 +139,7 @@ and base_typeC =
                        string mcode (* ) *)
   | Array           of typeC * string mcode (* [ *) *
                       expression option * string mcode (* ] *)
+  | EnumName        of string mcode (*enum*) * ident (* name *)
   | StructUnionName of Ast_cocci.structUnion mcode * ident option (* name *)
   | StructUnionDef  of typeC (* either StructUnionName or metavar *) *
        string mcode (* { *) * declaration dots * string mcode (* } *)
@@ -174,24 +178,26 @@ and declaration = base_declaration wrap
 (* Initializers *)
 
 and base_initialiser =
-    InitExpr of expression 
+    MetaInit of Ast_cocci.meta_name mcode * pure
+  | InitExpr of expression
   | InitList of string mcode (*{*) * initialiser_list * string mcode (*}*)
-  | InitGccDotName of
-      string mcode (*.*) * ident (* name *) * string mcode (*=*) *
+  | InitGccExt of
+      designator list (* name *) * string mcode (*=*) *
        initialiser (* gccext: *)
   | InitGccName of ident (* name *) * string mcode (*:*) *
        initialiser
-  | InitGccIndex of
-      string mcode (*[*) * expression * string mcode (*]*) *
-       string mcode (*=*) * initialiser
-  | InitGccRange of
-      string mcode (*[*) * expression * string mcode (*...*) *
-        expression * string mcode (*]*) * string mcode (*=*) * initialiser
   | IComma of string mcode
   | Idots  of string mcode (* ... *) * initialiser option (* whencode *)
   | OptIni    of initialiser
   | UniqueIni of initialiser
 
+and designator =
+    DesignatorField of string mcode (* . *) * ident
+  | DesignatorIndex of string mcode (* [ *) * expression * string mcode (* ] *)
+  | DesignatorRange of
+      string mcode (* [ *) * expression * string mcode (* ... *) *
+      expression * string mcode (* ] *)
+
 and initialiser = base_initialiser wrap
 
 and initialiser_list = initialiser dots
@@ -279,6 +285,7 @@ and base_statement =
   | Exp           of expression  (* only in dotted statement lists *)
   | TopExp        of expression (* for macros body *)
   | Ty            of typeC (* only at top level *)
+  | TopInit       of initialiser (* only at top level *)
   | Disj          of string mcode * statement dots list * string mcode list *
                     string mcode
   | Nest          of string mcode * statement dots * string mcode *
@@ -310,6 +317,8 @@ and ('a,'b) whencode =
     WhenNot of 'a
   | WhenAlways of 'b
   | WhenModifier of Ast_cocci.when_modifier
+  | WhenNotTrue of expression
+  | WhenNotFalse of expression
 
 and statement = base_statement wrap
 
@@ -347,10 +356,12 @@ and parsed_rule =
       (rule * Ast_cocci.metavar list *
         (string list * string list * Ast_cocci.dependency * string *
            Ast_cocci.exists)) *
-       (rule * Ast_cocci.metavar list)
+       (rule * Ast_cocci.metavar list) * Ast_cocci.ruletype
   | ScriptRule of
       string * Ast_cocci.dependency * (string * Ast_cocci.meta_name) list *
        string
+  | InitialScriptRule of string * string
+  | FinalScriptRule of string * string
 
 (* --------------------------------------------------------------------- *)
 
@@ -373,6 +384,8 @@ and anything =
   | CaseLineTag of case_line
   | TopTag of top_level
   | IsoWhenTag of Ast_cocci.when_modifier (*only for when code, in iso phase*)
+  | IsoWhenTTag of expression(*only for when code, in iso phase*)
+  | IsoWhenFTag of expression(*only for when code, in iso phase*)
   | MetaPosTag of meta_pos (* only in iso phase *)
 
 val dotsExpr : expression dots -> anything