Reported by Marc Mendiola.
http://lists.gnu.org/archive/html/help-bison/2012-10/msg00017.html
* gnulib: Update to get quote_mem.
* src/scan-gram.l: Use it.
* tests/input.at (Invalid inputs): Additional checks.
* tests/named-refs.at: Likewise.
Other issues in the test suite have been addressed.
+ Nul characters are correctly displayed in error messages.
+
* Noteworthy changes in release 2.6.4 (2012-10-23) [stable]
Bison 2.6.3's --version was incorrect. This release fixes this issue.
Lie Yan lie.yan@kaust.edu.sa
Magnus Fromreide magfr@lysator.liu.se
Marc Autret autret_m@epita.fr
+Marc Mendiola mmendiol@usc.edu
Martin Jacobs martin.jacobs@arcor.de
Martin Mokrejs mmokrejs@natur.cuni.cz
Martin Nylin martin.nylin@linuxmail.org
}
. {
- complain_at (*loc, _("invalid character: %s"), quote (yytext));
+ complain_at (*loc, _("invalid character: %s"), quote_mem (yytext, yyleng));
}
<<EOF>> {
}
. {
complain_at (*loc, _("invalid character in bracketed name: %s"),
- quote (yytext));
+ quote_mem (yytext, yyleng));
}
<<EOF>> {
BEGIN bracketed_id_context_state;
AT_SETUP([Invalid inputs])
AT_DATA([input.y],
-[[%%
+[[\000\001\002\377?
+%%
?
default: 'a' }
%&
%-
%{
]])
+AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
AT_BISON_CHECK([input.y], [1], [],
-[[input.y:2.1: invalid character: '?'
-input.y:3.14: invalid character: '}'
-input.y:4.1: invalid character: '%'
-input.y:4.2: invalid character: '&'
-input.y:5.1-17: invalid directive: '%a-does-not-exist'
-input.y:6.1: invalid character: '%'
-input.y:6.2: invalid character: '-'
-input.y:7.1-8.0: missing '%}' at end of file
-input.y:7.1-8.0: syntax error, unexpected %{...%}
+[[input.y:1.1: invalid character: '\0'
+input.y:1.1: invalid character: '\001'
+input.y:1.1: invalid character: '\002'
+input.y:1.1: invalid character: '\377'
+input.y:1.2: invalid character: '?'
+input.y:3.1: invalid character: '?'
+input.y:4.14: invalid character: '}'
+input.y:5.1: invalid character: '%'
+input.y:5.2: invalid character: '&'
+input.y:6.1-17: invalid directive: '%a-does-not-exist'
+input.y:7.1: invalid character: '%'
+input.y:7.2: invalid character: '-'
+input.y:8.1-9.0: missing '%}' at end of file
+input.y:8.1-9.0: syntax error, unexpected %{...%}
]])
AT_CLEANUP
AT_DATA_GRAMMAR([test.y],
[[
%%
-start: foo[ /* aaa */ *&-.+ ] bar
+start: foo[ /* aaa */ *&-.+\000\001\002\377 ] bar
{ s = $foo; }
]])
+AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' test.y || exit 77]])
AT_BISON_CHECK([-o test.c test.y], 1, [],
[[test.y:11.23: invalid character in bracketed name: '*'
test.y:11.24: invalid character in bracketed name: '&'
test.y:11.25: invalid character in bracketed name: '-'
test.y:11.27: invalid character in bracketed name: '+'
+test.y:11.28: invalid character in bracketed name: '\0'
+test.y:11.28: invalid character in bracketed name: '\001'
+test.y:11.28: invalid character in bracketed name: '\002'
+test.y:11.28: invalid character in bracketed name: '\377'
]])
AT_CLEANUP