[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bugs
From: |
Akim Demaille |
Subject: |
Re: bugs |
Date: |
02 Oct 2001 18:04:19 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence) |
| Bug 2:
| System message:
| Unhandled exception: Access Violation.
| Grammar Files:
| err.y
| My corrects:
| reader.c:1592
| -complain (_("invalid input: %s"), quote
| (token_buffer));
| +complain (_("invalid input: %s"), token_buffer ?
| quote (token_buffer) : "");
| Bison output after correct:
| err.y:3: invalid input:
| err.y:4: fatal error: no rules in the input grammar
Thanks, I'm applying the appended patch rather than your workaround.
Here is the result:
~/src/bison-1.29 % ./tests/bison /tmp/err.y nostromo 18:03
/tmp/err.y:3: entrée non valide: `?'
/tmp/err.y:4: erreur fatale: la grammaire n'a pas de règles
~/src/bison-1.29 % LC_ALL=C ./tests/bison /tmp/err.y nostromo Err 1
/tmp/err.y:3: invalid input: `?'
/tmp/err.y:4: fatal error: no rules in the input grammar
Index: ChangeLog
from Akim Demaille <address@hidden>
* tests/regression.at (Invalid input): New.
* src/lex.c (lex): Be sure to set `token_buffer' in any case.
Reported by Shura.
Index: src/lex.c
===================================================================
RCS file: /cvsroot/bison/bison/src/lex.c,v
retrieving revision 1.33.2.6
diff -u -u -r1.33.2.6 lex.c
--- src/lex.c 2001/10/01 19:47:09 1.33.2.6
+++ src/lex.c 2001/10/02 15:52:17
@@ -469,32 +469,40 @@
}
case ',':
+ token_buffer = ",";
return tok_comma;
case ':':
+ token_buffer = ":";
return tok_colon;
case ';':
+ token_buffer = ";";
return tok_semicolon;
case '|':
+ token_buffer = "|";
return tok_bar;
case '{':
+ token_buffer = "{";
return tok_left_curly;
case '=':
+ obstack_1grow (&token_obstack, c);
do
{
c = getc (finput);
+ obstack_1grow (&token_obstack, c);
if (c == '\n')
lineno++;
}
while (c == ' ' || c == '\n' || c == '\t');
+ obstack_1grow (&token_obstack, '\0');
+ token_buffer = obstack_finish (&token_obstack);
if (c == '{')
{
- token_buffer = "={";
return tok_left_curly;
}
else
@@ -511,6 +519,9 @@
return parse_percent_token ();
default:
+ obstack_1grow (&token_obstack, c);
+ obstack_1grow (&token_obstack, '\0');
+ token_buffer = obstack_finish (&token_obstack);
return tok_illegal;
}
}
Index: tests/regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/regression.at,v
retrieving revision 1.1.2.2
diff -u -u -r1.1.2.2 regression.at
--- tests/regression.at 2001/09/18 15:18:26 1.1.2.2
+++ tests/regression.at 2001/10/02 15:52:17
@@ -74,7 +74,7 @@
AT_SETUP([%union and C comments])
AT_DATA([union-comment.y],
-[%union
+[%union
{
/* The int. */ int integer;
/* The string. */ char *string ;
@@ -87,3 +87,23 @@
AT_CHECK([fgrep '//*' union-comment.tab.c], [1], [])
AT_CLEANUP([union-comment.*])
+
+
+## --------------- ##
+## invalid input. ##
+## --------------- ##
+
+
+AT_SETUP([Invalid input])
+
+AT_DATA([input.y],
+[[%%
+?
+]])
+
+AT_CHECK([bison input.y], [1], [],
+[input.y:2: invalid input: `?'
+input.y:3: fatal error: no rules in the input grammar
+])
+
+AT_CLEANUP