Merge remote-tracking branch 'origin/maint'

* origin/maint:
  tests: headers.at: strengthen.
  glr.cc: do not override C++ definitions by C macros.
  YYLLOC_DEFAULT: factor, and don't export it in headers.
  api.prefix: do not use #define to handle YYSTYPE_IS_TRIVIAL etc.
  tests: portability fixes.
  c++: fewer #includes in the headers.
  glr.cc: formatting changes.
  tests: more logs.
  api.prefix: also rename YYDEBUG.

Conflicts:
	data/c.m4
	data/glr.c
	data/glr.cc
	data/lalr1.cc
	data/yacc.c
This commit is contained in:
Akim Demaille
2012-07-04 17:14:35 +02:00
10 changed files with 208 additions and 192 deletions

17
NEWS
View File

@@ -213,10 +213,19 @@ GNU Bison NEWS
# define BAR_FOO_H # define BAR_FOO_H # define BAR_FOO_H # define BAR_FOO_H
/* Enabling traces. */ /* Enabling traces. */ /* Enabling traces. */ /* Enabling traces. */
# ifndef YYDEBUG # ifndef YYDEBUG # ifndef YYDEBUG | # ifndef BAR_DEBUG
# define YYDEBUG 0 # define YYDEBUG 0 > # if defined YYDEBUG
# endif # endif > # if YYDEBUG
# if YYDEBUG # if YYDEBUG > # define BAR_DEBUG 1
> # else
> # define BAR_DEBUG 0
> # endif
> # else
# define YYDEBUG 0 | # define BAR_DEBUG 0
> # endif
# endif | # endif
# if YYDEBUG | # if BAR_DEBUG
extern int bar_debug; extern int bar_debug; extern int bar_debug; extern int bar_debug;
# endif # endif # endif # endif

View File

@@ -428,3 +428,32 @@ m4_define([b4_cc_var_decls],
], [$@])]) ], [$@])])
m4_define([b4_cc_var_decl], m4_define([b4_cc_var_decl],
[ $1;]) [ $1;])
## ---------##
## Values. ##
## ---------##
# b4_yylloc_default_define
# ------------------------
# Define YYLLOC_DEFAULT.
m4_define([b4_yylloc_default_define],
[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
# ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) \
{ \
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
(Current).end = YYRHSLOC (Rhs, N).end; \
} \
else \
{ \
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
} \
while (/*CONSTCOND*/ false)
# endif
]])

View File

