bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/6] diagnostics: improve bison's syntax error messages


From: Akim Demaille
Subject: [PATCH 0/6] diagnostics: improve bison's syntax error messages
Date: Thu, 23 Jan 2020 08:50:55 +0100

This series of patches plays with parse.error=detailed in bison
itself, and then with parse.error=custom.  This was an opportunity to
change bison's syntax errors themselves, so we're going from:

  foo.y:1.8-13: error: syntax error, unexpected %token, expecting character 
literal or identifier or <tag>
 
to

  foo.y:1.8-13: error: expected character literal or identifier or <tag> before 
%token
 
where the expected tokens ("character literal", "identifier" and
"<tag>") are displayed in green by default, and the unexpected one
("%token") is in red.  I'm not sure yet of these choices, comments are
most welcome.

You ought to install the latest version of libtextstyle to avoid some
bugs (currently
https://alpha.gnu.org/gnu/gettext/libtextstyle-0.20.5.tar.gz).

What remains to be done:
- push parsers in yacc
  That might force changes in the API, so it should be done before
  the following steps
- the other skeletons (anybody?)
- the doc

Cheers!

 data/bison-default.css |   3 +
 src/complain.c         |  80 +++++++++++--
 src/complain.h         |   5 +
 src/parse-gram.c       | 257 ++++++++++++-----------------------------
 src/parse-gram.h       |   4 +-
 src/parse-gram.y       |  92 ++++++++-------
 tests/diagnostics.at   |   2 +-
 tests/input.at         |  18 +--
 8 files changed, 212 insertions(+), 249 deletions(-)

-- 
2.25.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]