# Found in GCJ: they expect the tokens to be defined before the user
# prologue, so that they can use the token definitions in it.
# Found in GCJ: they expect the tokens to be defined before the user
# prologue, so that they can use the token definitions in it.
# Found in GCJ: they expect the tokens to be defined before the user
# prologue, so that they can use the token definitions in it.
# Found in GCJ: they expect the tokens to be defined before the user
# prologue, so that they can use the token definitions in it.
AT_DATA([input.y],
[[/* 'Bison -v' used to dump core when two tokens are defined with the same
string, as LE and GE below. */
AT_DATA([input.y],
[[/* 'Bison -v' used to dump core when two tokens are defined with the same
string, as LE and GE below. */
AT_BISON_CHECK([-v -o input.c input.y], 0, [],
AT_BISON_CHECK([-v -o input.c input.y], 0, [],
# Bison managed, when fed with '%token 'f' "f"' to #define 'f'!
AT_DATA_GRAMMAR([input.y],
[%{
#include <stdlib.h>
#include <stdio.h>
# Bison managed, when fed with '%token 'f' "f"' to #define 'f'!
AT_DATA_GRAMMAR([input.y],
[%{
#include <stdlib.h>
#include <stdio.h>
# Checking the warning message guarantees that the trigraph "??!" isn't
# unnecessarily escaped here even though it would need to be if encoded in a
# C-string literal. Also notice that unnecessary escaping, such as "\?", from
# the user specification is eliminated.
AT_BISON_CHECK([-o input.c input.y], [[0]], [[]],
# Checking the warning message guarantees that the trigraph "??!" isn't
# unnecessarily escaped here even though it would need to be if encoded in a
# C-string literal. Also notice that unnecessary escaping, such as "\?", from
# the user specification is eliminated.
AT_BISON_CHECK([-o input.c input.y], [[0]], [[]],
-[[input.y:22.8-14: warning: symbol SPECIAL redeclared
-input.y:22.8-63: warning: symbol '"\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!"' used more than once as a literal string
+[[input.y:22.8-14: warning: symbol SPECIAL redeclared [-Wother]
+input.y:22.8-63: warning: symbol "\\'?\"\a\b\f\n\r\t\v\001\201\001\201??!" used more than once as a literal string [-Wother]
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6
};
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6
};
-static const yytype_uint8 yyprhs[] =
-{
- 0, 0, 3, 5, 6, 9, 14
-};
-static const yytype_int8 yyrhs[] =
-{
- 8, 0, -1, 9, -1, -1, 10, 11, -1, 3,
- 4, 5, 8, -1, 6, 8, -1
-};
static const char *const yytname[] =
{
"$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
static const char *const yytname[] =
{
"$end", "error", "$undefined", "\"if\"", "\"const\"", "\"then\"",
- "\"else\"", "$accept", "statement", "struct_stat", "if", "else", 0
+ "\"else\"", "$accept", "statement", "struct_stat", "if", "else", YY_NULL
};
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261
};
};
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261
};
+ -2, -1, 4, -8, 0, 2, -8, -2, -8, -2,
+ -8, -8
};
static const yytype_uint8 yydefact[] =
{
3, 0, 0, 2, 0, 0, 1, 3, 4, 3,
6, 5
};
};
static const yytype_uint8 yydefact[] =
{
3, 0, 0, 2, 0, 0, 1, 3, 4, 3,
6, 5
};
-static const yytype_int8 yydefgoto[] =
-{
- -1, 2, 3, 4, 8
-};
-static const yytype_int8 yypact[] =
-{
- -2, -1, 4, -8, 0, 2, -8, -2, -8, -2,
- -8, -8
-};
0, 3, 8, 9, 10, 4, 0, 6, 11, 5,
8, 8
};
0, 3, 8, 9, 10, 4, 0, 6, 11, 5,
8, 8
};
# so that possible bound checking compilers could check all the skeletons.
m4_define([_AT_DATA_DANCER_Y],
[AT_DATA_GRAMMAR([dancer.y],
# so that possible bound checking compilers could check all the skeletons.
m4_define([_AT_DATA_DANCER_Y],
[AT_DATA_GRAMMAR([dancer.y],
-AT_LALR1_CC_IF(
-[/* A C++ error reporting function. */
-void
-yy::parser::error (const location&, const std::string& m)
-{
- std::cerr << m << std::endl;
-}
-
-int
+]AT_YYERROR_DEFINE[
+]AT_YYLEX_DEFINE([":"])[
+]AT_LALR1_CC_IF(
+[int
-],
-[static void
-yyerror (const char *s)
-{
- fprintf (stderr, "%s\n", s);
-}])
-
-static int
-yylex (AT_LALR1_CC_IF([int *lval], [void]))
-[{
- static int const tokens[] =
- {
- ':', -1
- };
- static size_t toknum;
- ]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC. */])[
- if (! (toknum < sizeof tokens / sizeof *tokens))
- abort ();
- return tokens[toknum++];
-}]
[AT_DATA_GRAMMAR([expect2.y],
[%{
static int yylex (AT_LALR1_CC_IF([int *], [void]));
[AT_DATA_GRAMMAR([expect2.y],
[%{
static int yylex (AT_LALR1_CC_IF([int *], [void]));
# Generate the grammar, compile it, run it.
m4_define([AT_CHECK_EXPECT2],
[AT_SETUP([Expecting two tokens $1])
# Generate the grammar, compile it, run it.
m4_define([AT_CHECK_EXPECT2],
[AT_SETUP([Expecting two tokens $1])
# POSIX says token numbers can be declared in %left, %right, and %nonassoc, but
# we lost this in Bison 1.50.
# POSIX says token numbers can be declared in %left, %right, and %nonassoc, but
# we lost this in Bison 1.50.
-void
-yyerror (char const *msg)
-{
- fprintf (stderr, "%s\n", msg);
-}
-
-int
-yylex (void)
-{
- static int const input[] = { 1, 2, 3, 0 };
- static int const *inputp = input;
- return *inputp++;
-}
+]AT_YYERROR_DEFINE[
+]AT_YYLEX_DEFINE([{ 1, 2, 3, 0 }])[
AT_BISON_CHECK([[-o input.c input.y]], [[0]],,
AT_BISON_CHECK([[-o input.c input.y]], [[0]],,
-[[input.y:23.5-19: warning: rule useless in parser due to conflicts: start: start
-input.y:27.5-19: warning: rule useless in parser due to conflicts: sr_conflict: TK2 "tok alias"
+[[input.y:23.5-19: warning: rule useless in parser due to conflicts: start: start [-Wother]
+input.y:27.5-19: warning: rule useless in parser due to conflicts: sr_conflict: TK2 "tok alias" [-Wother]
-# Avoid differences in synclines by telling bison that the output files
-# have the same name.
+# Avoid tests/bison's dark magic by processing a local copy of the
+# grammar. Avoid differences in synclines by telling bison that the
+# output files have the same name.
-AT_CHECK([[cat ielr.c]], [[0]], [[expout]])
+AT_CAPTURE_FILE([ielr.c])
+AT_CHECK([[diff lalr.c ielr.c]], [[0]])
-## --------------------------------------- ##
-## %error-verbose and YYSTACK_USE_ALLOCA. ##
-## --------------------------------------- ##
+## -------------------------------------------- ##
+## parse.error=verbose and YYSTACK_USE_ALLOCA. ##
+## -------------------------------------------- ##
/* Induce two syntax error messages (which requires full error
recovery by shifting 3 tokens) in order to detect any loss of the
reallocated buffer. */
/* Induce two syntax error messages (which requires full error
recovery by shifting 3 tokens) in order to detect any loss of the
reallocated buffer. */
-## ------------------------- ##
-## %error-verbose overflow. ##
-## ------------------------- ##
+## ------------------------------ ##
+## parse.error=verbose overflow. ##
+## ------------------------------ ##
# Imagine the case where YYSTACK_ALLOC_MAXIMUM = YYSIZE_MAXIMUM and an
# invocation of yysyntax_error has caused yymsg_alloc to grow to exactly
# Imagine the case where YYSTACK_ALLOC_MAXIMUM = YYSIZE_MAXIMUM and an
# invocation of yysyntax_error has caused yymsg_alloc to grow to exactly
# size calculation would return YYSIZE_MAXIMUM to yyparse. Then,
# yyparse would invoke yyerror using the old contents of yymsg.
# size calculation would return YYSIZE_MAXIMUM to yyparse. Then,
# yyparse would invoke yyerror using the old contents of yymsg.
/* This prevents this test case from having to induce error messages
large enough to overflow size_t. */
/* This prevents this test case from having to induce error messages
large enough to overflow size_t. */
-
-void
-yyerror (char const *msg)
-{
- fprintf (stderr, "%s\n", msg);
-}
-
-int
-yylex (void)
-{
- static char const *input = "]$1[";
- return *input++;
-}
-
+]AT_YYERROR_DEFINE[
+]AT_YYLEX_DEFINE(["$1"])[
-AT_LAC_CHECK([[]])
-AT_PARSER_CHECK([[./input]], [[2]], [[]],
+AT_LAC_CHECK([])
+AT_PARSER_CHECK([[./input]], [[2]], [],
# Induce an immediate syntax error with an undefined token, and check
# for memory exhaustion while building syntax error message.
# Induce an immediate syntax error with an undefined token, and check
# for memory exhaustion while building syntax error message.
-AT_LAC_CHECK([[z]], [[0]])
-AT_PARSER_CHECK([[./input]], [[2]], [[]],
+AT_LAC_CHECK([z], [[0]])
+AT_PARSER_CHECK([[./input]], [[2]], [],