Coccinelle release 1.0.0-rc13
[bpt/coccinelle.git] / parsing_cocci / parser_cocci_menhir.mly
index 448662c..2a6a7c7 100644 (file)
  */
 
 
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ * 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):