Modify

Opened 9 years ago

Closed 8 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@… 9 years ago.
Simple patch to solve PTree JSON parser read issue with new Spirit

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by ramon.casellas@…

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

comment:1 Changed 8 years ago by cornedbee

  • Resolution set to fixed
  • Status changed from new to closed

Fixed on ptree update branch.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain kaalus.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.