Boost C++ Libraries: Ticket #3235: position_iterator and skip parser https://svn.boost.org/trac10/ticket/3235 <p> This prints 1 while the error is on line 2. </p> <pre class="wiki">#include &lt;boost/spirit/include/classic.hpp&gt; #include &lt;cassert&gt; #include &lt;iostream&gt; using namespace boost::spirit::classic; using namespace std; int main() { typedef position_iterator&lt;const char*&gt; iterator_t; const char* str = "1\nA"; parse_info&lt;iterator_t&gt; info = parse(iterator_t(str, str + strlen(str)), iterator_t(), int_p &gt;&gt; !end_p, space_p); cout &lt;&lt; info.stop.get_position().line &lt;&lt; endl; return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3235 Trac 1.4.3 anonymous Fri, 26 Feb 2010 01:40:17 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3235#comment:1 https://svn.boost.org/trac10/ticket/3235#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> Sure, it needs to give you a line number of 1, because the parse fails before the end_p parser, which leaves the position of the last valid match at the point before the skip of the failed match (IOW, right after the last successful match). </p> <p> Regards Hartmut </p> Ticket