]> git.saurik.com Git - bison.git/blobdiff - tests/calc.at
tests: don't depend on the actual location type.
[bison.git] / tests / calc.at
index 5f11858080e0a6a97c25b275b38396a151a23eb7..aa1d5e3c5f1793d7164eefef9415953537ecf2a2 100644 (file)
@@ -1,7 +1,6 @@
 # Simple calculator.                         -*- Autotest -*-
 
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
-# Software Foundation, Inc.
+# Copyright (C) 2000-2010 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -124,7 +123,7 @@ int
     }
 
 ]AT_LOCATION_IF([
- AT_LOC.first_column = AT_LOC.last_column;
 AT_LOC.first_column = AT_LOC.last_column;
   AT_LOC.first_line   = AT_LOC.last_line;
 ])[
 
@@ -159,7 +158,8 @@ AT_DATA_GRAMMAR([calc.y],
 ]$4
 AT_SKEL_CC_IF(
 [%define global_tokens_and_yystype])[
-%code requires {
+%code requires
+{
 /* Exercise pre-prologue dependency to %union.  */
 typedef int semantic_value;
 }
@@ -170,12 +170,13 @@ typedef int semantic_value;
   semantic_value ival;
 };
 
-%code provides {
+%code provides
+{
 #include <stdio.h>
 /* The input.  */
 extern FILE *input;]AT_SKEL_CC_IF([[
 #ifndef YYLTYPE
-# define YYLTYPE ]AT_NAME_PREFIX[::location
+# define YYLTYPE ]AT_NAME_PREFIX[::parser::location_type
 #endif
 #define first_line   begin.line
 #define first_column begin.column
@@ -183,7 +184,8 @@ extern FILE *input;]AT_SKEL_CC_IF([[
 #define last_column  end.column]])[
 }
 
-%code {
+%code
+{
 #include <stdlib.h>
 #include <string.h>
 #if HAVE_UNISTD_H
@@ -267,12 +269,13 @@ exp:
 ]AT_SKEL_CC_IF(
 [/* A C++ error reporting function.  */
 void
-AT_NAME_PREFIX::parser::error (const location& l, const std::string& m)
+AT_NAME_PREFIX::parser::error (const location_type& l, const std::string& m)
 {
   (void) l;
   std::cerr << AT_LOCATION_IF([l << ": " << ])m << std::endl;
 }
 
+/* A C++ yyparse that simulates the C signature.  */
 int
 yyparse (AT_PARAM_IF([semantic_value *result, int *count]))
 {
@@ -283,7 +286,8 @@ yyparse (AT_PARAM_IF([semantic_value *result, int *count]))
   return parser.parse ();
 }
 ],
-[static void
+[/* A C error reporting function.  */
+static void
 yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ])
          AT_PARAM_IF([semantic_value *result, int *count, ])
          const char *s)
@@ -316,6 +320,7 @@ power (int base, int exponent)
 }
 
 
+/* A C main function.  */
 int
 main (int argc, const char **argv)
 {
@@ -576,7 +581,7 @@ AT_CHECK_CALC_LALR([%yacc])
 AT_CHECK_CALC_LALR([%error-verbose])
 
 AT_CHECK_CALC_LALR([%define api.pure %locations])
-AT_CHECK_CALC_LALR([%define api.push_pull "both" %define api.pure %locations])
+AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %locations])
 AT_CHECK_CALC_LALR([%error-verbose %locations])
 
 AT_CHECK_CALC_LALR([%error-verbose %locations %defines %name-prefix "calc" %verbose %yacc])
@@ -585,7 +590,7 @@ AT_CHECK_CALC_LALR([%debug])
 AT_CHECK_CALC_LALR([%error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
 
 AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_LALR([%define api.push_pull "both" %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
 
 AT_CHECK_CALC_LALR([%define api.pure %error-verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])