(*
+ * 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.
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
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 *) *
+ 'a * arity * info * mcodekind * meta_pos list ref (* pos, - only *) *
int (* adjacency_index *)
and 'a 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 *
+ string mcode list (* the |s *) * string mcode
| OptIdent of ident
| UniqueIdent of ident
and constraints =
NoConstraint
- | NotIdCstrt of Ast_cocci.idconstraint
+ | NotIdCstrt of Ast_cocci.reconstraint
| NotExpCstrt of expression list
+ | SubExpCstrt of Ast_cocci.meta_name list
-and listlen = Ast_cocci.meta_name mcode option
+and listlen =
+ MetaListLen of Ast_cocci.meta_name mcode
+ | CstListLen of int
+ | AnyListLen
(* --------------------------------------------------------------------- *)
(* Types *)
string mcode (* ) *)
| Array of typeC * string mcode (* [ *) *
expression option * string mcode (* ] *)
- | EnumName of string mcode (*enum*) * ident (* name *)
+ | EnumName of string mcode (*enum*) * ident option (* name *)
+ | EnumDef of typeC (* either StructUnionName or metavar *) *
+ string mcode (* { *) * expression dots * string mcode (* } *)
| StructUnionName of Ast_cocci.structUnion mcode * ident option (* name *)
| StructUnionDef of typeC (* either StructUnionName or metavar *) *
string mcode (* { *) * declaration dots * string mcode (* } *)
split out into multiple declarations of a single variable each. *)
and base_declaration =
- Init of Ast_cocci.storage mcode option * typeC * ident *
+ MetaDecl of Ast_cocci.meta_name mcode * pure (* variables *)
+ | MetaField of Ast_cocci.meta_name mcode * pure (* structure fields *)
+ | MetaFieldList of Ast_cocci.meta_name mcode * listlen * pure
+ | Init of Ast_cocci.storage mcode option * typeC * ident *
string mcode (*=*) * initialiser * string mcode (*;*)
| UnInit of Ast_cocci.storage mcode option * typeC * ident *
string mcode (* ; *)
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 (*}*)
+ | InitList of string mcode (*{*) * initialiser_list * string mcode (*}*) *
+ bool (* true if ordered, false if unordered *)
| InitGccExt of
designator list (* name *) * string mcode (*=*) *
initialiser (* gccext: *)
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)
string mcode (* { *) * statement dots *
string mcode (* } *)
| Include of string mcode (* #include *) * Ast_cocci.inc_file mcode(* file *)
+ | Undef of string mcode (* #define *) * ident (* name *)
| Define of string mcode (* #define *) * ident (* name *) *
define_parameters (*params*) * statement dots
| OptStm of statement
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
(string list * string list * Ast_cocci.dependency * string *
Ast_cocci.exists)) *
(rule * Ast_cocci.metavar list) * Ast_cocci.ruletype
- | ScriptRule of
- string * Ast_cocci.dependency * (string * Ast_cocci.meta_name) list *
+ | ScriptRule of string (* name *) *
+ string * Ast_cocci.dependency *
+ (Ast_cocci.script_meta_name *
+ Ast_cocci.meta_name * Ast_cocci.metavar) list (*inherited vars*) *
+ Ast_cocci.meta_name list (*script vars*) *
string
- | InitialScriptRule of string (*language*) * string (*code*)
- | FinalScriptRule of string (*language*) * string (*code*)
+ | InitialScriptRule of string (* name *) *
+ string (*language*) * Ast_cocci.dependency * string (*code*)
+ | FinalScriptRule of string (* name *) *
+ string (*language*) * Ast_cocci.dependency * string (*code*)
(* --------------------------------------------------------------------- *)
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
val set_mcode_data : 'a -> 'a mcode -> 'a mcode
val make_mcode : 'a -> 'a mcode
val make_mcode_info : 'a -> info -> 'a mcode
+val make_minus_mcode : 'a -> 'a mcode
val ast0_type_to_type : typeC -> Type_cocci.typeC
val reverse_type : Type_cocci.typeC -> base_typeC