X-Git-Url: https://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/ae4735db5e7e9386036cf7b496ebdc994514dc53..174d164065f16d4a54fd565b9cae251e89a5095e:/parsing_cocci/ast_cocci.mli diff --git a/parsing_cocci/ast_cocci.mli b/parsing_cocci/ast_cocci.mli index bc05c42..90b21c3 100644 --- a/parsing_cocci/ast_cocci.mli +++ b/parsing_cocci/ast_cocci.mli @@ -1,5 +1,7 @@ (* - * Copyright 2005-2010, Ecole des Mines de Nantes, University of Copenhagen + * 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. * @@ -20,19 +22,14 @@ *) -(* Constraints on Meta-* Identifiers, Functions *) -type idconstraint = - IdNoConstraint - | IdNegIdSet of string list - | IdRegExp of string * Str.regexp - | IdNotRegExp of string * Str.regexp - (* --------------------------------------------------------------------- *) (* Modified code *) +type added_string = Noindent of string | Indent of string + type info = { line : int; column : int; - strbef : (string * int (* line *) * int (* col *)) list; - straft : (string * int (* line *) * int (* col *)) list } + strbef : (added_string * int (* line *) * int (* col *)) list; + straft : (added_string * int (* line *) * int (* col *)) list } type line = int type meta_name = string * string type 'a wrap = @@ -180,7 +177,10 @@ and base_expression = | EComma of string mcode (* only in arg lists *) | DisjExpr of expression list - | NestExpr of expression dots * expression option * multi + | NestExpr of string mcode (* <.../<+... *) * + expression dots * + string mcode (* ...>/...+> *) * + expression option * multi (* can appear in arg lists, and also inside Nest, as in: if(< ... X ... Y ...>) @@ -194,8 +194,19 @@ and base_expression = and constraints = NoConstraint - | NotIdCstrt of idconstraint + | NotIdCstrt of reconstraint | NotExpCstrt of expression list + | SubExpCstrt of meta_name list + +(* Constraints on Meta-* Identifiers, Functions *) +and idconstraint = + IdNoConstraint + | IdNegIdSet of string list * meta_name list + | IdRegExpConstraint of reconstraint + +and reconstraint = + | IdRegExp of string * Str.regexp + | IdNotRegExp of string * Str.regexp and form = ANY | ID | LocalID | CONST (* form for MetaExp *) @@ -289,7 +300,8 @@ and declaration = base_declaration wrap and base_initialiser = MetaInit of meta_name mcode * keep_binding * inherited | InitExpr of expression - | InitList of string mcode (*{*) * initialiser list * string mcode (*}*) * + | InitList of bool (* true if all are - *) * + string mcode (*{*) * initialiser list * string mcode (*}*) * initialiser list (* whencode: elements that shouldn't appear in init *) | InitGccExt of designator list (* name *) * string mcode (*=*) * @@ -449,7 +461,8 @@ and base_statement = statement (*decl*) dots * case_line list * rule_elem(*}*) | Atomic of rule_elem | Disj of statement dots list - | Nest of statement dots * + | Nest of string mcode (* <.../<+... *) * statement dots * + string mcode (* ...>/...+> *) * (statement dots,statement) whencode list * multi * dots_whencode list * dots_whencode list | FunDecl of rule_elem (* header *) * rule_elem (* { *) * @@ -516,9 +529,12 @@ and rulename = | GeneratedRulename of string option * dependency * string list * string list * exists * bool (* true if the whole thing is an expression *) - | ScriptRulename of string * dependency - | InitialScriptRulename of string - | FinalScriptRulename of string + | ScriptRulename of string option (* name *) * string (* language *) * + dependency + | InitialScriptRulename of string option (* name *) * string (* language *) * + dependency + | FinalScriptRulename of string option (* name *) * string (* language *) * + dependency and ruletype = Normal | Generated @@ -526,9 +542,12 @@ and rule = CocciRule of string (* name *) * (dependency * string list (* dropped isos *) * exists) * top_level list * bool list (* true if generates an exp *) * ruletype - | ScriptRule of string * dependency * (string * meta_name) list * string - | InitialScriptRule of string * string - | FinalScriptRule of string * string + | ScriptRule of string (* name *) * + string * dependency * (string * meta_name * metavar) list * string + | InitialScriptRule of string (* name *) * + string * dependency * string + | FinalScriptRule of string (* name *) * + string * dependency * string and dependency = Dep of string (* rule applies for the current binding *) @@ -564,7 +583,7 @@ and anything = | CaseLineTag of case_line | ConstVolTag of const_vol | Token of string * info option - | Pragma of string list + | Pragma of added_string list | Code of top_level | ExprDotsTag of expression dots | ParamDotsTag of parameterTypeDef dots