Thanks, I have applied this patch. It works fine.
Btw. If anyone have an rpm spec file for menhir, then I would like a copy. Regards Andreas Bach Aaen -----Original Message----- From: Julia Lawall [mailto:[email protected]] Sent: 24. marts 2010 22:56 To: Aaen, Andreas.Bach Cc: [email protected] Subject: Re: [Cocci] insert after #include Fixed. A patch for 0.2.2 is below. julia -------------- diff -u -p a/parsing_cocci/parser_cocci_menhir.mly b/parsing_cocci/parser_cocci_menhir.mly --- a/parsing_cocci/parser_cocci_menhir.mly 2010-03-12 16:34:04.000000000 +0100 +++ b/parsing_cocci/parser_cocci_menhir.mly 2010-03-24 22:50:57.000000000 +0100 @@ -680,6 +680,8 @@ includes: P.clt2mcode (Ast.NonLocal (Parse_aux.str2inc (P.id2name $1))) (P.drop_bef clt))) } +| d=defineop TLineEnd + { d (Ast0.wrap(Ast0.DOTS([]))) } | d=defineop t=ctype TLineEnd { let ty = Ast0.wrap(Ast0.TopExp(Ast0.wrap(Ast0.TypeExp(t)))) in d (Ast0.wrap(Ast0.DOTS([ty]))) } diff -u -p a/parsing_cocci/compute_lines.ml b/parsing_cocci/compute_lines.ml --- a/parsing_cocci/compute_lines.ml 2010-03-12 16:34:05.000000000 +0100 +++ b/parsing_cocci/compute_lines.ml 2010-03-24 22:51:34.000000000 +0100 @@ -205,17 +205,21 @@ let dots is_dots prev fn d = (* --------------------------------------------------------------------- *) (* Identifier *) -let rec ident i = +(* for #define name, with no value, to compute right side *) let +mkidres a b c d r = (mkres a b c d,r) + +let rec full_ident i = match Ast0.unwrap i with Ast0.Id(name) as ui -> - let name = promote_mcode name in mkres i ui name name + let name = promote_mcode name in mkidres i ui name name name | Ast0.MetaId(name,_,_) | Ast0.MetaFunc(name,_,_) | Ast0.MetaLocalFunc(name,_,_) as ui -> - let name = promote_mcode name in mkres i ui name name + let name = promote_mcode name in mkidres i ui name name name | Ast0.OptIdent(id) -> - let id = ident id in mkres i (Ast0.OptIdent(id)) id id + let (id,r) = full_ident id in mkidres i (Ast0.OptIdent(id)) id id r | Ast0.UniqueIdent(id) -> - let id = ident id in mkres i (Ast0.UniqueIdent(id)) id id + let (id,r) = full_ident id in mkidres i (Ast0.UniqueIdent(id)) id id r +and ident i = let (id,_) = full_ident i in id (* --------------------------------------------------------------------- *) (* Expression *) @@ -593,14 +597,14 @@ let rec define_param p = let res = define_param dp in mkres p (Ast0.UniqueDParam(res)) res res -let define_parameters x = +let define_parameters x id = match Ast0.unwrap x with - Ast0.NoParams -> x (* no info, should be ignored *) + Ast0.NoParams -> (x,id) (* no info, should be ignored *) | Ast0.DParams(lp,dp,rp) -> let dp = dots is_define_param_dots None define_param dp in let l = promote_mcode lp in let r = promote_mcode rp in - mkres x (Ast0.DParams(lp,dp,rp)) l r + (mkres x (Ast0.DParams(lp,dp,rp)) l r, r) (* --------------------------------------------------------------------- *) (* Top-level code *) @@ -791,9 +795,9 @@ let rec statement s = | Ast0.Include(inc,stm) -> mkres s (Ast0.Include(inc,stm)) (promote_mcode inc) (promote_mcode stm) | Ast0.Define(def,id,params,body) -> - let id = ident id in - let params = define_parameters params in - let body = dots is_stm_dots None statement body in + let (id,right) = full_ident id in + let (params,prev) = define_parameters params right in + let body = dots is_stm_dots (Some prev) statement body in mkres s (Ast0.Define(def,id,params,body)) (promote_mcode def) body | Ast0.OptStm(stm) -> let stm = statement stm in mkres s (Ast0.OptStm(stm)) stm stm _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
