Boost Users :
Subject: Re: [Boost-users] [qi] Get line number of an on_error handler from an ifstream iterator
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-09-13 22:40:14
On 9/14/2011 1:40 AM, boost_mailinglist_at_[hidden] wrote:
> can anyone of you give me a hint, how I can get the line number of the input file inside
> the on_error handler where the parsing error happens?
> Full source is atttached as file.cpp.
One way is to use the file_iterator adapter of spirit classic.
There are other ways. In the compiler-tutorial (*), I decorate the
AST nodes with a unique identifier to a map of iterators/or
positions which can be used to compute the file position on demand.
(* %BOOST%/libs/spirit/example/qi/compiler_tutorial )
-- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net