Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81093 - branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2
From: joel_at_[hidden]
Date: 2012-10-28 22:23:36


Author: djowel
Date: 2012-10-28 22:23:36 EDT (Sun, 28 Oct 2012)
New Revision: 81093
URL: http://svn.boost.org/trac/boost/changeset/81093

Log:
Merge from trunk
Properties modified:
   branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2/ (props changed)
Text files modified:
   branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2/error_handler.hpp | 12 +++++++++---
   branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2/main.cpp | 1 +
   2 files changed, 10 insertions(+), 3 deletions(-)

Modified: branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2/error_handler.hpp
==============================================================================
--- branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2/error_handler.hpp (original)
+++ branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2/error_handler.hpp 2012-10-28 22:23:36 EDT (Sun, 28 Oct 2012)
@@ -36,12 +36,18 @@
             // to the last validly matched token, so we use its end iterator
             // as the error position
             BaseIterator err_pos_base = err_pos->matched().end();
+ std::cout << message << what << std::endl;
+ if (err_pos_base != BaseIterator())
+ dump_error_line(err_pos_base);
+ }
 
+ void dump_error_line(BaseIterator err_pos_base) const
+ {
             int line;
             BaseIterator line_start = get_pos(err_pos_base, line);
             if (err_pos_base != last)
             {
- std::cout << message << what << " line " << line << ':' << std::endl;
+ std::cout << " line " << line << ':' << std::endl;
                 std::cout << get_line(line_start) << std::endl;
                 for (; line_start != err_pos_base; ++line_start)
                     std::cout << ' ';
@@ -49,9 +55,9 @@
             }
             else
             {
- std::cout << "Unexpected end of file. ";
- std::cout << message << what << " line " << line << std::endl;
+ std::cout << "Unexpected end of file.\n";
             }
+
         }
 
         BaseIterator get_pos(BaseIterator err_pos, int& line) const

Modified: branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2/main.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2/main.cpp (original)
+++ branches/release/libs/spirit/example/qi/compiler_tutorial/conjure2/main.cpp 2012-10-28 22:23:36 EDT (Sun, 28 Oct 2012)
@@ -122,6 +122,7 @@
     }
     else
     {
+ error_handler.dump_error_line(first);
         std::cout << "Parse failure\n";
     }
     return 0;


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