Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66988 - in sandbox/configurator/boost/configurator: . detail
From: for.dshevchenko_at_[hidden]
Date: 2010-12-03 13:46:35


Author: dshevchenko
Date: 2010-12-03 13:46:31 EST (Fri, 03 Dec 2010)
New Revision: 66988
URL: http://svn.boost.org/trac/boost/changeset/66988

Log:
Numbers of lines were detected unopened/unclosed multi-line comments now detected in error message.

Text files modified:
   sandbox/configurator/boost/configurator/configurator.hpp | 6 +++++-
   sandbox/configurator/boost/configurator/detail/comments_remover.hpp | 13 ++++++++++---
   sandbox/configurator/boost/configurator/detail/pure_strings_obtainer.hpp | 4 +---
   3 files changed, 16 insertions(+), 7 deletions(-)

Modified: sandbox/configurator/boost/configurator/configurator.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/configurator.hpp (original)
+++ sandbox/configurator/boost/configurator/configurator.hpp 2010-12-03 13:46:31 EST (Fri, 03 Dec 2010)
@@ -153,7 +153,7 @@
 private:
     // detail::str_storage multiply_sections_names;
 public:
- configurator& allow_section_multiplicity() {
+ configurator& allow_multiplicity() {
         // Not implemented yet, planning...
         //
         // std::string section_name( current_section_path.begin(), current_section_path.end() );
@@ -243,6 +243,10 @@
             return;
         } else {}
         
+ BOOST_FOREACH ( std::string& s, obtained_strings ) {
+ boost::trim( s );
+ }
+
         if ( obtained_strings.empty() ) {
             notify( "No actual data in configuration file, is file empty?" );
         } else {}

Modified: sandbox/configurator/boost/configurator/detail/comments_remover.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/comments_remover.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/comments_remover.hpp 2010-12-03 13:46:31 EST (Fri, 03 Dec 2010)
@@ -116,9 +116,11 @@
                 uncomment_strings.append( first_it, end_it );
                 break;
             } else if ( end_it == end_of_comment ) {
- notify( "Unclosed multi-line comment detected!" );
+ notify( "Unclosed multi-line comment detected in line "
+ + get_line_number( s, begin_of_comment ) + "!" );
             } else if ( begin_of_comment > end_of_comment ) {
- notify( "Unopened multi-line comment detected!" );
+ notify( "Unopened multi-line comment detected in line "
+ + get_line_number( s, end_of_comment ) + "!" );
             }
 
             uncomment_strings.append( first_it, begin_of_comment );
@@ -130,7 +132,12 @@
     void resplit( const std::string& s, str_storage& obtained_strings ) const {
         obtained_strings.clear();
         boost::split( obtained_strings, s, boost::is_any_of( "\n" ) );
- }
+ }
+
+ std::string get_line_number( const std::string& s, string_const_it it ) const {
+ const size_t ln_quantity = (size_t)std::count( s.begin(), it, '\n' );
+ return boost::lexical_cast< std::string >( ln_quantity + 1 );
+ }
 };
 
 } // namespace detail

Modified: sandbox/configurator/boost/configurator/detail/pure_strings_obtainer.hpp
==============================================================================
--- sandbox/configurator/boost/configurator/detail/pure_strings_obtainer.hpp (original)
+++ sandbox/configurator/boost/configurator/detail/pure_strings_obtainer.hpp 2010-12-03 13:46:31 EST (Fri, 03 Dec 2010)
@@ -59,9 +59,7 @@
         std::string s;
         while ( std::getline( configuration_file, s ) ) {
             boost::trim( s );
- if ( !s.empty() ) {
- strings += s;
- } else {}
+ strings += s;
         }
         return strings;
     }


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