   Boost spirit & line/column numbers
  I know that boost.spirit has a wrapper-iterator that stores information about the current line and column, but is there a way to store that information during parsing? I need this information to verify some of the arguments (for example if a given font-type exists) in an additional step which I can't do with my spirit rules (or I don't know how that would be possible) and report errors with references to the line and column, where the error originated.Given a simple rule like this, which produces a std::string,quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];can it be modified to synthesize a structure, consisting of a std::string and a file_position that is taken from the iterator of the rule?   
  It's fairly easy:struct FileLocationInfo{std::string FileName;unsigned Line;unsigned Column;};typedef boost::spirit::classic::position_iterator<const char*> ParsePosIter;class ParserState{public:void SetParsePosition(const ParsePosIter& pos){FileLocationInfo fileinfo;fileinfo.FileName = ParsePosition.get_position().file;fileinfo.Line = ParsePosition.get_position().line;fileinfo.Column = ParsePosition.get_position().column;}};struct SomeFunctor{SomeFunctor(ParserState& state): StateRef(state){ }template <typename IteratorType>void operator () (IteratorType begin, IteratorType end) const{StateRef.SetParsePosition(begin);// Do additional processing of the rule here}private:ParserState& StateRef;};// In your grammarFooRule = (Frobnicate)[SomeFunctor(self.State)];// In the grammar wrapper structprotected:ParserState& State;This is all stripped down from an actual implementation, used in the Epoch language project. You can check out the sources here if you'd like to see more detail on using Spirit. (The relevant files can be found under FugueDLL/Parser.)   