summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2021-09-07 08:21:40 +0200
committerAkim Demaille <akim.demaille@gmail.com>2021-09-12 12:03:58 +0200
commit2142e5915576b124d76e3acecd34e4bbf538d2fe (patch)
treee586523725fd02a55c9df66fc49502450875133f /tests
parenta75072476e251db338f392bef4200d3a2fe2c17a (diff)
downloadbison-2142e5915576b124d76e3acecd34e4bbf538d2fe.tar.gz
c++: demonstrate custom error messages in the examples
Let's use c++/glr to demonstrate custom error messages in C++ (not just in glr2.cc). * examples/c++/glr/c++-types.yy (report_syntax_error): New. * examples/c++/glr/c++-types.test: Adjust. * examples/c/bistromathic/parse.y: Comment changes. * tests/local.at (AT_YYERROR_DEFINE(c++)): Use a nicer way to print the lookakead's name.
Diffstat (limited to 'tests')
-rw-r--r--tests/local.at7
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/local.at b/tests/local.at
index 170e5da1..1138df47 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -823,11 +823,8 @@ void
++*nerrs;]])[]AT_LOCATION_IF([[
std::cerr << ctx.location () << ": ";]])[
std::cerr << "syntax error";
- {
- symbol_kind_type la = ctx.token ();
- if (la != symbol_kind::S_YYEMPTY)
- std::cerr << " on token [" << symbol_name (la) << ']';
- }
+ if (!ctx.lookahead ().empty ())
+ std::cerr << " on token [" << ctx.lookahead ().name () << ']';
{
enum { TOKENMAX = 10 };
symbol_kind_type expected[TOKENMAX];