Opened 14 years ago

Closed 13 years ago

#1914 closed Bugs (fixed)

Boost.PropertyTree JSON parser in SVN trunk does not compile with Spirit2 changes

Reported by: ramon.casellas@… Owned by: kaalus
Milestone: To Be Determined Component: property_tree
Version: Boost Development Trunk Severity: Showstopper
Keywords: property tree, Boost.PropertyTree, spirit2 Cc:

Description

Boost.PropertyTree JSON parser in SVN trunk does not compile with Spirit2 changes.

See g++ 4.1 log.

Attached patch that solves the issue (at least for me). A hack, surely there exists a better/cleaner patch

(compile)

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 < token compilation terminated due to -Wfatal-errors

(patch)


--- /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 @@

#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/detail/ptree_utils.hpp> #include <boost/property_tree/detail/json_parser_error.hpp>

-#include <boost/spirit.hpp> +#include <boost/spirit/include/classic.hpp>

#include <string> #include <locale> #include <istream>

@@ -24,6 +24,7 @@

namespace boost { namespace property_tree { namespace json_parser {

+ using namespace BOOST_SPIRIT_CLASSIC_NS;

/ Json parser context

@@ -155,7 +156,7 @@

Json grammar

template<class Ptree>

  • struct json_grammar: public boost::spirit::grammar<json_grammar<Ptree> >

+ struct json_grammar: public grammar<json_grammar<Ptree> >

{

typedef context<Ptree> Context;

@@ -167,14 +168,11 @@

struct definition {

  • boost::spirit::rule<Scanner> root, object, member, array, item, value, string, number;
  • boost::spirit::rule<typename boost::spirit::lexeme_scanner<Scanner>::type> character, escape;

+ rule<Scanner> root, object, member, array, item, value, string, number; + rule<typename lexeme_scanner<Scanner>::type> character, escape;

definition(const json_grammar &self) {

  • using namespace boost::spirit;

-

Assertions assertion<std::string> expect_object("expected object"); assertion<std::string> expect_eoi("expected end of input");

@@ -259,7 +257,7 @@

}

  • const boost::spirit::rule<Scanner> &start() const

+ const rule<Scanner> &start() const

{

return root;

}

@@ -279,8 +277,6 @@

Ptree &pt, const std::string &filename)

{

-

  • using namespace boost::spirit;

typedef typename Ptree::key_type::value_type Ch; typedef typename std::vector<Ch>::iterator It;

-----------------------8<-------------------------------------------

Attachments (1)

boost_ptree_spirit_ns.patch (2.3 KB ) - added by ramon.casellas@… 14 years ago.
Simple patch to solve PTree JSON parser read issue with new Spirit

Download all attachments as: .zip

Change History (2)

by ramon.casellas@…, 14 years ago

Attachment: boost_ptree_spirit_ns.patch added

Simple patch to solve PTree JSON parser read issue with new Spirit

comment:1 by Sebastian Redl, 13 years ago

Resolution: fixed
Status: newclosed

Fixed on ptree update branch.

Note: See TracTickets for help on using tickets.