help-bison
[Top][All Lists]
Advanced

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

Re: Syntax error messages


From: Hans Åberg
Subject: Re: Syntax error messages
Date: Mon, 27 Sep 2021 22:07:33 +0200

> On 27 Sep 2021, at 22:02, Akim Demaille <akim@lrde.epita.fr> wrote:
> 
> Hi Hans,
> 
>> Le 27 sept. 2021 à 20:54, Hans Åberg <haberg-1@telia.com> a écrit :
>> 
>> In order to generate better syntax error messages writing out the input line 
>> with the error and a line with a marker underneath, I thought of checking 
>> how Bison does it, but I could not find the place in its sources. 
>> —Specifically, a suggestion is to tweak YY_INPUT in the lexer to buffer one 
>> input line at a time, but Bison does not seem to do that.
> 
> No, I keep track of the byte offset in the file, and print from the file, 
> which I reopen to quote the source.

OK. I thought of this method, but then it does not work with streams.

> Almost everything is in src/location.[ch].  It is location_caret that quotes 
> the input file and underline the error's location.

Thanks.





reply via email to

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