X-Git-Url: http://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/690d68d19cb322bc18140b6406e298038dcf47f2..f537ebc4bbd27866c9ac3e1198b6756ebab7f2ba:/parsing_cocci/disjdistr.ml diff --git a/parsing_cocci/disjdistr.ml b/parsing_cocci/disjdistr.ml index 21d45da..4fb19e1 100644 --- a/parsing_cocci/disjdistr.ml +++ b/parsing_cocci/disjdistr.ml @@ -105,9 +105,20 @@ and disjtypeC bty = Ast.rewrap bty (Ast.StructUnionDef(ty,lb,decls,rb))) | Ast.TypeName(_) | Ast.MetaType(_,_,_) -> [bty] +and disjident e = + match Ast.unwrap e with + Ast.DisjId(id_list) -> List.concat (List.map disjident id_list) + | Ast.OptIdent(id) -> + let id = disjident id in + List.map (function id -> Ast.rewrap e (Ast.OptIdent(id))) id + | Ast.UniqueIdent(id) -> + let id = disjident id in + List.map (function id -> Ast.rewrap e (Ast.UniqueIdent(id))) id + | _ -> [e] + and disjexp e = match Ast.unwrap e with - Ast.Ident(_) | Ast.Constant(_) -> [e] + Ast.Ident(_) | Ast.Constant(_) -> [e] (* even Ident can't contain disj *) | Ast.FunCall(fn,lp,args,rp) -> disjmult2 (disjexp fn) (disjdots disjexp args) (function fn -> function args -> @@ -175,8 +186,7 @@ and disjexp e = List.map (function ty -> Ast.rewrap e (Ast.TypeExp(ty))) ty | Ast.MetaErr(_,_,_,_) | Ast.MetaExpr(_,_,_,_,_,_) | Ast.MetaExprList(_,_,_,_) | Ast.EComma(_) -> [e] - | Ast.DisjExpr(exp_list) -> - List.concat (List.map disjexp exp_list) + | Ast.DisjExpr(exp_list) -> List.concat (List.map disjexp exp_list) | Ast.NestExpr(starter,expr_dots,ender,whencode,multi) -> (* not sure what to do here, so ambiguities still possible *) [e] @@ -251,7 +261,8 @@ and designator = function and disjdecl d = match Ast.unwrap d with - Ast.MetaDecl(_,_,_) | Ast.MetaField(_,_,_) -> [d] + Ast.MetaDecl(_,_,_) | Ast.MetaField(_,_,_) + | Ast.MetaFieldList(_,_,_,_) -> [d] | Ast.Init(stg,ty,id,eq,ini,sem) -> disjmult2 (disjty ty) (disjini ini) (function ty -> function ini -> @@ -346,6 +357,7 @@ let rec disj_rule_elem r k re = orify_rule_elem_ini re init (function init -> Ast.rewrap init (Ast.TopInit(init))) | Ast.Include(inc,s) -> re + | Ast.Undef(def,id) -> re | Ast.DefineHeader(def,id,params) -> re | Ast.Default(def,colon) -> re | Ast.Case(case,exp,colon) ->