Boost C++ Libraries: Ticket #1914: Boost.PropertyTree JSON parser in SVN trunk does not compile with Spirit2 changes https://svn.boost.org/trac10/ticket/1914 <p> Boost.<a class="missing wiki">PropertyTree</a> JSON parser in SVN trunk does not compile with Spirit2 changes. </p> <p> See g++ 4.1 log. </p> <p> Attached patch that solves the issue (at least for me). A hack, surely there exists a better/cleaner patch </p> <p> (compile) </p> <p> from .... boost/property_tree/detail/json_parser_read.hpp from .... boost/property_tree/json_parser.hpp from .... proj/parser.cpp /mnt/server/grups/boost/include/boost-1_35/boost/spirit.hpp:15:4: warning: #warning "This header is deprecated. Please use: boost/spirit/include/classic.hpp" /mnt/server/grups/boost/include/boost-1_35/boost/property_tree/detail/json_parser_read.hpp:158: error: expected template-name before &lt; token compilation terminated due to -Wfatal-errors </p> <p> (patch) </p> <hr /> <p> --- /opt/boost-svn/include/boost-1_35/boost/property_tree/detail/json_parser_read.hpp.old 2008-05-13 08:56:17.000000000 +0200 +++ /opt/boost-svn/include/boost-1_35/boost/property_tree/detail/json_parser_read.hpp 2008-05-13 09:04:10.000000000 +0200 @@ -15,7 +15,7 @@ </p> <blockquote> <p> #include &lt;boost/property_tree/ptree.hpp&gt; #include &lt;boost/property_tree/detail/ptree_utils.hpp&gt; #include &lt;boost/property_tree/detail/json_parser_error.hpp&gt; </p> </blockquote> <p> -#include &lt;boost/spirit.hpp&gt; +#include &lt;boost/spirit/include/classic.hpp&gt; </p> <blockquote> <p> #include &lt;string&gt; #include &lt;locale&gt; #include &lt;istream&gt; </p> </blockquote> <p> @@ -24,6 +24,7 @@ </p> <blockquote> <p> namespace boost { namespace property_tree { namespace json_parser { </p> </blockquote> <p> + using namespace BOOST_SPIRIT_CLASSIC_NS; </p> <blockquote> <p> <em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em></em><em>/ </em> Json parser context </p> </blockquote> <p> @@ -155,7 +156,7 @@ </p> <blockquote> <p> <em> Json grammar </em></p> </blockquote> <p> </p> <blockquote> <p> template&lt;class Ptree&gt; </p> </blockquote> <ul><li> struct json_grammar: public boost::spirit::grammar&lt;json_grammar&lt;Ptree&gt; &gt; </li></ul><p> + struct json_grammar: public grammar&lt;json_grammar&lt;Ptree&gt; &gt; </p> <blockquote> <p> { </p> </blockquote> <p> </p> <blockquote> <blockquote> <p> typedef context&lt;Ptree&gt; Context; </p> </blockquote> </blockquote> <p> @@ -167,14 +168,11 @@ </p> <blockquote> <p> struct definition { </p> </blockquote> <p> </p> <ul><li> boost::spirit::rule&lt;Scanner&gt; root, object, member, array, item, value, string, number; </li><li> boost::spirit::rule&lt;typename boost::spirit::lexeme_scanner&lt;Scanner&gt;::type&gt; character, escape; </li></ul><p> + rule&lt;Scanner&gt; root, object, member, array, item, value, string, number; + rule&lt;typename lexeme_scanner&lt;Scanner&gt;::type&gt; character, escape; </p> <blockquote> <p> definition(const json_grammar &amp;self) { </p> </blockquote> <ul><li> </li><li> using namespace boost::spirit; </li></ul><p> - </p> <blockquote> <p> <em> Assertions assertion&lt;std::string&gt; expect_object("expected object"); assertion&lt;std::string&gt; expect_eoi("expected end of input"); </em></p> </blockquote> <p> @@ -259,7 +257,7 @@ </p> <blockquote> <p> } </p> </blockquote> <p> </p> <ul><li> const boost::spirit::rule&lt;Scanner&gt; &amp;start() const </li></ul><p> + const rule&lt;Scanner&gt; &amp;start() const </p> <blockquote> <p> { </p> <blockquote> <p> return root; </p> </blockquote> <p> } </p> </blockquote> <p> @@ -279,8 +277,6 @@ </p> <blockquote> <p> Ptree &amp;pt, const std::string &amp;filename) </p> </blockquote> <blockquote> <p> { </p> </blockquote> <p> - </p> <ul><li> using namespace boost::spirit; </li></ul><blockquote> <p> typedef typename Ptree::key_type::value_type Ch; typedef typename std::vector&lt;Ch&gt;::iterator It; </p> </blockquote> <blockquote> <p> -----------------------8&lt;------------------------------------------- </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1914 Trac 1.4.3 ramon.casellas@… Tue, 13 May 2008 07:30:40 GMT attachment set https://svn.boost.org/trac10/ticket/1914 https://svn.boost.org/trac10/ticket/1914 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_ptree_spirit_ns.patch</span> </li> </ul> <p> Simple patch to solve PTree JSON parser read issue with new Spirit </p> Ticket Sebastian Redl Fri, 15 May 2009 18:55:33 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1914#comment:1 https://svn.boost.org/trac10/ticket/1914#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">fixed</span> </li> </ul> <p> Fixed on ptree update branch. </p> Ticket