[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: yyerror() location tracking
From: |
Joel E. Denny |
Subject: |
Re: yyerror() location tracking |
Date: |
Sun, 17 Jan 2010 13:44:03 -0500 (EST) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
On Sat, 16 Jan 2010, Tom Stellard wrote:
> I am trying to add line numbers to my parser's error messages. I have
> included the options, %locations and %define api.pure in my bison
> definition file, but it seems to be generating yyerror with this signature:
> yyerror(const char *msg);
> instead of the signature I am expecting:
> yyerror (YYLTYPE *locp, const char * msg)
> I have attached the bison definition file I am trying to use.
> Thanks.
The section of the manual you want is:
http://www.gnu.org/software/bison/manual/html_node/Error-Reporting.html#Error-Reporting
As you'll read there, to convince the deterministic parser in C to pass a
location to yyerror, you need to specify %define api.pure, at least one
%lex-param, and at least one %parse-param. The %lex-param and
%parse-param can be the same.
The yyerror prototype is confusing. We've been considering ways to
alleviate this problem, but we're not done yet.