X-Git-Url: http://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/55d3838895e5e4567905641c66eaab3bc3c19376..c3e37e979447bade993c7c600dc0b22ca64a571d:/parsing_cocci/parser_cocci_menhir.mly diff --git a/parsing_cocci/parser_cocci_menhir.mly b/parsing_cocci/parser_cocci_menhir.mly index 86972fa..93d4d5a 100644 --- a/parsing_cocci/parser_cocci_menhir.mly +++ b/parsing_cocci/parser_cocci_menhir.mly @@ -56,7 +56,8 @@ module P = Parse_aux %token TIf TElse TWhile TFor TDo TSwitch TCase TDefault TReturn %token TBreak TContinue TGoto TSizeof TFunDecl -%token TIdent TTypeId TDeclarerId TIteratorId TPragma +%token TIdent TTypeId TDeclarerId TIteratorId +%token TPragma %token TMetaId TMetaFunc TMetaLocalFunc %token TMetaIterator TMetaDeclarer @@ -108,7 +109,7 @@ module P = Parse_aux %token TAssign %token TIso TRightIso TIsoExpression TIsoStatement TIsoDeclaration TIsoType -%token TIsoTopLevel TIsoArgExpression TIsoTestExpression +%token TIsoTopLevel TIsoArgExpression TIsoTestExpression TIsoToTestExpression %token TInvalid @@ -207,10 +208,10 @@ rule_name: { P.make_generated_rule_name_result None d i a e ee } | TScript TDotDot lang=pure_ident d=depends TArob { P.make_script_rule_name_result lang d } - | TInitialize TDotDot lang=pure_ident TArob - { P.make_initial_script_rule_name_result lang } - | TFinalize TDotDot lang=pure_ident TArob - { P.make_final_script_rule_name_result lang } + | TInitialize TDotDot lang=pure_ident d=depends TArob + { P.make_initial_script_rule_name_result lang d } + | TFinalize TDotDot lang=pure_ident d=depends TArob + { P.make_final_script_rule_name_result lang d } extends: /* empty */ { () } @@ -1516,20 +1517,20 @@ regexp_eqid: } not_eqid: - TNotEq i=pure_ident + TNotEq i=pure_ident_or_meta_ident { (if !Data.in_iso then failwith "constraints not allowed in iso file"); (if !Data.in_generating (* pb: constraints not stored with metavars; too lazy to search for them in the pattern *) then failwith "constraints not allowed in a generated rule file"); - Ast.IdNegIdSet([fst i]) } - | TNotEq TOBrace l=comma_list(pure_ident) TCBrace + Ast.IdNegIdSet([snd i]) } + | TNotEq TOBrace l=comma_list(pure_ident_or_meta_ident) TCBrace { (if !Data.in_iso then failwith "constraints not allowed in iso file"); (if !Data.in_generating then failwith "constraints not allowed in a generated rule file"); - Ast.IdNegIdSet(List.map fst l) + Ast.IdNegIdSet(List.map snd l) } re_or_not_eqe: @@ -1944,18 +1945,22 @@ any_strict: *****************************************************************************/ iso_main: - TIsoExpression e1=dexpr el=list(iso(dexpr)) EOF - { P.iso_adjust (function x -> Ast0.ExprTag x) e1 el } -| TIsoArgExpression e1=dexpr el=list(iso(dexpr)) EOF - { P.iso_adjust (function x -> Ast0.ArgExprTag x) e1 el } -| TIsoTestExpression e1=dexpr el=list(iso(dexpr)) EOF - { P.iso_adjust (function x -> Ast0.TestExprTag x) e1 el } + TIsoExpression e1=eexpr el=list(iso(eexpr)) EOF + { let fn x = Ast0.ExprTag x in P.iso_adjust fn fn e1 el } +| TIsoArgExpression e1=eexpr el=list(iso(eexpr)) EOF + { let fn x = Ast0.ArgExprTag x in P.iso_adjust fn fn e1 el } +| TIsoTestExpression e1=eexpr el=list(iso(eexpr)) EOF + { let fn x = Ast0.TestExprTag x in P.iso_adjust fn fn e1 el } +| TIsoToTestExpression e1=eexpr el=list(iso(eexpr)) EOF + { let ffn x = Ast0.ExprTag x in + let fn x = Ast0.TestExprTag x in + P.iso_adjust ffn fn e1 el } | TIsoStatement s1=single_statement sl=list(iso(single_statement)) EOF - { P.iso_adjust (function x -> Ast0.StmtTag x) s1 sl } + { let fn x = Ast0.StmtTag x in P.iso_adjust fn fn s1 sl } | TIsoType t1=ctype tl=list(iso(ctype)) EOF - { P.iso_adjust (function x -> Ast0.TypeCTag x) t1 tl } + { let fn x = Ast0.TypeCTag x in P.iso_adjust fn fn t1 tl } | TIsoTopLevel e1=nest_start el=list(iso(nest_start)) EOF - { P.iso_adjust (function x -> Ast0.DotsStmtTag x) e1 el } + { let fn x = Ast0.DotsStmtTag x in P.iso_adjust fn fn e1 el } | TIsoDeclaration d1=decl_var dl=list(iso(decl_var)) EOF { let check_one = function [x] -> x @@ -1970,7 +1975,7 @@ iso_main: Common.Left x -> Common.Left(check_one x) | Common.Right x -> Common.Right(check_one x)) dl in - P.iso_adjust (function x -> Ast0.DeclTag x) d1 dl } + let fn x = Ast0.DeclTag x in P.iso_adjust fn fn d1 dl } iso(term): TIso t=term { Common.Left t }