Related articles |
---|
Error message with bison and flex laplante.p@gmail.com (2014-04-07) |
Re: Error message with bison and flex kaz@kylheku.com (Kaz Kylheku) (2014-04-10) |
Re: Error message with bison and flex DrDiettrich1@aol.com (Hans-Peter Diettrich) (2014-04-11) |
Re: Error message with bison and flex gah@ugcs.caltech.edu (glen herrmannsfeldt) (2014-04-12) |
From: | laplante.p@gmail.com |
Newsgroups: | comp.compilers |
Date: | Mon, 7 Apr 2014 22:36:46 -0700 (PDT) |
Organization: | Compilers Central |
Keywords: | yacc, errors |
Posted-Date: | 10 Apr 2014 10:18:09 EDT |
Sometime the text return from a syntax error is very short.
I would like to output 5 lines before the error and
5 lines after the error.
Is this possible without affecting the error message.
If I used input to read the next 5 lins, the message won't be the same and
I don't want to always accumulate the 5 lines before, it will add a lot of overhead to the lexical analyser.
Tx
[The way I'd do it would be to write my own YY_INPUT() that slurps in
the whole file to a buffer when it starts and hands the input to the
lexer a line at a time, so it knows what line it's on. If there's an
error, it can then scan forward and backward in the file buffer to find
the five lines each way. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.