[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02-popped-symbols.patch
From: |
Akim Demaille |
Subject: |
02-popped-symbols.patch |
Date: |
Sun, 26 May 2002 20:37:46 +0200 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* tests/calc.at (AT_CHECK_CALC): Adjust: there are now additional
`Error:' lines.
* data/bison.simple (yystos) [YYDEBUG]: New.
(yyparse) [YYDEBUG]: Display the symbols which are popped during
error recovery.
* tests/regression.at (Web2c Actions): Adjust: yystos is output now.
Index: NEWS
--- NEWS Sat, 25 May 2002 19:19:52 +0200 akim
+++ NEWS Sun, 26 May 2002 20:26:19 +0200 akim
@@ -26,6 +26,9 @@
and has long been required by POSIX. For more details, please see
<http://mail.gnu.org/pipermail/bug-bison/2002-May/001452.html>.
+* Traces
+ Popped tokens and nonterminals are now reported.
+
* Large grammars
Large grammars are now supported (large token numbers, large grammar
size (= sum of the LHS and RHS lengths), large LALR tables).
Index: data/bison.simple
--- data/bison.simple Sat, 25 May 2002 19:19:52 +0200 akim
+++ data/bison.simple Sun, 26 May 2002 20:15:40 +0200 akim
@@ -362,7 +362,7 @@ m4_define([b4_token_defines],
};
#endif
-#if (YYDEBUG) || YYERROR_VERBOSE
+#if YYDEBUG || YYERROR_VERBOSE
/* YYTNME[[SYMBOL-NUM]] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[[]] =
@@ -389,9 +389,9 @@ m4_define([b4_token_defines],
b4_r2
};
-/* YYDEFACT[[S]] -- default rule to reduce with in state S when YYTABLE
- doesn't specify something else to do. Zero means the default is an
- error. */
+/* YYDEFACT[[STATE-NAME]] -- Default rule to reduce with in state
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
static const short yydefact[[]] =
{
b4_defact
@@ -429,6 +429,14 @@ m4_define([b4_token_defines],
b4_check
};
+#if YYDEBUG
+/* YYSTOS[[STATE-NUM]] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const b4_uint_type(b4_stos_max) yystos[[]] =
+{
+ b4_stos
+};
+#endif
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
@@ -1137,6 +1145,27 @@ yyerrlab1:
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
YYABORT;
+
+#if YYDEBUG
+ if (yydebug)
+ {
+ if (yystos[yystate] < YYNTOKENS)
+ {
+ YYFPRINTF (stderr, "Error: popping token %d (%s",
+ yytoknum[yystos[yystate]], yytname[yystos[yystate]]);
+# ifdef YYPRINT
+ YYPRINT (stderr, yytoknum[yystos[yystate]], *yyvsp);
+# endif
+ YYFPRINTF (stderr, ")\n");
+ }
+ else
+ {
+ YYFPRINTF (stderr, "Error: popping nonterminal (%s)\n",
+ yytname[yystos[yystate]]);
+ }
+ }
+#endif
+
yyvsp--;
yystate = *--yyssp;
#if YYLSP_NEEDED
Index: tests/calc.at
--- tests/calc.at Wed, 01 May 2002 11:49:53 +0200 akim
+++ tests/calc.at Sun, 26 May 2002 20:24:13 +0200 akim
@@ -1,5 +1,5 @@
# Checking the output filenames. -*- Autotest -*-
-# Copyright 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2002 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
@@ -406,18 +406,18 @@ m4_define([AT_CHECK_CALC],
(2^2)^3 = 64], [486])
# Some parse errors.
-_AT_CHECK_CALC_ERROR([$1], [0 0], [10],
+_AT_CHECK_CALC_ERROR([$1], [0 0], [11],
[1.3-1.4: parse error, unexpected "number"])
-_AT_CHECK_CALC_ERROR([$1], [1//2], [13],
+_AT_CHECK_CALC_ERROR([$1], [1//2], [15],
[1.3-1.4: parse error, unexpected '/', expecting "number"
or '-' or '('])
_AT_CHECK_CALC_ERROR([$1], [error], [4],
[1.1-1.2: parse error, unexpected $undefined., expecting
"number" or '-' or '\n' or '('])
-_AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3], [19],
+_AT_CHECK_CALC_ERROR([$1], [1 = 2 = 3], [22],
[1.7-1.8: parse error, unexpected '='])
_AT_CHECK_CALC_ERROR([$1],
[
+1],
- [13],
+ [14],
[2.1-2.2: parse error, unexpected '+'])
# Exercise error messages with EOF: work on an empty file.
_AT_CHECK_CALC_ERROR([$1],
@@ -430,7 +430,7 @@ m4_define([AT_CHECK_CALC],
# associated to `error'.
_AT_CHECK_CALC_ERROR([$1],
[(1 ++ 2) + (0 0) = 1],
- [76],
+ [82],
[1.5-1.6: parse error, unexpected '+', expecting "number" or '-' or '('
1.15-1.16: parse error, unexpected "number"
calc: error: 0 != 1])
Index: tests/regression.at
--- tests/regression.at Sat, 25 May 2002 19:19:52 +0200 akim
+++ tests/regression.at Sun, 26 May 2002 20:20:55 +0200 akim
@@ -1,5 +1,5 @@
# Bison Regressions. -*- Autotest -*-
-# Copyright 2001, 2002 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002 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
@@ -548,6 +548,11 @@ else: "else" statement;
static const short yycheck[] =
{
7, 3, 9, 4, 0, -1, 6, 5
+};
+static const unsigned char yystos[] =
+{
+ 0, 3, 8, 9, 10, 4, 0, 6, 11, 5,
+ 8, 8
};
]])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- 02-popped-symbols.patch,
Akim Demaille <=