]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/spirit/home/x3/support/utility/error_reporting.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / spirit / home / x3 / support / utility / error_reporting.hpp
index 94435e9ae27d2f8df7ccd29c4fe1c9e759039301..a9f2ef4df91c74670f6c1b81173d7eed8bad4f84 100644 (file)
@@ -64,8 +64,6 @@ namespace boost { namespace spirit { namespace x3
         void print_file_line(std::size_t line) const;
         void print_line(Iterator line_start, Iterator last) const;
         void print_indicator(Iterator& line_start, Iterator last, char ind) const;
-        void skip_whitespace(Iterator& err_pos, Iterator last) const;
-        void skip_non_whitespace(Iterator& err_pos, Iterator last) const;
         Iterator get_line_start(Iterator first, Iterator pos) const;
         std::size_t position(Iterator i) const;
 
@@ -123,41 +121,15 @@ namespace boost { namespace spirit { namespace x3
         }
     }
 
-    template <typename Iterator>
-    void error_handler<Iterator>::skip_whitespace(Iterator& err_pos, Iterator last) const
-    {
-        // make sure err_pos does not point to white space
-        while (err_pos != last)
-        {
-            char c = *err_pos;
-            if (std::isspace(c))
-                ++err_pos;
-            else
-                break;
-        }
-    }
-
-    template <typename Iterator>
-    void error_handler<Iterator>::skip_non_whitespace(Iterator& err_pos, Iterator last) const
-    {
-        // make sure err_pos does not point to white space
-        while (err_pos != last)
-        {
-            char c = *err_pos;
-            if (std::isspace(c))
-                break;
-            else
-                ++err_pos;
-        }
-    }
-
     template <class Iterator>
     inline Iterator error_handler<Iterator>::get_line_start(Iterator first, Iterator pos) const
     {
         Iterator latest = first;
-        for (Iterator i = first; i != pos; ++i)
+        for (Iterator i = first; i != pos;)
             if (*i == '\r' || *i == '\n')
-                latest = i;
+                latest = ++i;
+            else
+                ++i;
         return latest;
     }
 
@@ -192,15 +164,10 @@ namespace boost { namespace spirit { namespace x3
         Iterator first = pos_cache.first();
         Iterator last = pos_cache.last();
 
-        // make sure err_pos does not point to white space
-        skip_whitespace(err_pos, last);
-
         print_file_line(position(err_pos));
         err_out << error_message << std::endl;
 
         Iterator start = get_line_start(first, err_pos);
-        if (start != first)
-            ++start;
         print_line(start, last);
         print_indicator(start, err_pos, '_');
         err_out << "^_" << std::endl;
@@ -213,15 +180,10 @@ namespace boost { namespace spirit { namespace x3
         Iterator first = pos_cache.first();
         Iterator last = pos_cache.last();
 
-        // make sure err_pos does not point to white space
-        skip_whitespace(err_first, last);
-
         print_file_line(position(err_first));
         err_out << error_message << std::endl;
 
         Iterator start = get_line_start(first, err_first);
-        if (start != first)
-            ++start;
         print_line(start, last);
         print_indicator(start, err_first, ' ');
         print_indicator(start, err_last, '~');