Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73367 - in trunk/libs/spirit/example/qi/compiler_tutorial: conjure2 conjure3
From: hartmut.kaiser_at_[hidden]
Date: 2011-07-25 21:11:11


Author: hkaiser
Date: 2011-07-25 21:11:11 EDT (Mon, 25 Jul 2011)
New Revision: 73367
URL: http://svn.boost.org/trac/boost/changeset/73367

Log:
Spirit: Fixing wrong error position reported by lexer based conjure examples
Text files modified:
   trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/error_handler.hpp | 6 ++++--
   trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/error_handler.hpp | 6 ++++--
   2 files changed, 8 insertions(+), 4 deletions(-)

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/error_handler.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/error_handler.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure2/error_handler.hpp 2011-07-25 21:11:11 EDT (Mon, 25 Jul 2011)
@@ -32,8 +32,10 @@
             What const& what,
             Iterator err_pos) const
         {
- // retrieve underlying iterator from current token
- BaseIterator err_pos_base = err_pos->matched().begin();
+ // retrieve underlying iterator from current token, err_pos points
+ // to the last validly matched token, so we use it's end iterator
+ // as the error position
+ BaseIterator err_pos_base = err_pos->matched().end();
 
             int line;
             BaseIterator line_start = get_pos(err_pos_base, line);

Modified: trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/error_handler.hpp
==============================================================================
--- trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/error_handler.hpp (original)
+++ trunk/libs/spirit/example/qi/compiler_tutorial/conjure3/error_handler.hpp 2011-07-25 21:11:11 EDT (Mon, 25 Jul 2011)
@@ -32,8 +32,10 @@
             What const& what,
             Iterator err_pos) const
         {
- // retrieve underlying iterator from current token
- BaseIterator err_pos_base = err_pos->matched().begin();
+ // retrieve underlying iterator from current token, err_pos points
+ // to the last validly matched token, so we use it's end iterator
+ // as the error position
+ BaseIterator err_pos_base = err_pos->matched().end();
 
             int line;
             BaseIterator line_start = get_pos(err_pos_base, line);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk