X-Git-Url: https://git.hcoop.net/bpt/coccinelle.git/blobdiff_plain/feec80c30d140c69f5d894bd09b6071247d0fbaa..d6ce1786f27a05efa53cabeca92fc8e744a4b239:/parsing_cocci/parser_cocci_menhir.mly?ds=sidebyside diff --git a/parsing_cocci/parser_cocci_menhir.mly b/parsing_cocci/parser_cocci_menhir.mly index 448662c..2a6a7c7 100644 --- a/parsing_cocci/parser_cocci_menhir.mly +++ b/parsing_cocci/parser_cocci_menhir.mly @@ -24,6 +24,32 @@ */ +/* + * Copyright 2012, INRIA + * Julia Lawall, Gilles Muller + * Copyright 2010-2011, 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. + * + * Coccinelle is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, according to version 2 of the License. + * + * Coccinelle is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Coccinelle. If not, see . + * + * The authors reserve the right to distribute this or future versions of + * Coccinelle under other licenses. + */ + + %{ (* Not clear how to allow function declarations to specify a return type @@ -1358,6 +1384,7 @@ initialize2: /*arithexpr and not eexpr because can have ambiguity with comma*/ /*dots and nests probably not allowed at top level, haven't looked into why*/ arith_expr(eexpr,invalid) { Ast0.wrap(Ast0.InitExpr($1)) } +| nest_expressions_only { Ast0.wrap(Ast0.InitExpr($1)) } | TOBrace initialize_list TCBrace { if P.struct_initializer $2 then @@ -1497,6 +1524,16 @@ nest_expressions: P.clt2mcode "...+>" c, None, true)) } | TMeta { tmeta_to_exp $1 } +nest_expressions_only: + TOEllipsis e=expr_dots(TEllipsis) c=TCEllipsis + { Ast0.wrap(Ast0.NestExpr(P.clt2mcode "<..." $1, + Ast0.wrap(Ast0.DOTS(e (P.mkedots "..."))), + P.clt2mcode "...>" c, None, false)) } +| TPOEllipsis e=expr_dots(TEllipsis) c=TPCEllipsis + { Ast0.wrap(Ast0.NestExpr(P.clt2mcode "<+..." $1, + Ast0.wrap(Ast0.DOTS(e (P.mkedots "..."))), + P.clt2mcode "...+>" c, None, true)) } + //whenexp: TWhen TNotEq w=eexpr TLineEnd { w } pre_basic_expr(recurser,primary_extra):