tests: upgrade and fix Bison test case
authorAkim Demaille <akim@lrde.epita.fr>
Sat, 14 Jul 2012 08:01:40 +0000 (10:01 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 14 Jul 2012 10:10:22 +0000 (12:10 +0200)
* t/yacc-bison-skeleton-cxx.sh: Request locations, to be
even more stressful.
Use %union to make sure the %{...%} is inserted where appropriate.
Fix some indentation/coding style issues.

t/yacc-bison-skeleton-cxx.sh

index 609ebc2..a02a25a 100755 (executable)
@@ -40,10 +40,15 @@ END
 cat > zardoz.yy << 'END'
 %skeleton "lalr1.cc"
 %defines
+%locations
 
+%union
+{
+  int ival;
+};
 %{
-#define YYSTYPE int
-int yylex(YYSTYPE* yylval_param);
+int yylex (yy::parser::semantic_type *yylval,
+           yy::parser::location_type *yylloc);
 %}
 
 %%
@@ -51,23 +56,22 @@ start :        /* empty */
 %%
 
 int
-yylex(YYSTYPE*)
+yylex (yy::parser::semantic_type *yylval,
+       yy::parser::location_type *yylloc)
 {
-    return 0;
+  return 0;
 }
 
 void
-yy::parser::error(const yy::parser::location_type&, const std::string& m)
+yy::parser::error(const yy::parser::location_type&, const std::string&)
 {
-    return;
+  return;
 }
 END
 
 cat > foo.cc << 'END'
 #include "zardoz.hh"
 
-using namespace std;
-
 int
 main(int argc, char** argv)
 {