help-bison
[Top][All Lists]
Advanced

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

Changing error messages.


From: Phil Spiby
Subject: Changing error messages.
Date: Thu, 4 Apr 2002 17:39:17 +0100

Folks,

I have been using Bison now for about 8 years and find it an invaluable
tool. However, one issue I have got with it is the default error messages,
and the lack of ability to change these.

My solution (which worked until the recent releases of Bison) was to use a
script (actually a flex program) to change the code between
#ifdef YYERROR_VERBOSE and #endif /* YYERROR_VERBOSE */.

Thinking about it a little more, I think a general solution would be more
appropriate, such as using #define's to define the text or functions used to
put information into the verbose error messages. For example the default
could be:
#ifndef YYERRORMSG
#define YYERRORMSG "Parse error"
#endif
I would then use:
#define YYERRORMSG (filepass == syntax_check ? "SYNTAX:" : "REFERENCE:")

Just a suggestion!

Phil
-----------------------------------------------------------
Dr. Phil Spiby               Tel: +44 1623 522940
Eurostep Limited             Fax: +44 1623 522941
73 Columbia Avenue           Mobile: +44 7785 990352
Sutton-in-Ashfield           Email:address@hidden
Nottinghamshire
NG17 2GZ
United Kingdom




reply via email to

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