[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [both]: fix-token-decl.patch
From: |
Akim Demaille |
Subject: |
Re: [both]: fix-token-decl.patch |
Date: |
26 Nov 2001 10:50:35 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
| An idea to fix the problem.
|
| Index: ChangeLog
| ===================================================================
| RCS file: /cvsroot/bison/bison/ChangeLog,v
| retrieving revision 1.173.2.153
| diff -u -r1.173.2.153 ChangeLog
| --- ChangeLog 2001/11/23 14:55:36 1.173.2.153
| +++ ChangeLog 2001/11/24 18:21:54
| @@ -1,3 +1,8 @@
| +2001-11-24 Marc Autret <address@hidden>
| +
| + * src/lex.c (parse_percent_token): Fix.
| + Reported by Hans Aberg.
| +
| 2001-11-23 Akim Demaille <address@hidden>
|
| * lib/alloca.c: Update, from fileutils.
| Index: src/lex.c
| ===================================================================
| RCS file: /cvsroot/bison/bison/src/lex.c,v
| retrieving revision 1.33.2.12
| diff -u -r1.33.2.12 lex.c
| --- src/lex.c 2001/11/14 14:42:14 1.33.2.12
| +++ src/lex.c 2001/11/24 18:22:37
| @@ -589,7 +589,7 @@
| /* Where the ARG was found in token_buffer. */
| size_t arg_offset = 0;
|
| - int c = getc (finput);
| + int c = skip_white_space ();
|
| switch (c)
| {
Thanks for the proposal, but the right fix is the following, which I'm
applying now.
Index: ChangeLog
from Akim Demaille <address@hidden>
* src/reader.c (read_declarations): Don't abort on tok_illegal,
issue an error message.
* tests/regression.at (Invalid %directive): New.
Reported by Hans Aberg.
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.72.2.19
diff -u -u -r1.72.2.19 reader.c
--- src/reader.c 2001/11/23 14:04:08 1.72.2.19
+++ src/reader.c 2001/11/26 09:49:11
@@ -1018,10 +1018,10 @@
case tok_stropt:
case tok_intopt:
case tok_obsolete:
- case tok_illegal:
abort ();
break;
+ case tok_illegal:
default:
complain (_("unrecognized: %s"), token_buffer);
skip_to_char ('%');
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.1.2.16
diff -u -u -r1.1.2.16 regression.at
--- tests/regression.at 2001/11/26 09:18:40 1.1.2.16
+++ tests/regression.at 2001/11/26 09:49:11
@@ -380,9 +380,9 @@
]])
AT_CHECK([bison input.y], [1], [],
-[input.y:2: invalid input: `?'
+[[input.y:2: invalid input: `?'
input.y:3: fatal error: no rules in the input grammar
-])
+]])
AT_CLEANUP
@@ -400,8 +400,29 @@
]])
AT_CHECK([bison input.y], [1], [],
-[input.y:2: invalid input: `}'
-])
+[[input.y:2: invalid input: `}'
+]])
+
+AT_CLEANUP
+
+
+
+## -------------------- ##
+## Invalid %directive. ##
+## -------------------- ##
+
+
+AT_SETUP([Invalid %directive])
+
+AT_DATA([input.y],
+[[%invalid
+]])
+
+AT_CHECK([bison input.y], [1], [],
+[[input.y:1: unrecognized: %invalid
+input.y:1: Skipping to next %
+input.y:2: fatal error: no input grammar
+]])
AT_CLEANUP