# 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
}
]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;
])[
]$4
AT_SKEL_CC_IF(
[%define global_tokens_and_yystype])[
-%code requires {
+%code requires
+{
/* Exercise pre-prologue dependency to %union. */
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
#define last_column end.column]])[
}
-%code {
+%code
+{
#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
]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]))
{
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)
}
+/* A C main function. */
int
main (int argc, const char **argv)
{
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])
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}])