Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-09-07 19:28:22

"Jonathan Graehl" <jonathan_at_[hidden]> wrote in message
> For basic_newline_filter (great idea; I hadn't even realized Macintosh
> had yet ANOTHER newline convention), it would be nice to be able to get
> the current line number and possibly even the character number on that
> line, for reporting errors in input.

The is a very good idea. It would be a perfect addition to the text-processing

> I realize this should be possible
> as a separate filter counting '\n' and non-'\n' characters, which
> handles the output of basic_newline_filter, but I don't think the cost
> of maintaining one or two counters would be too much a burden for those
> who don't need it (or if it is, provide versions with and without).

I think it should be a separate filter. The implementation of
basic_newline_filter is already quite baroque. (Check out Using an optimization discussed in another message,
the overhead of a line or character counting filter should be almost zero.

One could even insert line counters at several positions in a filter chain.

> Even nicer would be a call that extracts up to the previous N already
> consumed characters, for even more helpful context (I have already made
> a practice of showing the next N characters to be read in case of a
> fatal error, when the input is a file and not interactive). Obviously
> this could be a filter in its own right, and really has nothing to do
> with basic_newline_filter.

Another good idea. It could use a simple circular buffer.


Boost list run by bdawes at, gregod at, cpdaniel at, john at