Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1212

Error message with bison and flex

From laplante.p@gmail.com
Newsgroups comp.compilers
Subject Error message with bison and flex
Date 2014-04-07 22:36 -0700
Organization Compilers Central
Message-ID <14-04-005@comp.compilers> (permalink)

Show all headers | View raw


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]

Back to comp.compilers | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Error message with bison and flex laplante.p@gmail.com - 2014-04-07 22:36 -0700
  Re: Error message with bison and flex Kaz Kylheku <kaz@kylheku.com> - 2014-04-10 15:06 +0000
    Re: Error message with bison and flex Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-04-11 03:30 +0200
      Re: Error message with bison and flex glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-04-12 03:31 +0000

csiph-web