X-Git-Url: http://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/b23ff9c7302ebf30b88a122d92bbfd8656f4d192..d3f655c619238baba11f20bc9f55769e66d3e428:/parsing_cocci/parser_cocci_menhir.mly diff --git a/parsing_cocci/parser_cocci_menhir.mly b/parsing_cocci/parser_cocci_menhir.mly index fa56672..0df359d 100644 --- a/parsing_cocci/parser_cocci_menhir.mly +++ b/parsing_cocci/parser_cocci_menhir.mly @@ -744,8 +744,8 @@ continue_struct_decl_list: /* very restricted what kinds of expressions can appear in an enum decl */ enum_decl_one: - | mident { Ast0.wrap(Ast0.Ident($1)) } - | mident TEq enum_val + | disj_ident { Ast0.wrap(Ast0.Ident($1)) } + | disj_ident TEq enum_val { let id = Ast0.wrap(Ast0.Ident($1)) in Ast0.wrap (Ast0.Assignment @@ -989,10 +989,10 @@ storage: | s=Tregister { P.clt2mcode Ast.Register s } | s=Textern { P.clt2mcode Ast.Extern s } -decl: t=ctype i=ident +decl: t=ctype i=disj_ident { Ast0.wrap(Ast0.Param(t, Some i)) } | t=ctype { (*verify in FunDecl*) Ast0.wrap(Ast0.Param(t, None)) } - | t=ctype lp=TOPar s=TMul i=ident rp=TCPar + | t=ctype lp=TOPar s=TMul i=disj_ident rp=TCPar lp1=TOPar d=decl_list(name_opt_decl) rp1=TCPar { let fnptr = Ast0.wrap @@ -1049,7 +1049,7 @@ statement: | TBreak TPtVirg { P.break $1 $2 } | TContinue TPtVirg { P.cont $1 $2 } | mident TDotDot { P.label $1 $2 } -| TGoto mident TPtVirg { P.goto $1 $2 $3 } +| TGoto disj_ident TPtVirg { P.goto $1 $2 $3 } | TOBrace fun_start TCBrace { P.seq $1 $2 $3 } @@ -1237,7 +1237,7 @@ one_decl_var: d_ident: - mident list(array_dec) + disj_ident list(array_dec) { ($1, function t -> List.fold_right @@ -1281,7 +1281,7 @@ initialize2: { Ast0.wrap(Ast0.InitGccName($1,P.clt2mcode ":" $2,$3)) } /* in old kernel */ designator: - | TDot mident + | TDot disj_ident { Ast0.DesignatorField (P.clt2mcode "." $1,$2) } | TOCro eexpr TCCro { Ast0.DesignatorIndex (P.clt2mcode "[" $1,$2,P.clt2mcode "]" $3) } @@ -1540,9 +1540,9 @@ postfix_expr(r,pe): | postfix_expr(r,pe) TOCro eexpr TCCro { Ast0.wrap(Ast0.ArrayAccess ($1,P.clt2mcode "[" $2,$3, P.clt2mcode "]" $4)) } - | postfix_expr(r,pe) TDot mident + | postfix_expr(r,pe) TDot disj_ident { Ast0.wrap(Ast0.RecordAccess($1, P.clt2mcode "." $2, $3)) } - | postfix_expr(r,pe) TPtrOp mident + | postfix_expr(r,pe) TPtrOp disj_ident { Ast0.wrap(Ast0.RecordPtAccess($1, P.clt2mcode "->" $2, $3)) } | postfix_expr(r,pe) TInc @@ -1856,7 +1856,7 @@ func_ident: ident { $1 } Ast0.wrap (Ast0.MetaLocalFunc(P.clt2mcode nm clt,constraints,pure)) } -fn_ident: mident { $1 } +fn_ident: disj_ident { $1 } | TMetaFunc { let (nm,constraints,pure,clt) = $1 in Ast0.wrap(Ast0.MetaFunc(P.clt2mcode nm clt,constraints,pure)) } @@ -1878,7 +1878,14 @@ mident: pure_ident { let (nm,constraints,pure,clt) = $1 in Ast0.wrap(Ast0.MetaId(P.clt2mcode nm clt,constraints,pure)) } -type_ident: mident { $1 } +disj_ident: + mident { $1 } + | lp=TOPar0 t=midzero_list(disj_ident,disj_ident) rp=TCPar0 + { let (mids,code) = t in + Ast0.wrap + (Ast0.DisjId(P.clt2mcode "(" lp,code,mids, P.clt2mcode ")" rp)) } + +type_ident: disj_ident { $1 } | TTypeId { Ast0.wrap(Ast0.Id(P.id2mcode $1)) }