Boost C++ Libraries: Ticket #2860: misdetected unexpected character https://svn.boost.org/trac10/ticket/2860 <p> Quickbook incorrectly reports an unexpected character when processing the following </p> <p> [python] <code></code> print "\xfapln\xeck" <code></code> </p> <p> warning: in column:9, unexpected character: " warning: in column:22, unexpected character: " </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2860 Trac 1.4.3 jgresula@… Sun, 15 Mar 2009 21:59:22 GMT <link>https://svn.boost.org/trac10/ticket/2860#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2860#comment:1</guid> <description> <p> fixed formatting: </p> <pre class="wiki">[python] `` print "\xfapln\xeck" `` </pre><pre class="wiki">warning: in column:9, unexpected character: " warning: in column:22, unexpected character: " </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Mon, 16 Mar 2009 19:06:31 GMT</pubDate> <title>owner, status, component changed https://svn.boost.org/trac10/ticket/2860#comment:2 https://svn.boost.org/trac10/ticket/2860#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Joel de Guzman</span> to <span class="trac-author">Daniel James</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>component</strong> <span class="trac-field-old">quickbook</span> → <span class="trac-field-new">spirit</span> </li> </ul> <p> I think this is a bug in spirit's <code>c_escape_ch_p</code>. I'll look into it. </p> Ticket Daniel James Mon, 16 Mar 2009 19:16:22 GMT component changed https://svn.boost.org/trac10/ticket/2860#comment:3 https://svn.boost.org/trac10/ticket/2860#comment:3 <ul> <li><strong>component</strong> <span class="trac-field-old">spirit</span> → <span class="trac-field-new">quickbook</span> </li> </ul> <p> Sorry, my mistake. It's a bug in quickbook, it's using a C character escape parser for python and the syntax is different. Although I think it should be fairly liberal about how it parses either language, so I think I might change both to accept a string like that. </p> Ticket Daniel James Tue, 24 Mar 2009 08:34:14 GMT <link>https://svn.boost.org/trac10/ticket/2860#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2860#comment:4</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/51949" title="Use our own escape character parser. We're currently using the spirit ...">[51949]</a>) Use our own escape character parser. </p> <p> We're currently using the spirit escaped character parser. This is a strict C parser and causes parse errors for code that we probably should accept, such as any hexadecimal encoded characters with a value greater than the maximum value of the current platform's 'char'. This is \x7F on some platforms so it rejects '\x80' upwards. As well as rejecting characters that might be valid, it also means that quickbook will act differently on different platforms. </p> <p> In python strings, '\xaaa' is equivalent to '\xaa' + 'a', but the spirit parser interprets this as a character with value '0xaaa'. So we probably should accept these. </p> <p> I also think we should be liberal about what we accept. IMO it isn't our job to enforce correct C++/python, just to create a reasonable rendering of our input. So rather than write a parser which understands the various types of escapes, I just wrote one that ignores any character following a backslash. </p> <p> Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2860" title="#2860: Bugs: misdetected unexpected character (closed: fixed)">#2860</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daniel James</dc:creator> <pubDate>Mon, 30 Mar 2009 17:49:18 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/2860#comment:5 https://svn.boost.org/trac10/ticket/2860#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/52064" title="Fix bug handling python and C++ strings. Fixes #2860. Merged ...">[52064]</a>) Fix bug handling python and C++ strings. </p> <p> Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2860" title="#2860: Bugs: misdetected unexpected character (closed: fixed)">#2860</a>. </p> <p> Merged revisions 51949 via svnmerge from <a class="ext-link" href="https://svn.boost.org/svn/boost/trunk"><span class="icon">​</span>https://svn.boost.org/svn/boost/trunk</a> </p> <p> ........ </p> <blockquote> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/51949" title="Use our own escape character parser. We're currently using the spirit ...">r51949</a> | danieljames | 2009-03-24 08:34:09 +0000 (Tue, 24 Mar 2009) | 21 lines </p> </blockquote> <p> </p> <blockquote> <p> Use our own escape character parser. </p> </blockquote> <p> </p> <blockquote> <p> We're currently using the spirit escaped character parser. This is a strict C parser and causes parse errors for code that we probably should accept, such as any hexadecimal encoded characters with a value greater than the maximum value of the current platform's 'char'. This is \x7F on some platforms so it rejects '\x80' upwards. As well as rejecting characters that might be valid, it also means that quickbook will act differently on different platforms. </p> </blockquote> <p> </p> <blockquote> <p> In python strings, '\xaaa' is equivalent to '\xaa' + 'a', but the spirit parser interprets this as a character with value '0xaaa'. So we probably should accept these. </p> </blockquote> <p> </p> <blockquote> <p> I also think we should be liberal about what we accept. IMO it isn't our job to enforce correct C++/python, just to create a reasonable rendering of our input. So rather than write a parser which understands the various types of escapes, I just wrote one that ignores any character following a backslash. </p> </blockquote> <p> </p> <blockquote> <p> Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2860" title="#2860: Bugs: misdetected unexpected character (closed: fixed)">#2860</a>. </p> </blockquote> <p> ........ </p> Ticket