@@ -618,14 +618,61 @@ b4_pure_if([], [[extern ]b4_api_PREFIX[STYPE ]b4_prefix[lval;
]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl ]b4_locations_if([[extern ]b4_api_PREFIX[LTYPE ]b4_prefix[lloc;]])])[]dnl
]) ])
# b4_YYDEBUG_define
# ------------------
m4_define([b4_YYDEBUG_define],
[[/* Enabling traces. */
]m4_if(b4_api_prefix, [yy],
[[#ifndef YYDEBUG
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
#endif]],
[[#ifndef ]b4_api_PREFIX[DEBUG
# if defined YYDEBUG
#if YYDEBUG
# define ]b4_api_PREFIX[DEBUG 1
# else
# define ]b4_api_PREFIX[DEBUG 0
# endif
# else /* ! defined YYDEBUG */
# define ]b4_api_PREFIX[DEBUG ]b4_parse_trace_if([1], [0])[
# endif /* ! defined ]b4_api_PREFIX[DEBUG */
#endif /* ! defined ]b4_api_PREFIX[DEBUG */]])[]dnl
])
# b4_declare_yydebug # b4_declare_yydebug
# ------------------ # ------------------
m4_define([b4_declare_yydebug], m4_define([b4_declare_yydebug],
[[/* Enabling traces. */ [b4_YYDEBUG_define[
#ifndef YYDEBUG #if ]b4_api_PREFIX[DEBUG
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
#endif
#if YYDEBUG
extern int ]b4_prefix[debug; extern int ]b4_prefix[debug;
#endif][]dnl #endif][]dnl
]) ])
# b4_yylloc_default_define
# ------------------------
# Define YYLLOC_DEFAULT.
m4_define([b4_yylloc_default_define],
[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (YYID (N)) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
while (YYID (0))
#endif
]])

View File

@@ -18,7 +18,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
m4_include(b4_pkgdatadir/[c.m4]) # If we are loaded by glr.cc, do not override c++.m4 definitions by
# those of c.m4.
m4_if(b4_skeleton, ["glr.c"],
[m4_include(b4_pkgdatadir/[c.m4])])
## ---------------- ## ## ---------------- ##
## Default values. ## ## Default values. ##
@@ -198,12 +201,8 @@ b4_copyright([Skeleton implementation for Bison GLR parsers in C],
b4_percent_code_get([[top]])[ b4_percent_code_get([[top]])[
]m4_if(b4_api_prefix, [yy], [], ]m4_if(b4_api_prefix, [yy], [],
[[/* Substitute the type names. */ [[/* Substitute the type names. */
#define YYSTYPE ]b4_api_PREFIX[STYPE #define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
#define YYSTYPE_IS_TRIVIAL ]b4_api_PREFIX[STYPE_IS_TRIVIAL #define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
#define YYSTYPE_IS_DECLARED ]b4_api_PREFIX[STYPE_IS_DECLARED]b4_locations_if([[
#define YYLTYPE ]b4_api_PREFIX[LTYPE
#define YYLTYPE_IS_TRIVIAL ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
#define YYLTYPE_IS_DECLARED ]b4_api_PREFIX[LTYPE_IS_DECLARED]])])[
]m4_if(b4_prefix, [yy], [], ]m4_if(b4_prefix, [yy], [],
[[/* Substitute the variable and function names. */ [[/* Substitute the variable and function names. */
#define yyparse ]b4_prefix[parse #define yyparse ]b4_prefix[parse
@@ -357,7 +356,7 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
]b4_translate[ ]b4_translate[
}; };
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const ]b4_int_type_for([b4_rline])[ yyrline[] = static const ]b4_int_type_for([b4_rline])[ yyrline[] =
{ {
@@ -365,7 +364,7 @@ static const ]b4_int_type_for([b4_rline])[ yyrline[] =
}; };
#endif #endif
#if YYDEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[ #if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
@@ -420,30 +419,10 @@ dnl We probably ought to introduce a type for confl.
/* Error token number */ /* Error token number */
#define YYTERROR 1 #define YYTERROR 1
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
]b4_locations_if([[ ]b4_locations_if([[
#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
#ifndef YYLLOC_DEFAULT #ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \ ]b4_yylloc_default_define[
do \ # define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
if (YYID (N)) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
while (YYID (0))
/* YY_LOCATION_PRINT -- Print the location on the stream. /* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know This macro was not mandated originally: define only if we know
@@ -464,7 +443,6 @@ dnl We probably ought to introduce a type for confl.
# define YY_LOCATION_PRINT(File, Loc) ((void) 0) # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif #endif
/* YYLEX -- calling `yylex' with the right arguments. */ /* YYLEX -- calling `yylex' with the right arguments. */
#define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[ #define YYLEX ]b4_c_function_call([yylex], [int], b4_lex_param)[
@@ -501,7 +479,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
return yychk_flag; \ return yychk_flag; \
} while (YYID (0)) } while (YYID (0))
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
# ifndef YYFPRINTF # ifndef YYFPRINTF
# define YYFPRINTF fprintf # define YYFPRINTF fprintf
@@ -529,12 +507,12 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
multiple parsers can coexist. */ multiple parsers can coexist. */
int yydebug; int yydebug;
#else /* !YYDEBUG */ #else /* !]b4_api_PREFIX[DEBUG */
# define YYDPRINTF(Args) # define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
#endif /* !YYDEBUG */ #endif /* !]b4_api_PREFIX[DEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */ /* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH #ifndef YYINITDEPTH
@@ -767,7 +745,7 @@ yyMemoryExhausted (yyGLRStack* yystackp)
YYLONGJMP (yystackp->yyexception_buffer, 2); YYLONGJMP (yystackp->yyexception_buffer, 2);
} }
#if YYDEBUG || YYERROR_VERBOSE #if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE
/** A printable representation of TOKEN. */ /** A printable representation of TOKEN. */
static inline const char* static inline const char*
yytokenName (yySymbol yytoken) yytokenName (yySymbol yytoken)
@@ -790,7 +768,7 @@ yyfillin (yyGLRStackItem *yyvsp, int yylow0, int yylow1)
yyGLRState *s = yyvsp[yylow0].yystate.yypred; yyGLRState *s = yyvsp[yylow0].yystate.yypred;
for (i = yylow0-1; i >= yylow1; i -= 1) for (i = yylow0-1; i >= yylow1; i -= 1)
{ {
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
yyvsp[i].yystate.yylrState = s->yylrState; yyvsp[i].yystate.yylrState = s->yylrState;
#endif #endif
yyvsp[i].yystate.yyresolved = s->yyresolved; yyvsp[i].yystate.yyresolved = s->yyresolved;
@@ -911,7 +889,7 @@ yydestroyGLRState (char const *yymsg, yyGLRState *yys]b4_user_formals[)
&yys->yysemantics.yysval]b4_locuser_args([&yys->yyloc])[); &yys->yysemantics.yysval]b4_locuser_args([&yys->yyloc])[);
else else
{ {
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
if (yydebug) if (yydebug)
{ {
if (yys->yysemantics.yyfirstVal) if (yys->yysemantics.yyfirstVal)
@@ -1292,7 +1270,7 @@ yyglrShiftDefer (yyGLRStack* yystackp, size_t yyk, yyStateNum yylrState,
yyaddDeferredAction (yystackp, yyk, yynewState, yyrhs, yyrule); yyaddDeferredAction (yystackp, yyk, yynewState, yyrhs, yyrule);
} }
#if !YYDEBUG #if !]b4_api_PREFIX[DEBUG
# define YY_REDUCE_PRINT(Args) # define YY_REDUCE_PRINT(Args)
#else #else
# define YY_REDUCE_PRINT(Args) \ # define YY_REDUCE_PRINT(Args) \
@@ -1668,7 +1646,7 @@ yyresolveAction (yySemanticOption* yyopt, yyGLRStack* yystackp,
return yyflag; return yyflag;
} }
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
static void static void
yyreportTree (yySemanticOption* yyx, int yyindent) yyreportTree (yySemanticOption* yyx, int yyindent)
{ {
@@ -1723,7 +1701,7 @@ yyreportAmbiguity (yySemanticOption* yyx0,
YYUSE (yyx0); YYUSE (yyx0);
YYUSE (yyx1); YYUSE (yyx1);
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
YYFPRINTF (stderr, "Ambiguity detected.\n"); YYFPRINTF (stderr, "Ambiguity detected.\n");
YYFPRINTF (stderr, "Option 1,\n"); YYFPRINTF (stderr, "Option 1,\n");
yyreportTree (yyx0, 2); yyreportTree (yyx0, 2);
@@ -2310,7 +2288,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
yychar = YYEMPTY; yychar = YYEMPTY;
yylval = yyval_default; yylval = yyval_default;
]b4_locations_if([ ]b4_locations_if([
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL #if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[; yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[; yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;
#endif #endif
@@ -2542,7 +2520,7 @@ m4_popdef([b4_at_dollar])])dnl
} }
/* DEBUGGING ONLY */ /* DEBUGGING ONLY */
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
static void yypstack (yyGLRStack* yystackp, size_t yyk) static void yypstack (yyGLRStack* yystackp, size_t yyk)
__attribute__ ((__unused__)); __attribute__ ((__unused__));
static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__)); static void yypdumpstack (yyGLRStack* yystackp) __attribute__ ((__unused__));

View File

@@ -76,9 +76,9 @@ m4_define([b4_yy_symbol_print_generate],
[static void], [static void],
[[FILE *], []], [[FILE *], []],
[[int yytype], [yytype]], [[int yytype], [yytype]],
[[const b4_namespace_ref::b4_parser_class_name::semantic_type *yyvaluep], [[const ]b4_namespace_ref::b4_parser_class_name[::semantic_type *yyvaluep],
[yyvaluep]], [yyvaluep]],
[[const b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], [[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
[yylocationp]], [yylocationp]],
b4_parse_param)[ b4_parse_param)[
{ {
@@ -88,19 +88,22 @@ m4_define([b4_yy_symbol_print_generate],
]]) ]])
# Declare yyerror. # Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
# and declaration of yyerror.
m4_append([b4_post_prologue], m4_append([b4_post_prologue],
[b4_syncline([@oline@], [@ofile@]) [b4_syncline([@oline@], [@ofile@])[
]b4_yylloc_default_define[
b4_c_ansi_function_decl([yyerror], #define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
]b4_c_ansi_function_decl([yyerror],
[static void], [static void],
[[const b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], [[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
[yylocationp]], [yylocationp]],
b4_parse_param, b4_parse_param,
[[const char* msg], [msg]])]) [[const char* msg], [msg]])])
# Define yyerror. # Hijack the epilogue to define implementations (yyerror, parser member
# functions etc.).
m4_append([b4_epilogue], m4_append([b4_epilogue],
[b4_syncline([@oline@], [@ofile@])[ [b4_syncline([@oline@], [@ofile@])[
/*------------------. /*------------------.
@@ -109,7 +112,7 @@ m4_append([b4_epilogue],
]b4_c_ansi_function_def([yyerror], ]b4_c_ansi_function_def([yyerror],
[static void], [static void],
[[const b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], [[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
[yylocationp]], [yylocationp]],
b4_parse_param, b4_parse_param,
[[const char* msg], [msg]])[ [[const char* msg], [msg]])[
@@ -125,7 +128,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
[ /// Build a parser object. [ /// Build a parser object.
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [ ]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
:])[ :])[
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[ ]m4_ifset([b4_parse_param], [ ], [ :])[yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
#endif]b4_parse_param_cons[ #endif]b4_parse_param_cons[
{ {
@@ -141,7 +144,7 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
return ::yyparse (*this]b4_user_args[); return ::yyparse (*this]b4_user_args[);
} }
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
/*--------------------. /*--------------------.
| Print this symbol. | | Print this symbol. |
`--------------------*/ `--------------------*/
@@ -211,10 +214,10 @@ b4_namespace_close[
# Let glr.c believe that the user arguments include the parser itself. # Let glr.c believe that the user arguments include the parser itself.
m4_ifset([b4_parse_param], m4_ifset([b4_parse_param],
[m4_pushdef([b4_parse_param], [m4_pushdef([b4_parse_param],
m4_dquote([[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]],] [[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]],]
m4_defn([b4_parse_param])))], m4_defn([b4_parse_param]))],
[m4_pushdef([b4_parse_param], [m4_pushdef([b4_parse_param],
[[[[b4_namespace_ref::b4_parser_class_name& yyparser], [[yyparser]]]]]) [[b4_namespace_ref::b4_parser_class_name[& yyparser], [[yyparser]]]])
]) ])
m4_include(b4_pkgdatadir/[glr.c]) m4_include(b4_pkgdatadir/[glr.c])
m4_popdef([b4_parse_param]) m4_popdef([b4_parse_param])
@@ -236,29 +239,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
]b4_percent_define_ifdef([[location_type]], [], ]b4_percent_define_ifdef([[location_type]], [],
[[#include "location.hh"]])[ [[#include "location.hh"]])[
/* Enabling traces. */ ]b4_YYDEBUG_define[
#ifndef YYDEBUG
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
#endif
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) \
{ \
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
(Current).end = YYRHSLOC (Rhs, N).end; \
} \
else \
{ \
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
} \
while (/*CONSTCOND*/ 0)
#endif
]b4_namespace_open[ ]b4_namespace_open[
/// A Bison parser. /// A Bison parser.
@@ -293,7 +274,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in C++],
/// \param msg a description of the syntax error. /// \param msg a description of the syntax error.
virtual void error (const location_type& loc, const std::string& msg); virtual void error (const location_type& loc, const std::string& msg);
#if YYDEBUG # if ]b4_api_PREFIX[DEBUG
public: public:
/// \brief Report a symbol value on the debug stream. /// \brief Report a symbol value on the debug stream.
/// \param yytype The token type. /// \param yytype The token type.

View File

@@ -158,12 +158,7 @@ b4_copyright([Skeleton interface for Bison LALR(1) parsers in C++])
b4_variant_define b4_variant_define
b4_namespace_close])[ b4_namespace_close])[
]b4_null_define[ ]b4_YYDEBUG_define[
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG ]b4_parse_trace_if([1], [0])[
#endif
]b4_namespace_open[ ]b4_namespace_open[
@@ -180,7 +175,7 @@ b4_namespace_close])[
/// \returns 0 iff parsing succeeded. /// \returns 0 iff parsing succeeded.
virtual int parse (); virtual int parse ();
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
/// The current debugging stream. /// The current debugging stream.
std::ostream& debug_stream () const; std::ostream& debug_stream () const;
/// Set the current debugging stream. /// Set the current debugging stream.
@@ -235,10 +230,10 @@ b4_namespace_close])[
/// Convert the symbol name \a n to a form suitable for a diagnostic. /// Convert the symbol name \a n to a form suitable for a diagnostic.
static std::string yytnamerr_ (const char *n);])[ static std::string yytnamerr_ (const char *n);])[
]b4_token_table_if([], [[#if YYDEBUG]])[ ]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[
/// For a symbol, its name in clear. /// For a symbol, its name in clear.
static const char* const yytname_[]; static const char* const yytname_[];
]b4_token_table_if([[#if YYDEBUG]])[ ]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[
]b4_integral_parser_table_declare([rline], [b4_rline], ]b4_integral_parser_table_declare([rline], [b4_rline],
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[ [YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
/// Report on the debug stream that the rule \a r is going to be reduced. /// Report on the debug stream that the rule \a r is going to be reduced.
@@ -249,12 +244,12 @@ b4_namespace_close])[
// Debugging. // Debugging.
int yydebug_; int yydebug_;
std::ostream* yycdebug_; std::ostream* yycdebug_;
#endif // YYDEBUG #endif // ]b4_api_PREFIX[DEBUG
/// Convert a scanner token number \a t to a symbol number. /// Convert a scanner token number \a t to a symbol number.
static inline token_number_type yytranslate_ (]b4_lex_symbol_if([token_type], [int])[ t); static inline token_number_type yytranslate_ (]b4_lex_symbol_if([token_type], [int])[ t);
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
/// \brief Display a symbol type, value and location. /// \brief Display a symbol type, value and location.
/// \param yyo The output stream. /// \param yyo The output stream.
/// \param yysym The symbol. /// \param yysym The symbol.
@@ -361,10 +356,12 @@ m4_if(b4_prefix, [yy], [],
#include "@basename(]b4_spec_defines_file[@)" #include "@basename(]b4_spec_defines_file[@)"
/* User implementation prologue. */ /* User implementation prologue. */
]b4_user_post_prologue ]b4_user_post_prologue[
b4_percent_code_get[]dnl ]b4_percent_code_get[
[#ifndef YY_ ]b4_null_define[
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS # if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS # if ENABLE_NLS
# include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */ # include <libintl.h> /* FIXME: INFRINGES ON USER NAME SPACE */
@@ -377,31 +374,14 @@ b4_percent_code_get[]dnl
#endif #endif
]b4_locations_if([dnl ]b4_locations_if([dnl
[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. [#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
If N is 0, then set CURRENT to the empty location which ends ]b4_yylloc_default_define])[
the previous symbol: RHS[0] (always defined). */
#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) \
{ \
(Current).begin = YYRHSLOC (Rhs, 1).begin; \
(Current).end = YYRHSLOC (Rhs, N).end; \
} \
else \
{ \
(Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end; \
} \
while (false)
#endif]])[
/* Suppress unused-variable warnings by "using" E. */ /* Suppress unused-variable warnings by "using" E. */
#define YYUSE(e) ((void) (e)) #define YYUSE(e) ((void) (e))
/* Enable debugging if requested. */ /* Enable debugging if requested. */
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
/* A pseudo ostream that takes yydebug_ into account. */ /* A pseudo ostream that takes yydebug_ into account. */
# define YYCDEBUG if (yydebug_) (*yycdebug_) # define YYCDEBUG if (yydebug_) (*yycdebug_)
@@ -428,14 +408,14 @@ b4_percent_code_get[]dnl
yystack_print_ (); \ yystack_print_ (); \
} while (false) } while (false)
#else /* !YYDEBUG */ #else /* !]b4_api_PREFIX[DEBUG */
# define YYCDEBUG if (false) std::cerr # define YYCDEBUG if (false) std::cerr
# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol) # define YY_SYMBOL_PRINT(Title, Symbol) YYUSE(Symbol)
# define YY_REDUCE_PRINT(Rule) static_cast<void>(0) # define YY_REDUCE_PRINT(Rule) static_cast<void>(0)
# define YY_STACK_PRINT() static_cast<void>(0) # define YY_STACK_PRINT() static_cast<void>(0)
#endif /* !YYDEBUG */ #endif /* !]b4_api_PREFIX[DEBUG */
#define yyerrok (yyerrstatus_ = 0) #define yyerrok (yyerrstatus_ = 0)
#define yyclearin (yyempty = true) #define yyclearin (yyempty = true)
@@ -488,7 +468,7 @@ b4_percent_code_get[]dnl
/// Build a parser object. /// Build a parser object.
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [ ]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)]m4_ifset([b4_parse_param], [
:])[ :])[
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false), ]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[ yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
#endif]b4_parse_param_cons[ #endif]b4_parse_param_cons[
@@ -550,7 +530,7 @@ b4_percent_code_get[]dnl
b4_symbol_variant([[yytype]], [[yysym.value]], [[template destroy]])])[ b4_symbol_variant([[yytype]], [[yysym.value]], [[template destroy]])])[
} }
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
template <typename Exact> template <typename Exact>
void void
]b4_parser_class_name[::yy_print_ (std::ostream& yyo, ]b4_parser_class_name[::yy_print_ (std::ostream& yyo,
@@ -612,7 +592,7 @@ b4_percent_code_get[]dnl
yystack_.pop (n); yystack_.pop (n);
} }
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
std::ostream& std::ostream&
]b4_parser_class_name[::debug_stream () const ]b4_parser_class_name[::debug_stream () const
{ {
@@ -637,7 +617,7 @@ b4_percent_code_get[]dnl
{ {
yydebug_ = l; yydebug_ = l;
} }
#endif // YYDEBUG #endif // ]b4_api_PREFIX[DEBUG
inline ]b4_parser_class_name[::state_type inline ]b4_parser_class_name[::state_type
]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yylhs) ]b4_parser_class_name[::yy_lr_goto_state_ (state_type yystate, int yylhs)
@@ -1082,7 +1062,7 @@ b4_error_verbose_if([state_type yystate, int yytoken],
]b4_parser_tables_define[ ]b4_parser_tables_define[
]b4_token_table_if([], [[#if YYDEBUG]])[ ]b4_token_table_if([], [[#if ]b4_api_PREFIX[DEBUG]])[
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at \a yyntokens_, nonterminals. */ First, the terminals, then, starting at \a yyntokens_, nonterminals. */
const char* const char*
@@ -1091,7 +1071,7 @@ b4_error_verbose_if([state_type yystate, int yytoken],
]b4_tname[ ]b4_tname[
}; };
]b4_token_table_if([[#if YYDEBUG]])[ ]b4_token_table_if([[#if ]b4_api_PREFIX[DEBUG]])[
]b4_integral_parser_table_define([rline], [b4_rline])[ ]b4_integral_parser_table_define([rline], [b4_rline])[
// Print the state stack on the debug stream. // Print the state stack on the debug stream.
@@ -1121,7 +1101,7 @@ b4_error_verbose_if([state_type yystate, int yytoken],
YY_SYMBOL_PRINT (" $" << yyi + 1 << " =", YY_SYMBOL_PRINT (" $" << yyi + 1 << " =",
]b4_rhs_data(yynrhs, yyi + 1)[); ]b4_rhs_data(yynrhs, yyi + 1)[);
} }
#endif // YYDEBUG #endif // ]b4_api_PREFIX[DEBUG
]b4_lex_symbol_if([], [b4_yytranslate_define])[ ]b4_lex_symbol_if([], [b4_yytranslate_define])[
]b4_namespace_close[ ]b4_namespace_close[

View File

@@ -31,9 +31,9 @@ b4_copyright([Positions for Bison parsers in C++])[
]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[ ]b4_cpp_guard_open([b4_dir_prefix[]position.hh])[
# include <iostream> # include <algorithm> // std::max
# include <iosfwd>
# include <string> # include <string>
# include <algorithm>
]b4_null_define[ ]b4_null_define[

View File

@@ -310,12 +310,8 @@ b4_copyright([Bison implementation for Yacc-like parsers in C])[
b4_percent_code_get([[top]])[]dnl b4_percent_code_get([[top]])[]dnl
m4_if(b4_api_prefix, [yy], [], m4_if(b4_api_prefix, [yy], [],
[[/* Substitute the type names. */ [[/* Substitute the type names. */
#define YYSTYPE ]b4_api_PREFIX[STYPE #define YYSTYPE ]b4_api_PREFIX[STYPE]b4_locations_if([[
#define YYSTYPE_IS_TRIVIAL ]b4_api_PREFIX[STYPE_IS_TRIVIAL #define YYLTYPE ]b4_api_PREFIX[LTYPE]])])[
#define YYSTYPE_IS_DECLARED ]b4_api_PREFIX[STYPE_IS_DECLARED]b4_locations_if([[
#define YYLTYPE ]b4_api_PREFIX[LTYPE
#define YYLTYPE_IS_TRIVIAL ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
#define YYLTYPE_IS_DECLARED ]b4_api_PREFIX[LTYPE_IS_DECLARED]])])[
]m4_if(b4_prefix, [yy], [], ]m4_if(b4_prefix, [yy], [],
[[/* Substitute the variable and function names. */]b4_pull_if([[ [[/* Substitute the variable and function names. */]b4_pull_if([[
#define yyparse ]b4_prefix[parse]])b4_push_if([[ #define yyparse ]b4_prefix[parse]])b4_push_if([[
@@ -499,8 +495,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \ #if (! defined yyoverflow \
&& (! defined __cplusplus \ && (! defined __cplusplus \
|| (]b4_locations_if([[defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ || (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
&& ]])[defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) && ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */ /* A type that is properly aligned for any stack member. */
union yyalloc union yyalloc
@@ -592,12 +588,12 @@ static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
]b4_translate[ ]b4_translate[
}; };
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
]b4_integral_parser_table_define([rline], [b4_rline], ]b4_integral_parser_table_define([rline], [b4_rline],
[YYRLINE[YYN] -- Source line where rule number YYN was defined.])[ [YYRLINE[YYN] -- Source line where rule number YYN was defined.])[
#endif #endif
#if YYDEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[ #if ]b4_api_PREFIX[DEBUG || YYERROR_VERBOSE || ]b4_token_table_flag[
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] = static const char *const yytname[] =
@@ -676,39 +672,16 @@ while (YYID (0))
#define YYTERROR 1 #define YYTERROR 1
#define YYERRCODE 256 #define YYERRCODE 256
]b4_locations_if([[
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. ]b4_yylloc_default_define[
If N is 0, then set CURRENT to the empty location which ends
the previous symbol: RHS[0] (always defined). */
#define YYRHSLOC(Rhs, K) ((Rhs)[K]) #define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (YYID (N)) \
{ \
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
} \
else \
{ \
(Current).first_line = (Current).last_line = \
YYRHSLOC (Rhs, 0).last_line; \
(Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \
} \
while (YYID (0))
#endif]b4_locations_if([[
/* YY_LOCATION_PRINT -- Print the location on the stream. /* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know This macro was not mandated originally: define only if we know
we won't break user code: when these are the locations we know. */ we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT #ifndef YY_LOCATION_PRINT
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \ # define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \ fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \ (Loc).first_line, (Loc).first_column, \
@@ -735,7 +708,7 @@ while (YYID (0))
#endif #endif
/* Enable debugging if requested. */ /* Enable debugging if requested. */
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
# ifndef YYFPRINTF # ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
@@ -824,12 +797,12 @@ do { \
/* Nonzero means print parse trace. It is left uninitialized so that /* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */ multiple parsers can coexist. */
int yydebug; int yydebug;
#else /* !YYDEBUG */ #else /* !]b4_api_PREFIX[DEBUG */
# define YYDPRINTF(Args) # define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top) # define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule) # define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */ #endif /* !]b4_api_PREFIX[DEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */ /* YYINITDEPTH -- initial size of the parser's stacks. */
@@ -860,7 +833,7 @@ int yydebug;
required. Return 1 if memory is exhausted. */ required. Return 1 if memory is exhausted. */
static int static int
yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd, yy_lac_stack_realloc (YYSIZE_T *yycapacity, YYSIZE_T yyadd,
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
char const *yydebug_prefix, char const *yydebug_prefix,
char const *yydebug_suffix, char const *yydebug_suffix,
#endif #endif
@@ -966,7 +939,7 @@ do { \
the parser stacks to try to find a new initial context in which the the parser stacks to try to find a new initial context in which the
current lookahead is syntactically acceptable. If it fails to find current lookahead is syntactically acceptable. If it fails to find
such a context, it discards the lookahead. */ such a context, it discards the lookahead. */
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
# define YY_LAC_DISCARD(Event) \ # define YY_LAC_DISCARD(Event) \
do { \ do { \
if (yy_lac_established) \ if (yy_lac_established) \
@@ -1069,7 +1042,7 @@ yy_lac (yytype_int16 *yyesa, yytype_int16 **yyes,
else else
{ {
if (yy_lac_stack_realloc (yyes_capacity, 1, if (yy_lac_stack_realloc (yyes_capacity, 1,
#if YYDEBUG #if ]b4_api_PREFIX[DEBUG
" (", ")", " (", ")",
#endif #endif
yyes, yyesa, &yyesp, yyes_prev)) yyes, yyesa, &yyesp, yyes_prev))
@@ -1276,7 +1249,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yysize = yysize1; yysize = yysize1;
} }
}]b4_lac_if([[ }]b4_lac_if([[
# if YYDEBUG # if ]b4_api_PREFIX[DEBUG
else if (yydebug) else if (yydebug)
YYFPRINTF (stderr, "No expected tokens.\n"); YYFPRINTF (stderr, "No expected tokens.\n");
# endif]])[ # endif]])[
@@ -1519,7 +1492,7 @@ b4_c_function_def([[yyparse]], [[int]], b4_parse_param)[
yyvsp = yyvs;]b4_locations_if([[ yyvsp = yyvs;]b4_locations_if([[
yylsp = yyls; yylsp = yyls;
#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL #if defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */ /* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[; yylloc.first_line = yylloc.last_line = ]b4_location_initial_line[;
yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[; yylloc.first_column = yylloc.last_column = ]b4_location_initial_column[;

View File

@@ -75,8 +75,9 @@ CONF_JAVA='@CONF_JAVA@'
# Empty if no xsltproc was found # Empty if no xsltproc was found
: ${XSLTPROC='@XSLTPROC@'} : ${XSLTPROC='@XSLTPROC@'}
# We need egrep. # We need egrep and perl.
: ${EGREP='@EGREP@'} : ${EGREP='@EGREP@'}
: ${PERL='@PERL@'}
# Use simple quotes (lib/quote.c). # Use simple quotes (lib/quote.c).
LC_CTYPE=C LC_CTYPE=C

View File

@@ -130,7 +130,7 @@ AT_SETUP([Several parsers])
# the header (but YYDEBUG and YYPARSE_PARAM). # the header (but YYDEBUG and YYPARSE_PARAM).
m4_define([AT_DATA_GRAMMAR_SEVERAL], m4_define([AT_DATA_GRAMMAR_SEVERAL],
[AT_BISON_OPTION_PUSHDEFS([%define api.prefix "$1_" $2]) [AT_BISON_OPTION_PUSHDEFS([%define api.prefix "$1_" $2])
AT_DATA_GRAMMAR([AT_SKEL_CC_IF([$1.yy], [$1.y])], AT_DATA_GRAMMAR([$1.AT_SKEL_CC_IF([yy], [y])],
[[%define api.prefix "$1_" [[%define api.prefix "$1_"
$2 $2
%union %union
@@ -160,13 +160,22 @@ exp:
AT_BISON_CHECK([-d -o AT_SKEL_CC_IF([$1.cc $1.yy], [$1.c $1.y])]) AT_BISON_CHECK([-d -o AT_SKEL_CC_IF([$1.cc $1.yy], [$1.c $1.y])])
# C++ output relies on namespaces and still uses yy a lot. # C++ output relies on namespaces and still uses yy a lot.
AT_SKEL_CC_IF([], AT_SKEL_CC_IF([],
[AT_CHECK([$EGREP -i yy $1.h | $EGREP -v 'YY(DEBUG|PARSE_PARAM)'], [1])]) [AT_CHECK([$EGREP yy $1.h], [1])])
# Ignore comments. Ignore YYPARSE_PARAM. YYDEBUG (not renamed) can be
# read, but not changed.
AT_CHECK([[$PERL -0777 -e 's{/\*.*?\*/}{}sg;s,//.*,,;' \
]$1.AT_SKEL_CC_IF([hh], [h])[ |
grep 'YY' |
$EGREP -wv '(YYPARSE_PARAM|defined YYDEBUG|if YYDEBUG)']],
[1])
AT_LANG_COMPILE([$1.o]) AT_LANG_COMPILE([$1.o])
AT_BISON_OPTION_POPDEFS AT_BISON_OPTION_POPDEFS
]) ])
AT_DATA([main.cc], AT_DATA([main.cc],
[[extern "C" [AT_DATA_SOURCE_PROLOGUE
[extern "C"
{ {
#include "x1.h" #include "x1.h"
#include "x2.h" #include "x2.h"
@@ -175,18 +184,21 @@ AT_DATA([main.cc],
} }
#include "x5.hh" #include "x5.hh"
//#include "x6.hh" //#include "x6.hh"
#define ECHO(S) std::cerr << #S": " << S << std::endl;
int int
main (void) main (void)
{ {
int errs = 0; ECHO(x1_parse());
errs += x1_parse(); ECHO(x2_parse());
errs += x2_parse(); ECHO(x3_parse());
errs += x3_parse(); ECHO(x4_parse());
errs += x4_parse();
x5_::parser p5; x5_::parser p5;
errs += p5.parse(); ECHO(p5.parse());
// errs += x6_parse(); // x6_::parser p6;
return !!errs; // ECHO(p6.parse());
return 0;
} }
]]) ]])
@@ -195,7 +207,7 @@ AT_DATA_GRAMMAR_SEVERAL([x2], [%locations %debug])
AT_DATA_GRAMMAR_SEVERAL([x3], [%glr-parser]) AT_DATA_GRAMMAR_SEVERAL([x3], [%glr-parser])
AT_DATA_GRAMMAR_SEVERAL([x4], [%locations %debug %glr-parser]) AT_DATA_GRAMMAR_SEVERAL([x4], [%locations %debug %glr-parser])
AT_DATA_GRAMMAR_SEVERAL([x5], [%locations %debug %language "c++"]) AT_DATA_GRAMMAR_SEVERAL([x5], [%locations %debug %language "c++"])
#AT_DATA_GRAMMAR_SEVERAL([x6], [%locations %language "c++"]) #AT_DATA_GRAMMAR_SEVERAL([x5], [%locations %language "c++" %glr-parser])
AT_COMPILE_CXX([parser], [x1.o x2.o x3.o x4.o x5.o main.cc]) AT_COMPILE_CXX([parser], [x1.o x2.o x3.o x4.o x5.o main.cc])
AT_CHECK([./parser], [0], AT_CHECK([./parser], [0],
@@ -204,6 +216,12 @@ x2
x3 x3
x4 x4
x5 x5
]],
[[x1_parse(): 0
x2_parse(): 0
x3_parse(): 0
x4_parse(): 0
p5.parse(): 0
]]) ]])
AT_CLEANUP AT_CLEANUP